postgresai 0.14.0-dev.46 → 0.14.0-dev.49
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/bun.lock +1 -1
- package/dist/bin/postgres-ai.js +436 -2718
- package/lib/metrics-loader.ts +449 -97
- package/package.json +2 -2
- package/dist/sql/01.role.sql +0 -16
- package/dist/sql/02.permissions.sql +0 -37
- package/dist/sql/03.optional_rds.sql +0 -6
- package/dist/sql/04.optional_self_managed.sql +0 -8
- package/dist/sql/05.helpers.sql +0 -415
package/dist/bin/postgres-ai.js
CHANGED
|
@@ -13064,7 +13064,7 @@ var {
|
|
|
13064
13064
|
// package.json
|
|
13065
13065
|
var package_default = {
|
|
13066
13066
|
name: "postgresai",
|
|
13067
|
-
version: "0.14.0-dev.
|
|
13067
|
+
version: "0.14.0-dev.49",
|
|
13068
13068
|
description: "postgres_ai CLI",
|
|
13069
13069
|
license: "Apache-2.0",
|
|
13070
13070
|
private: false,
|
|
@@ -13086,7 +13086,7 @@ var package_default = {
|
|
|
13086
13086
|
node: ">=18"
|
|
13087
13087
|
},
|
|
13088
13088
|
scripts: {
|
|
13089
|
-
build: `bun build ./bin/postgres-ai.ts --outdir ./dist/bin --target node && node -e "const fs=require('fs');const f='./dist/bin/postgres-ai.js';fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace('#!/usr/bin/env bun','#!/usr/bin/env node'))"
|
|
13089
|
+
build: `bun build ./bin/postgres-ai.ts --outdir ./dist/bin --target node && node -e "const fs=require('fs');const f='./dist/bin/postgres-ai.js';fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace('#!/usr/bin/env bun','#!/usr/bin/env node'))"`,
|
|
13090
13090
|
prepublishOnly: "npm run build",
|
|
13091
13091
|
start: "bun ./bin/postgres-ai.ts --help",
|
|
13092
13092
|
"start:node": "node ./dist/bin/postgres-ai.js --help",
|
|
@@ -15881,7 +15881,7 @@ var Result = import_lib.default.Result;
|
|
|
15881
15881
|
var TypeOverrides = import_lib.default.TypeOverrides;
|
|
15882
15882
|
var defaults = import_lib.default.defaults;
|
|
15883
15883
|
// package.json
|
|
15884
|
-
var version = "0.14.0-dev.
|
|
15884
|
+
var version = "0.14.0-dev.49";
|
|
15885
15885
|
var package_default2 = {
|
|
15886
15886
|
name: "postgresai",
|
|
15887
15887
|
version,
|
|
@@ -15906,7 +15906,7 @@ var package_default2 = {
|
|
|
15906
15906
|
node: ">=18"
|
|
15907
15907
|
},
|
|
15908
15908
|
scripts: {
|
|
15909
|
-
build: `bun build ./bin/postgres-ai.ts --outdir ./dist/bin --target node && node -e "const fs=require('fs');const f='./dist/bin/postgres-ai.js';fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace('#!/usr/bin/env bun','#!/usr/bin/env node'))"
|
|
15909
|
+
build: `bun build ./bin/postgres-ai.ts --outdir ./dist/bin --target node && node -e "const fs=require('fs');const f='./dist/bin/postgres-ai.js';fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace('#!/usr/bin/env bun','#!/usr/bin/env node'))"`,
|
|
15910
15910
|
prepublishOnly: "npm run build",
|
|
15911
15911
|
start: "bun ./bin/postgres-ai.ts --help",
|
|
15912
15912
|
"start:node": "node ./dist/bin/postgres-ai.js --help",
|
|
@@ -24212,2704 +24212,422 @@ import * as fs4 from "fs";
|
|
|
24212
24212
|
import * as path4 from "path";
|
|
24213
24213
|
|
|
24214
24214
|
// lib/metrics-loader.ts
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
|
-
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
|
|
24221
|
-
|
|
24222
|
-
|
|
24223
|
-
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
|
|
24228
|
-
|
|
24229
|
-
|
|
24230
|
-
|
|
24231
|
-
|
|
24232
|
-
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
|
|
24236
|
-
|
|
24237
|
-
|
|
24238
|
-
|
|
24239
|
-
|
|
24240
|
-
|
|
24241
|
-
|
|
24242
|
-
|
|
24243
|
-
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
|
|
24250
|
-
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
|
|
24254
|
-
|
|
24255
|
-
|
|
24256
|
-
|
|
24257
|
-
|
|
24258
|
-
|
|
24259
|
-
|
|
24260
|
-
|
|
24261
|
-
|
|
24262
|
-
|
|
24263
|
-
|
|
24264
|
-
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24285
|
-
|
|
24286
|
-
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
|
|
24291
|
-
|
|
24292
|
-
|
|
24293
|
-
|
|
24294
|
-
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
|
|
24307
|
-
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
24311
|
-
|
|
24312
|
-
|
|
24313
|
-
|
|
24314
|
-
|
|
24315
|
-
|
|
24316
|
-
|
|
24317
|
-
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24336
|
-
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24350
|
-
|
|
24351
|
-
|
|
24352
|
-
|
|
24353
|
-
|
|
24354
|
-
|
|
24355
|
-
|
|
24356
|
-
|
|
24357
|
-
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
24372
|
-
|
|
24373
|
-
|
|
24374
|
-
|
|
24375
|
-
|
|
24376
|
-
|
|
24377
|
-
|
|
24378
|
-
|
|
24379
|
-
|
|
24380
|
-
|
|
24381
|
-
|
|
24382
|
-
|
|
24383
|
-
|
|
24384
|
-
|
|
24385
|
-
|
|
24386
|
-
|
|
24387
|
-
|
|
24388
|
-
|
|
24389
|
-
|
|
24390
|
-
|
|
24391
|
-
|
|
24392
|
-
|
|
24393
|
-
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24420
|
-
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
|
|
24456
|
-
|
|
24457
|
-
|
|
24458
|
-
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24468
|
-
|
|
24469
|
-
|
|
24470
|
-
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24504
|
-
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24516
|
-
|
|
24517
|
-
|
|
24518
|
-
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
|
|
24527
|
-
|
|
24528
|
-
|
|
24529
|
-
|
|
24530
|
-
|
|
24531
|
-
|
|
24532
|
-
|
|
24533
|
-
|
|
24534
|
-
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
|
|
24545
|
-
|
|
24546
|
-
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
|
|
24556
|
-
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24566
|
-
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24577
|
-
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
ch = data[++index];
|
|
24625
|
-
if (ch === "b") {
|
|
24626
|
-
index++;
|
|
24627
|
-
for (;index < max; index++) {
|
|
24628
|
-
ch = data[index];
|
|
24629
|
-
if (ch === "_")
|
|
24630
|
-
continue;
|
|
24631
|
-
if (ch !== "0" && ch !== "1")
|
|
24632
|
-
return false;
|
|
24633
|
-
hasDigits = true;
|
|
24634
|
-
}
|
|
24635
|
-
return hasDigits && ch !== "_";
|
|
24636
|
-
}
|
|
24637
|
-
if (ch === "x") {
|
|
24638
|
-
index++;
|
|
24639
|
-
for (;index < max; index++) {
|
|
24640
|
-
ch = data[index];
|
|
24641
|
-
if (ch === "_")
|
|
24642
|
-
continue;
|
|
24643
|
-
if (!isHexCode2(data.charCodeAt(index)))
|
|
24644
|
-
return false;
|
|
24645
|
-
hasDigits = true;
|
|
24646
|
-
}
|
|
24647
|
-
return hasDigits && ch !== "_";
|
|
24648
|
-
}
|
|
24649
|
-
if (ch === "o") {
|
|
24650
|
-
index++;
|
|
24651
|
-
for (;index < max; index++) {
|
|
24652
|
-
ch = data[index];
|
|
24653
|
-
if (ch === "_")
|
|
24654
|
-
continue;
|
|
24655
|
-
if (!isOctCode2(data.charCodeAt(index)))
|
|
24656
|
-
return false;
|
|
24657
|
-
hasDigits = true;
|
|
24658
|
-
}
|
|
24659
|
-
return hasDigits && ch !== "_";
|
|
24660
|
-
}
|
|
24661
|
-
}
|
|
24662
|
-
if (ch === "_")
|
|
24663
|
-
return false;
|
|
24664
|
-
for (;index < max; index++) {
|
|
24665
|
-
ch = data[index];
|
|
24666
|
-
if (ch === "_")
|
|
24667
|
-
continue;
|
|
24668
|
-
if (!isDecCode2(data.charCodeAt(index))) {
|
|
24669
|
-
return false;
|
|
24670
|
-
}
|
|
24671
|
-
hasDigits = true;
|
|
24672
|
-
}
|
|
24673
|
-
if (!hasDigits || ch === "_")
|
|
24674
|
-
return false;
|
|
24675
|
-
return true;
|
|
24676
|
-
}
|
|
24677
|
-
function constructYamlInteger2(data) {
|
|
24678
|
-
var value = data, sign = 1, ch;
|
|
24679
|
-
if (value.indexOf("_") !== -1) {
|
|
24680
|
-
value = value.replace(/_/g, "");
|
|
24681
|
-
}
|
|
24682
|
-
ch = value[0];
|
|
24683
|
-
if (ch === "-" || ch === "+") {
|
|
24684
|
-
if (ch === "-")
|
|
24685
|
-
sign = -1;
|
|
24686
|
-
value = value.slice(1);
|
|
24687
|
-
ch = value[0];
|
|
24688
|
-
}
|
|
24689
|
-
if (value === "0")
|
|
24690
|
-
return 0;
|
|
24691
|
-
if (ch === "0") {
|
|
24692
|
-
if (value[1] === "b")
|
|
24693
|
-
return sign * parseInt(value.slice(2), 2);
|
|
24694
|
-
if (value[1] === "x")
|
|
24695
|
-
return sign * parseInt(value.slice(2), 16);
|
|
24696
|
-
if (value[1] === "o")
|
|
24697
|
-
return sign * parseInt(value.slice(2), 8);
|
|
24698
|
-
}
|
|
24699
|
-
return sign * parseInt(value, 10);
|
|
24700
|
-
}
|
|
24701
|
-
function isInteger2(object4) {
|
|
24702
|
-
return Object.prototype.toString.call(object4) === "[object Number]" && (object4 % 1 === 0 && !common2.isNegativeZero(object4));
|
|
24703
|
-
}
|
|
24704
|
-
var int3 = new type2("tag:yaml.org,2002:int", {
|
|
24705
|
-
kind: "scalar",
|
|
24706
|
-
resolve: resolveYamlInteger2,
|
|
24707
|
-
construct: constructYamlInteger2,
|
|
24708
|
-
predicate: isInteger2,
|
|
24709
|
-
represent: {
|
|
24710
|
-
binary: function(obj) {
|
|
24711
|
-
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
24712
|
-
},
|
|
24713
|
-
octal: function(obj) {
|
|
24714
|
-
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
24715
|
-
},
|
|
24716
|
-
decimal: function(obj) {
|
|
24717
|
-
return obj.toString(10);
|
|
24718
|
-
},
|
|
24719
|
-
hexadecimal: function(obj) {
|
|
24720
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
24721
|
-
}
|
|
24722
|
-
},
|
|
24723
|
-
defaultStyle: "decimal",
|
|
24724
|
-
styleAliases: {
|
|
24725
|
-
binary: [2, "bin"],
|
|
24726
|
-
octal: [8, "oct"],
|
|
24727
|
-
decimal: [10, "dec"],
|
|
24728
|
-
hexadecimal: [16, "hex"]
|
|
24729
|
-
}
|
|
24730
|
-
});
|
|
24731
|
-
var YAML_FLOAT_PATTERN2 = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
|
|
24732
|
-
function resolveYamlFloat2(data) {
|
|
24733
|
-
if (data === null)
|
|
24734
|
-
return false;
|
|
24735
|
-
if (!YAML_FLOAT_PATTERN2.test(data) || data[data.length - 1] === "_") {
|
|
24736
|
-
return false;
|
|
24737
|
-
}
|
|
24738
|
-
return true;
|
|
24739
|
-
}
|
|
24740
|
-
function constructYamlFloat2(data) {
|
|
24741
|
-
var value, sign;
|
|
24742
|
-
value = data.replace(/_/g, "").toLowerCase();
|
|
24743
|
-
sign = value[0] === "-" ? -1 : 1;
|
|
24744
|
-
if ("+-".indexOf(value[0]) >= 0) {
|
|
24745
|
-
value = value.slice(1);
|
|
24746
|
-
}
|
|
24747
|
-
if (value === ".inf") {
|
|
24748
|
-
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
24749
|
-
} else if (value === ".nan") {
|
|
24750
|
-
return NaN;
|
|
24751
|
-
}
|
|
24752
|
-
return sign * parseFloat(value, 10);
|
|
24753
|
-
}
|
|
24754
|
-
var SCIENTIFIC_WITHOUT_DOT2 = /^[-+]?[0-9]+e/;
|
|
24755
|
-
function representYamlFloat2(object4, style) {
|
|
24756
|
-
var res;
|
|
24757
|
-
if (isNaN(object4)) {
|
|
24758
|
-
switch (style) {
|
|
24759
|
-
case "lowercase":
|
|
24760
|
-
return ".nan";
|
|
24761
|
-
case "uppercase":
|
|
24762
|
-
return ".NAN";
|
|
24763
|
-
case "camelcase":
|
|
24764
|
-
return ".NaN";
|
|
24765
|
-
}
|
|
24766
|
-
} else if (Number.POSITIVE_INFINITY === object4) {
|
|
24767
|
-
switch (style) {
|
|
24768
|
-
case "lowercase":
|
|
24769
|
-
return ".inf";
|
|
24770
|
-
case "uppercase":
|
|
24771
|
-
return ".INF";
|
|
24772
|
-
case "camelcase":
|
|
24773
|
-
return ".Inf";
|
|
24774
|
-
}
|
|
24775
|
-
} else if (Number.NEGATIVE_INFINITY === object4) {
|
|
24776
|
-
switch (style) {
|
|
24777
|
-
case "lowercase":
|
|
24778
|
-
return "-.inf";
|
|
24779
|
-
case "uppercase":
|
|
24780
|
-
return "-.INF";
|
|
24781
|
-
case "camelcase":
|
|
24782
|
-
return "-.Inf";
|
|
24783
|
-
}
|
|
24784
|
-
} else if (common2.isNegativeZero(object4)) {
|
|
24785
|
-
return "-0.0";
|
|
24786
|
-
}
|
|
24787
|
-
res = object4.toString(10);
|
|
24788
|
-
return SCIENTIFIC_WITHOUT_DOT2.test(res) ? res.replace("e", ".e") : res;
|
|
24789
|
-
}
|
|
24790
|
-
function isFloat2(object4) {
|
|
24791
|
-
return Object.prototype.toString.call(object4) === "[object Number]" && (object4 % 1 !== 0 || common2.isNegativeZero(object4));
|
|
24792
|
-
}
|
|
24793
|
-
var float2 = new type2("tag:yaml.org,2002:float", {
|
|
24794
|
-
kind: "scalar",
|
|
24795
|
-
resolve: resolveYamlFloat2,
|
|
24796
|
-
construct: constructYamlFloat2,
|
|
24797
|
-
predicate: isFloat2,
|
|
24798
|
-
represent: representYamlFloat2,
|
|
24799
|
-
defaultStyle: "lowercase"
|
|
24800
|
-
});
|
|
24801
|
-
var json2 = failsafe2.extend({
|
|
24802
|
-
implicit: [
|
|
24803
|
-
_null5,
|
|
24804
|
-
bool2,
|
|
24805
|
-
int3,
|
|
24806
|
-
float2
|
|
24807
|
-
]
|
|
24808
|
-
});
|
|
24809
|
-
var core3 = json2;
|
|
24810
|
-
var YAML_DATE_REGEXP2 = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
|
|
24811
|
-
var YAML_TIMESTAMP_REGEXP2 = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9]?)" + "-([0-9][0-9]?)" + "(?:[Tt]|[ \\t]+)" + "([0-9][0-9]?)" + ":([0-9][0-9])" + ":([0-9][0-9])" + "(?:\\.([0-9]*))?" + "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + "(?::([0-9][0-9]))?))?$");
|
|
24812
|
-
function resolveYamlTimestamp2(data) {
|
|
24813
|
-
if (data === null)
|
|
24814
|
-
return false;
|
|
24815
|
-
if (YAML_DATE_REGEXP2.exec(data) !== null)
|
|
24816
|
-
return true;
|
|
24817
|
-
if (YAML_TIMESTAMP_REGEXP2.exec(data) !== null)
|
|
24818
|
-
return true;
|
|
24819
|
-
return false;
|
|
24820
|
-
}
|
|
24821
|
-
function constructYamlTimestamp2(data) {
|
|
24822
|
-
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date4;
|
|
24823
|
-
match = YAML_DATE_REGEXP2.exec(data);
|
|
24824
|
-
if (match === null)
|
|
24825
|
-
match = YAML_TIMESTAMP_REGEXP2.exec(data);
|
|
24826
|
-
if (match === null)
|
|
24827
|
-
throw new Error("Date resolve error");
|
|
24828
|
-
year = +match[1];
|
|
24829
|
-
month = +match[2] - 1;
|
|
24830
|
-
day = +match[3];
|
|
24831
|
-
if (!match[4]) {
|
|
24832
|
-
return new Date(Date.UTC(year, month, day));
|
|
24833
|
-
}
|
|
24834
|
-
hour = +match[4];
|
|
24835
|
-
minute = +match[5];
|
|
24836
|
-
second = +match[6];
|
|
24837
|
-
if (match[7]) {
|
|
24838
|
-
fraction = match[7].slice(0, 3);
|
|
24839
|
-
while (fraction.length < 3) {
|
|
24840
|
-
fraction += "0";
|
|
24841
|
-
}
|
|
24842
|
-
fraction = +fraction;
|
|
24843
|
-
}
|
|
24844
|
-
if (match[9]) {
|
|
24845
|
-
tz_hour = +match[10];
|
|
24846
|
-
tz_minute = +(match[11] || 0);
|
|
24847
|
-
delta = (tz_hour * 60 + tz_minute) * 60000;
|
|
24848
|
-
if (match[9] === "-")
|
|
24849
|
-
delta = -delta;
|
|
24850
|
-
}
|
|
24851
|
-
date4 = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
24852
|
-
if (delta)
|
|
24853
|
-
date4.setTime(date4.getTime() - delta);
|
|
24854
|
-
return date4;
|
|
24855
|
-
}
|
|
24856
|
-
function representYamlTimestamp2(object4) {
|
|
24857
|
-
return object4.toISOString();
|
|
24858
|
-
}
|
|
24859
|
-
var timestamp2 = new type2("tag:yaml.org,2002:timestamp", {
|
|
24860
|
-
kind: "scalar",
|
|
24861
|
-
resolve: resolveYamlTimestamp2,
|
|
24862
|
-
construct: constructYamlTimestamp2,
|
|
24863
|
-
instanceOf: Date,
|
|
24864
|
-
represent: representYamlTimestamp2
|
|
24865
|
-
});
|
|
24866
|
-
function resolveYamlMerge2(data) {
|
|
24867
|
-
return data === "<<" || data === null;
|
|
24868
|
-
}
|
|
24869
|
-
var merge3 = new type2("tag:yaml.org,2002:merge", {
|
|
24870
|
-
kind: "scalar",
|
|
24871
|
-
resolve: resolveYamlMerge2
|
|
24872
|
-
});
|
|
24873
|
-
var BASE64_MAP2 = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
24874
|
-
\r`;
|
|
24875
|
-
function resolveYamlBinary2(data) {
|
|
24876
|
-
if (data === null)
|
|
24877
|
-
return false;
|
|
24878
|
-
var code, idx, bitlen = 0, max = data.length, map4 = BASE64_MAP2;
|
|
24879
|
-
for (idx = 0;idx < max; idx++) {
|
|
24880
|
-
code = map4.indexOf(data.charAt(idx));
|
|
24881
|
-
if (code > 64)
|
|
24882
|
-
continue;
|
|
24883
|
-
if (code < 0)
|
|
24884
|
-
return false;
|
|
24885
|
-
bitlen += 6;
|
|
24886
|
-
}
|
|
24887
|
-
return bitlen % 8 === 0;
|
|
24888
|
-
}
|
|
24889
|
-
function constructYamlBinary2(data) {
|
|
24890
|
-
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map4 = BASE64_MAP2, bits = 0, result = [];
|
|
24891
|
-
for (idx = 0;idx < max; idx++) {
|
|
24892
|
-
if (idx % 4 === 0 && idx) {
|
|
24893
|
-
result.push(bits >> 16 & 255);
|
|
24894
|
-
result.push(bits >> 8 & 255);
|
|
24895
|
-
result.push(bits & 255);
|
|
24896
|
-
}
|
|
24897
|
-
bits = bits << 6 | map4.indexOf(input.charAt(idx));
|
|
24898
|
-
}
|
|
24899
|
-
tailbits = max % 4 * 6;
|
|
24900
|
-
if (tailbits === 0) {
|
|
24901
|
-
result.push(bits >> 16 & 255);
|
|
24902
|
-
result.push(bits >> 8 & 255);
|
|
24903
|
-
result.push(bits & 255);
|
|
24904
|
-
} else if (tailbits === 18) {
|
|
24905
|
-
result.push(bits >> 10 & 255);
|
|
24906
|
-
result.push(bits >> 2 & 255);
|
|
24907
|
-
} else if (tailbits === 12) {
|
|
24908
|
-
result.push(bits >> 4 & 255);
|
|
24909
|
-
}
|
|
24910
|
-
return new Uint8Array(result);
|
|
24911
|
-
}
|
|
24912
|
-
function representYamlBinary2(object4) {
|
|
24913
|
-
var result = "", bits = 0, idx, tail, max = object4.length, map4 = BASE64_MAP2;
|
|
24914
|
-
for (idx = 0;idx < max; idx++) {
|
|
24915
|
-
if (idx % 3 === 0 && idx) {
|
|
24916
|
-
result += map4[bits >> 18 & 63];
|
|
24917
|
-
result += map4[bits >> 12 & 63];
|
|
24918
|
-
result += map4[bits >> 6 & 63];
|
|
24919
|
-
result += map4[bits & 63];
|
|
24920
|
-
}
|
|
24921
|
-
bits = (bits << 8) + object4[idx];
|
|
24922
|
-
}
|
|
24923
|
-
tail = max % 3;
|
|
24924
|
-
if (tail === 0) {
|
|
24925
|
-
result += map4[bits >> 18 & 63];
|
|
24926
|
-
result += map4[bits >> 12 & 63];
|
|
24927
|
-
result += map4[bits >> 6 & 63];
|
|
24928
|
-
result += map4[bits & 63];
|
|
24929
|
-
} else if (tail === 2) {
|
|
24930
|
-
result += map4[bits >> 10 & 63];
|
|
24931
|
-
result += map4[bits >> 4 & 63];
|
|
24932
|
-
result += map4[bits << 2 & 63];
|
|
24933
|
-
result += map4[64];
|
|
24934
|
-
} else if (tail === 1) {
|
|
24935
|
-
result += map4[bits >> 2 & 63];
|
|
24936
|
-
result += map4[bits << 4 & 63];
|
|
24937
|
-
result += map4[64];
|
|
24938
|
-
result += map4[64];
|
|
24939
|
-
}
|
|
24940
|
-
return result;
|
|
24941
|
-
}
|
|
24942
|
-
function isBinary2(obj) {
|
|
24943
|
-
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
24944
|
-
}
|
|
24945
|
-
var binary2 = new type2("tag:yaml.org,2002:binary", {
|
|
24946
|
-
kind: "scalar",
|
|
24947
|
-
resolve: resolveYamlBinary2,
|
|
24948
|
-
construct: constructYamlBinary2,
|
|
24949
|
-
predicate: isBinary2,
|
|
24950
|
-
represent: representYamlBinary2
|
|
24951
|
-
});
|
|
24952
|
-
var _hasOwnProperty$32 = Object.prototype.hasOwnProperty;
|
|
24953
|
-
var _toString$22 = Object.prototype.toString;
|
|
24954
|
-
function resolveYamlOmap2(data) {
|
|
24955
|
-
if (data === null)
|
|
24956
|
-
return true;
|
|
24957
|
-
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object4 = data;
|
|
24958
|
-
for (index = 0, length = object4.length;index < length; index += 1) {
|
|
24959
|
-
pair = object4[index];
|
|
24960
|
-
pairHasKey = false;
|
|
24961
|
-
if (_toString$22.call(pair) !== "[object Object]")
|
|
24962
|
-
return false;
|
|
24963
|
-
for (pairKey in pair) {
|
|
24964
|
-
if (_hasOwnProperty$32.call(pair, pairKey)) {
|
|
24965
|
-
if (!pairHasKey)
|
|
24966
|
-
pairHasKey = true;
|
|
24967
|
-
else
|
|
24968
|
-
return false;
|
|
24969
|
-
}
|
|
24970
|
-
}
|
|
24971
|
-
if (!pairHasKey)
|
|
24972
|
-
return false;
|
|
24973
|
-
if (objectKeys.indexOf(pairKey) === -1)
|
|
24974
|
-
objectKeys.push(pairKey);
|
|
24975
|
-
else
|
|
24976
|
-
return false;
|
|
24977
|
-
}
|
|
24978
|
-
return true;
|
|
24979
|
-
}
|
|
24980
|
-
function constructYamlOmap2(data) {
|
|
24981
|
-
return data !== null ? data : [];
|
|
24982
|
-
}
|
|
24983
|
-
var omap2 = new type2("tag:yaml.org,2002:omap", {
|
|
24984
|
-
kind: "sequence",
|
|
24985
|
-
resolve: resolveYamlOmap2,
|
|
24986
|
-
construct: constructYamlOmap2
|
|
24987
|
-
});
|
|
24988
|
-
var _toString$12 = Object.prototype.toString;
|
|
24989
|
-
function resolveYamlPairs2(data) {
|
|
24990
|
-
if (data === null)
|
|
24991
|
-
return true;
|
|
24992
|
-
var index, length, pair, keys, result, object4 = data;
|
|
24993
|
-
result = new Array(object4.length);
|
|
24994
|
-
for (index = 0, length = object4.length;index < length; index += 1) {
|
|
24995
|
-
pair = object4[index];
|
|
24996
|
-
if (_toString$12.call(pair) !== "[object Object]")
|
|
24997
|
-
return false;
|
|
24998
|
-
keys = Object.keys(pair);
|
|
24999
|
-
if (keys.length !== 1)
|
|
25000
|
-
return false;
|
|
25001
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
25002
|
-
}
|
|
25003
|
-
return true;
|
|
25004
|
-
}
|
|
25005
|
-
function constructYamlPairs2(data) {
|
|
25006
|
-
if (data === null)
|
|
25007
|
-
return [];
|
|
25008
|
-
var index, length, pair, keys, result, object4 = data;
|
|
25009
|
-
result = new Array(object4.length);
|
|
25010
|
-
for (index = 0, length = object4.length;index < length; index += 1) {
|
|
25011
|
-
pair = object4[index];
|
|
25012
|
-
keys = Object.keys(pair);
|
|
25013
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
25014
|
-
}
|
|
25015
|
-
return result;
|
|
25016
|
-
}
|
|
25017
|
-
var pairs2 = new type2("tag:yaml.org,2002:pairs", {
|
|
25018
|
-
kind: "sequence",
|
|
25019
|
-
resolve: resolveYamlPairs2,
|
|
25020
|
-
construct: constructYamlPairs2
|
|
25021
|
-
});
|
|
25022
|
-
var _hasOwnProperty$22 = Object.prototype.hasOwnProperty;
|
|
25023
|
-
function resolveYamlSet2(data) {
|
|
25024
|
-
if (data === null)
|
|
25025
|
-
return true;
|
|
25026
|
-
var key, object4 = data;
|
|
25027
|
-
for (key in object4) {
|
|
25028
|
-
if (_hasOwnProperty$22.call(object4, key)) {
|
|
25029
|
-
if (object4[key] !== null)
|
|
25030
|
-
return false;
|
|
25031
|
-
}
|
|
25032
|
-
}
|
|
25033
|
-
return true;
|
|
25034
|
-
}
|
|
25035
|
-
function constructYamlSet2(data) {
|
|
25036
|
-
return data !== null ? data : {};
|
|
25037
|
-
}
|
|
25038
|
-
var set3 = new type2("tag:yaml.org,2002:set", {
|
|
25039
|
-
kind: "mapping",
|
|
25040
|
-
resolve: resolveYamlSet2,
|
|
25041
|
-
construct: constructYamlSet2
|
|
25042
|
-
});
|
|
25043
|
-
var _default3 = core3.extend({
|
|
25044
|
-
implicit: [
|
|
25045
|
-
timestamp2,
|
|
25046
|
-
merge3
|
|
25047
|
-
],
|
|
25048
|
-
explicit: [
|
|
25049
|
-
binary2,
|
|
25050
|
-
omap2,
|
|
25051
|
-
pairs2,
|
|
25052
|
-
set3
|
|
25053
|
-
]
|
|
25054
|
-
});
|
|
25055
|
-
var _hasOwnProperty$12 = Object.prototype.hasOwnProperty;
|
|
25056
|
-
var CONTEXT_FLOW_IN2 = 1;
|
|
25057
|
-
var CONTEXT_FLOW_OUT2 = 2;
|
|
25058
|
-
var CONTEXT_BLOCK_IN2 = 3;
|
|
25059
|
-
var CONTEXT_BLOCK_OUT2 = 4;
|
|
25060
|
-
var CHOMPING_CLIP2 = 1;
|
|
25061
|
-
var CHOMPING_STRIP2 = 2;
|
|
25062
|
-
var CHOMPING_KEEP2 = 3;
|
|
25063
|
-
var PATTERN_NON_PRINTABLE2 = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
25064
|
-
var PATTERN_NON_ASCII_LINE_BREAKS2 = /[\x85\u2028\u2029]/;
|
|
25065
|
-
var PATTERN_FLOW_INDICATORS2 = /[,\[\]\{\}]/;
|
|
25066
|
-
var PATTERN_TAG_HANDLE2 = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
25067
|
-
var PATTERN_TAG_URI2 = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
25068
|
-
function _class2(obj) {
|
|
25069
|
-
return Object.prototype.toString.call(obj);
|
|
25070
|
-
}
|
|
25071
|
-
function is_EOL2(c) {
|
|
25072
|
-
return c === 10 || c === 13;
|
|
25073
|
-
}
|
|
25074
|
-
function is_WHITE_SPACE2(c) {
|
|
25075
|
-
return c === 9 || c === 32;
|
|
25076
|
-
}
|
|
25077
|
-
function is_WS_OR_EOL2(c) {
|
|
25078
|
-
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
25079
|
-
}
|
|
25080
|
-
function is_FLOW_INDICATOR2(c) {
|
|
25081
|
-
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
25082
|
-
}
|
|
25083
|
-
function fromHexCode2(c) {
|
|
25084
|
-
var lc;
|
|
25085
|
-
if (48 <= c && c <= 57) {
|
|
25086
|
-
return c - 48;
|
|
25087
|
-
}
|
|
25088
|
-
lc = c | 32;
|
|
25089
|
-
if (97 <= lc && lc <= 102) {
|
|
25090
|
-
return lc - 97 + 10;
|
|
25091
|
-
}
|
|
25092
|
-
return -1;
|
|
25093
|
-
}
|
|
25094
|
-
function escapedHexLen2(c) {
|
|
25095
|
-
if (c === 120) {
|
|
25096
|
-
return 2;
|
|
25097
|
-
}
|
|
25098
|
-
if (c === 117) {
|
|
25099
|
-
return 4;
|
|
25100
|
-
}
|
|
25101
|
-
if (c === 85) {
|
|
25102
|
-
return 8;
|
|
25103
|
-
}
|
|
25104
|
-
return 0;
|
|
25105
|
-
}
|
|
25106
|
-
function fromDecimalCode2(c) {
|
|
25107
|
-
if (48 <= c && c <= 57) {
|
|
25108
|
-
return c - 48;
|
|
25109
|
-
}
|
|
25110
|
-
return -1;
|
|
25111
|
-
}
|
|
25112
|
-
function simpleEscapeSequence2(c) {
|
|
25113
|
-
return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
|
|
25114
|
-
` : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "
" : c === 95 ? " " : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
25115
|
-
}
|
|
25116
|
-
function charFromCodepoint2(c) {
|
|
25117
|
-
if (c <= 65535) {
|
|
25118
|
-
return String.fromCharCode(c);
|
|
25119
|
-
}
|
|
25120
|
-
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
25121
|
-
}
|
|
25122
|
-
function setProperty2(object4, key, value) {
|
|
25123
|
-
if (key === "__proto__") {
|
|
25124
|
-
Object.defineProperty(object4, key, {
|
|
25125
|
-
configurable: true,
|
|
25126
|
-
enumerable: true,
|
|
25127
|
-
writable: true,
|
|
25128
|
-
value
|
|
25129
|
-
});
|
|
25130
|
-
} else {
|
|
25131
|
-
object4[key] = value;
|
|
25132
|
-
}
|
|
25133
|
-
}
|
|
25134
|
-
var simpleEscapeCheck2 = new Array(256);
|
|
25135
|
-
var simpleEscapeMap2 = new Array(256);
|
|
25136
|
-
for (i2 = 0;i2 < 256; i2++) {
|
|
25137
|
-
simpleEscapeCheck2[i2] = simpleEscapeSequence2(i2) ? 1 : 0;
|
|
25138
|
-
simpleEscapeMap2[i2] = simpleEscapeSequence2(i2);
|
|
25139
|
-
}
|
|
25140
|
-
var i2;
|
|
25141
|
-
function State$12(input, options) {
|
|
25142
|
-
this.input = input;
|
|
25143
|
-
this.filename = options["filename"] || null;
|
|
25144
|
-
this.schema = options["schema"] || _default3;
|
|
25145
|
-
this.onWarning = options["onWarning"] || null;
|
|
25146
|
-
this.legacy = options["legacy"] || false;
|
|
25147
|
-
this.json = options["json"] || false;
|
|
25148
|
-
this.listener = options["listener"] || null;
|
|
25149
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
25150
|
-
this.typeMap = this.schema.compiledTypeMap;
|
|
25151
|
-
this.length = input.length;
|
|
25152
|
-
this.position = 0;
|
|
25153
|
-
this.line = 0;
|
|
25154
|
-
this.lineStart = 0;
|
|
25155
|
-
this.lineIndent = 0;
|
|
25156
|
-
this.firstTabInLine = -1;
|
|
25157
|
-
this.documents = [];
|
|
25158
|
-
}
|
|
25159
|
-
function generateError2(state, message) {
|
|
25160
|
-
var mark = {
|
|
25161
|
-
name: state.filename,
|
|
25162
|
-
buffer: state.input.slice(0, -1),
|
|
25163
|
-
position: state.position,
|
|
25164
|
-
line: state.line,
|
|
25165
|
-
column: state.position - state.lineStart
|
|
25166
|
-
};
|
|
25167
|
-
mark.snippet = snippet2(mark);
|
|
25168
|
-
return new exception2(message, mark);
|
|
25169
|
-
}
|
|
25170
|
-
function throwError2(state, message) {
|
|
25171
|
-
throw generateError2(state, message);
|
|
25172
|
-
}
|
|
25173
|
-
function throwWarning2(state, message) {
|
|
25174
|
-
if (state.onWarning) {
|
|
25175
|
-
state.onWarning.call(null, generateError2(state, message));
|
|
25176
|
-
}
|
|
25177
|
-
}
|
|
25178
|
-
var directiveHandlers2 = {
|
|
25179
|
-
YAML: function handleYamlDirective2(state, name, args) {
|
|
25180
|
-
var match, major, minor;
|
|
25181
|
-
if (state.version !== null) {
|
|
25182
|
-
throwError2(state, "duplication of %YAML directive");
|
|
25183
|
-
}
|
|
25184
|
-
if (args.length !== 1) {
|
|
25185
|
-
throwError2(state, "YAML directive accepts exactly one argument");
|
|
25186
|
-
}
|
|
25187
|
-
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
25188
|
-
if (match === null) {
|
|
25189
|
-
throwError2(state, "ill-formed argument of the YAML directive");
|
|
25190
|
-
}
|
|
25191
|
-
major = parseInt(match[1], 10);
|
|
25192
|
-
minor = parseInt(match[2], 10);
|
|
25193
|
-
if (major !== 1) {
|
|
25194
|
-
throwError2(state, "unacceptable YAML version of the document");
|
|
25195
|
-
}
|
|
25196
|
-
state.version = args[0];
|
|
25197
|
-
state.checkLineBreaks = minor < 2;
|
|
25198
|
-
if (minor !== 1 && minor !== 2) {
|
|
25199
|
-
throwWarning2(state, "unsupported YAML version of the document");
|
|
25200
|
-
}
|
|
25201
|
-
},
|
|
25202
|
-
TAG: function handleTagDirective2(state, name, args) {
|
|
25203
|
-
var handle, prefix;
|
|
25204
|
-
if (args.length !== 2) {
|
|
25205
|
-
throwError2(state, "TAG directive accepts exactly two arguments");
|
|
25206
|
-
}
|
|
25207
|
-
handle = args[0];
|
|
25208
|
-
prefix = args[1];
|
|
25209
|
-
if (!PATTERN_TAG_HANDLE2.test(handle)) {
|
|
25210
|
-
throwError2(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
25211
|
-
}
|
|
25212
|
-
if (_hasOwnProperty$12.call(state.tagMap, handle)) {
|
|
25213
|
-
throwError2(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
25214
|
-
}
|
|
25215
|
-
if (!PATTERN_TAG_URI2.test(prefix)) {
|
|
25216
|
-
throwError2(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
25217
|
-
}
|
|
25218
|
-
try {
|
|
25219
|
-
prefix = decodeURIComponent(prefix);
|
|
25220
|
-
} catch (err) {
|
|
25221
|
-
throwError2(state, "tag prefix is malformed: " + prefix);
|
|
25222
|
-
}
|
|
25223
|
-
state.tagMap[handle] = prefix;
|
|
25224
|
-
}
|
|
25225
|
-
};
|
|
25226
|
-
function captureSegment2(state, start, end, checkJson) {
|
|
25227
|
-
var _position, _length2, _character, _result;
|
|
25228
|
-
if (start < end) {
|
|
25229
|
-
_result = state.input.slice(start, end);
|
|
25230
|
-
if (checkJson) {
|
|
25231
|
-
for (_position = 0, _length2 = _result.length;_position < _length2; _position += 1) {
|
|
25232
|
-
_character = _result.charCodeAt(_position);
|
|
25233
|
-
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
25234
|
-
throwError2(state, "expected valid JSON character");
|
|
25235
|
-
}
|
|
25236
|
-
}
|
|
25237
|
-
} else if (PATTERN_NON_PRINTABLE2.test(_result)) {
|
|
25238
|
-
throwError2(state, "the stream contains non-printable characters");
|
|
25239
|
-
}
|
|
25240
|
-
state.result += _result;
|
|
25241
|
-
}
|
|
25242
|
-
}
|
|
25243
|
-
function mergeMappings2(state, destination, source, overridableKeys) {
|
|
25244
|
-
var sourceKeys, key, index, quantity;
|
|
25245
|
-
if (!common2.isObject(source)) {
|
|
25246
|
-
throwError2(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
25247
|
-
}
|
|
25248
|
-
sourceKeys = Object.keys(source);
|
|
25249
|
-
for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
|
|
25250
|
-
key = sourceKeys[index];
|
|
25251
|
-
if (!_hasOwnProperty$12.call(destination, key)) {
|
|
25252
|
-
setProperty2(destination, key, source[key]);
|
|
25253
|
-
overridableKeys[key] = true;
|
|
25254
|
-
}
|
|
25255
|
-
}
|
|
25256
|
-
}
|
|
25257
|
-
function storeMappingPair2(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
25258
|
-
var index, quantity;
|
|
25259
|
-
if (Array.isArray(keyNode)) {
|
|
25260
|
-
keyNode = Array.prototype.slice.call(keyNode);
|
|
25261
|
-
for (index = 0, quantity = keyNode.length;index < quantity; index += 1) {
|
|
25262
|
-
if (Array.isArray(keyNode[index])) {
|
|
25263
|
-
throwError2(state, "nested arrays are not supported inside keys");
|
|
25264
|
-
}
|
|
25265
|
-
if (typeof keyNode === "object" && _class2(keyNode[index]) === "[object Object]") {
|
|
25266
|
-
keyNode[index] = "[object Object]";
|
|
25267
|
-
}
|
|
25268
|
-
}
|
|
25269
|
-
}
|
|
25270
|
-
if (typeof keyNode === "object" && _class2(keyNode) === "[object Object]") {
|
|
25271
|
-
keyNode = "[object Object]";
|
|
25272
|
-
}
|
|
25273
|
-
keyNode = String(keyNode);
|
|
25274
|
-
if (_result === null) {
|
|
25275
|
-
_result = {};
|
|
25276
|
-
}
|
|
25277
|
-
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
25278
|
-
if (Array.isArray(valueNode)) {
|
|
25279
|
-
for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
|
|
25280
|
-
mergeMappings2(state, _result, valueNode[index], overridableKeys);
|
|
25281
|
-
}
|
|
25282
|
-
} else {
|
|
25283
|
-
mergeMappings2(state, _result, valueNode, overridableKeys);
|
|
25284
|
-
}
|
|
25285
|
-
} else {
|
|
25286
|
-
if (!state.json && !_hasOwnProperty$12.call(overridableKeys, keyNode) && _hasOwnProperty$12.call(_result, keyNode)) {
|
|
25287
|
-
state.line = startLine || state.line;
|
|
25288
|
-
state.lineStart = startLineStart || state.lineStart;
|
|
25289
|
-
state.position = startPos || state.position;
|
|
25290
|
-
throwError2(state, "duplicated mapping key");
|
|
25291
|
-
}
|
|
25292
|
-
setProperty2(_result, keyNode, valueNode);
|
|
25293
|
-
delete overridableKeys[keyNode];
|
|
25294
|
-
}
|
|
25295
|
-
return _result;
|
|
25296
|
-
}
|
|
25297
|
-
function readLineBreak2(state) {
|
|
25298
|
-
var ch;
|
|
25299
|
-
ch = state.input.charCodeAt(state.position);
|
|
25300
|
-
if (ch === 10) {
|
|
25301
|
-
state.position++;
|
|
25302
|
-
} else if (ch === 13) {
|
|
25303
|
-
state.position++;
|
|
25304
|
-
if (state.input.charCodeAt(state.position) === 10) {
|
|
25305
|
-
state.position++;
|
|
25306
|
-
}
|
|
25307
|
-
} else {
|
|
25308
|
-
throwError2(state, "a line break is expected");
|
|
25309
|
-
}
|
|
25310
|
-
state.line += 1;
|
|
25311
|
-
state.lineStart = state.position;
|
|
25312
|
-
state.firstTabInLine = -1;
|
|
25313
|
-
}
|
|
25314
|
-
function skipSeparationSpace2(state, allowComments, checkIndent) {
|
|
25315
|
-
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
25316
|
-
while (ch !== 0) {
|
|
25317
|
-
while (is_WHITE_SPACE2(ch)) {
|
|
25318
|
-
if (ch === 9 && state.firstTabInLine === -1) {
|
|
25319
|
-
state.firstTabInLine = state.position;
|
|
25320
|
-
}
|
|
25321
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25322
|
-
}
|
|
25323
|
-
if (allowComments && ch === 35) {
|
|
25324
|
-
do {
|
|
25325
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25326
|
-
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
25327
|
-
}
|
|
25328
|
-
if (is_EOL2(ch)) {
|
|
25329
|
-
readLineBreak2(state);
|
|
25330
|
-
ch = state.input.charCodeAt(state.position);
|
|
25331
|
-
lineBreaks++;
|
|
25332
|
-
state.lineIndent = 0;
|
|
25333
|
-
while (ch === 32) {
|
|
25334
|
-
state.lineIndent++;
|
|
25335
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25336
|
-
}
|
|
25337
|
-
} else {
|
|
25338
|
-
break;
|
|
25339
|
-
}
|
|
25340
|
-
}
|
|
25341
|
-
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
25342
|
-
throwWarning2(state, "deficient indentation");
|
|
25343
|
-
}
|
|
25344
|
-
return lineBreaks;
|
|
25345
|
-
}
|
|
25346
|
-
function testDocumentSeparator2(state) {
|
|
25347
|
-
var _position = state.position, ch;
|
|
25348
|
-
ch = state.input.charCodeAt(_position);
|
|
25349
|
-
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
25350
|
-
_position += 3;
|
|
25351
|
-
ch = state.input.charCodeAt(_position);
|
|
25352
|
-
if (ch === 0 || is_WS_OR_EOL2(ch)) {
|
|
25353
|
-
return true;
|
|
25354
|
-
}
|
|
25355
|
-
}
|
|
25356
|
-
return false;
|
|
25357
|
-
}
|
|
25358
|
-
function writeFoldedLines2(state, count) {
|
|
25359
|
-
if (count === 1) {
|
|
25360
|
-
state.result += " ";
|
|
25361
|
-
} else if (count > 1) {
|
|
25362
|
-
state.result += common2.repeat(`
|
|
25363
|
-
`, count - 1);
|
|
25364
|
-
}
|
|
25365
|
-
}
|
|
25366
|
-
function readPlainScalar2(state, nodeIndent, withinFlowCollection) {
|
|
25367
|
-
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
25368
|
-
ch = state.input.charCodeAt(state.position);
|
|
25369
|
-
if (is_WS_OR_EOL2(ch) || is_FLOW_INDICATOR2(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
25370
|
-
return false;
|
|
25371
|
-
}
|
|
25372
|
-
if (ch === 63 || ch === 45) {
|
|
25373
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
25374
|
-
if (is_WS_OR_EOL2(following) || withinFlowCollection && is_FLOW_INDICATOR2(following)) {
|
|
25375
|
-
return false;
|
|
25376
|
-
}
|
|
25377
|
-
}
|
|
25378
|
-
state.kind = "scalar";
|
|
25379
|
-
state.result = "";
|
|
25380
|
-
captureStart = captureEnd = state.position;
|
|
25381
|
-
hasPendingContent = false;
|
|
25382
|
-
while (ch !== 0) {
|
|
25383
|
-
if (ch === 58) {
|
|
25384
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
25385
|
-
if (is_WS_OR_EOL2(following) || withinFlowCollection && is_FLOW_INDICATOR2(following)) {
|
|
25386
|
-
break;
|
|
25387
|
-
}
|
|
25388
|
-
} else if (ch === 35) {
|
|
25389
|
-
preceding = state.input.charCodeAt(state.position - 1);
|
|
25390
|
-
if (is_WS_OR_EOL2(preceding)) {
|
|
25391
|
-
break;
|
|
25392
|
-
}
|
|
25393
|
-
} else if (state.position === state.lineStart && testDocumentSeparator2(state) || withinFlowCollection && is_FLOW_INDICATOR2(ch)) {
|
|
25394
|
-
break;
|
|
25395
|
-
} else if (is_EOL2(ch)) {
|
|
25396
|
-
_line = state.line;
|
|
25397
|
-
_lineStart = state.lineStart;
|
|
25398
|
-
_lineIndent = state.lineIndent;
|
|
25399
|
-
skipSeparationSpace2(state, false, -1);
|
|
25400
|
-
if (state.lineIndent >= nodeIndent) {
|
|
25401
|
-
hasPendingContent = true;
|
|
25402
|
-
ch = state.input.charCodeAt(state.position);
|
|
25403
|
-
continue;
|
|
25404
|
-
} else {
|
|
25405
|
-
state.position = captureEnd;
|
|
25406
|
-
state.line = _line;
|
|
25407
|
-
state.lineStart = _lineStart;
|
|
25408
|
-
state.lineIndent = _lineIndent;
|
|
25409
|
-
break;
|
|
25410
|
-
}
|
|
25411
|
-
}
|
|
25412
|
-
if (hasPendingContent) {
|
|
25413
|
-
captureSegment2(state, captureStart, captureEnd, false);
|
|
25414
|
-
writeFoldedLines2(state, state.line - _line);
|
|
25415
|
-
captureStart = captureEnd = state.position;
|
|
25416
|
-
hasPendingContent = false;
|
|
25417
|
-
}
|
|
25418
|
-
if (!is_WHITE_SPACE2(ch)) {
|
|
25419
|
-
captureEnd = state.position + 1;
|
|
25420
|
-
}
|
|
25421
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25422
|
-
}
|
|
25423
|
-
captureSegment2(state, captureStart, captureEnd, false);
|
|
25424
|
-
if (state.result) {
|
|
25425
|
-
return true;
|
|
25426
|
-
}
|
|
25427
|
-
state.kind = _kind;
|
|
25428
|
-
state.result = _result;
|
|
25429
|
-
return false;
|
|
25430
|
-
}
|
|
25431
|
-
function readSingleQuotedScalar2(state, nodeIndent) {
|
|
25432
|
-
var ch, captureStart, captureEnd;
|
|
25433
|
-
ch = state.input.charCodeAt(state.position);
|
|
25434
|
-
if (ch !== 39) {
|
|
25435
|
-
return false;
|
|
25436
|
-
}
|
|
25437
|
-
state.kind = "scalar";
|
|
25438
|
-
state.result = "";
|
|
25439
|
-
state.position++;
|
|
25440
|
-
captureStart = captureEnd = state.position;
|
|
25441
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
25442
|
-
if (ch === 39) {
|
|
25443
|
-
captureSegment2(state, captureStart, state.position, true);
|
|
25444
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25445
|
-
if (ch === 39) {
|
|
25446
|
-
captureStart = state.position;
|
|
25447
|
-
state.position++;
|
|
25448
|
-
captureEnd = state.position;
|
|
25449
|
-
} else {
|
|
25450
|
-
return true;
|
|
25451
|
-
}
|
|
25452
|
-
} else if (is_EOL2(ch)) {
|
|
25453
|
-
captureSegment2(state, captureStart, captureEnd, true);
|
|
25454
|
-
writeFoldedLines2(state, skipSeparationSpace2(state, false, nodeIndent));
|
|
25455
|
-
captureStart = captureEnd = state.position;
|
|
25456
|
-
} else if (state.position === state.lineStart && testDocumentSeparator2(state)) {
|
|
25457
|
-
throwError2(state, "unexpected end of the document within a single quoted scalar");
|
|
25458
|
-
} else {
|
|
25459
|
-
state.position++;
|
|
25460
|
-
captureEnd = state.position;
|
|
25461
|
-
}
|
|
25462
|
-
}
|
|
25463
|
-
throwError2(state, "unexpected end of the stream within a single quoted scalar");
|
|
25464
|
-
}
|
|
25465
|
-
function readDoubleQuotedScalar2(state, nodeIndent) {
|
|
25466
|
-
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
25467
|
-
ch = state.input.charCodeAt(state.position);
|
|
25468
|
-
if (ch !== 34) {
|
|
25469
|
-
return false;
|
|
25470
|
-
}
|
|
25471
|
-
state.kind = "scalar";
|
|
25472
|
-
state.result = "";
|
|
25473
|
-
state.position++;
|
|
25474
|
-
captureStart = captureEnd = state.position;
|
|
25475
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
25476
|
-
if (ch === 34) {
|
|
25477
|
-
captureSegment2(state, captureStart, state.position, true);
|
|
25478
|
-
state.position++;
|
|
25479
|
-
return true;
|
|
25480
|
-
} else if (ch === 92) {
|
|
25481
|
-
captureSegment2(state, captureStart, state.position, true);
|
|
25482
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25483
|
-
if (is_EOL2(ch)) {
|
|
25484
|
-
skipSeparationSpace2(state, false, nodeIndent);
|
|
25485
|
-
} else if (ch < 256 && simpleEscapeCheck2[ch]) {
|
|
25486
|
-
state.result += simpleEscapeMap2[ch];
|
|
25487
|
-
state.position++;
|
|
25488
|
-
} else if ((tmp = escapedHexLen2(ch)) > 0) {
|
|
25489
|
-
hexLength = tmp;
|
|
25490
|
-
hexResult = 0;
|
|
25491
|
-
for (;hexLength > 0; hexLength--) {
|
|
25492
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25493
|
-
if ((tmp = fromHexCode2(ch)) >= 0) {
|
|
25494
|
-
hexResult = (hexResult << 4) + tmp;
|
|
25495
|
-
} else {
|
|
25496
|
-
throwError2(state, "expected hexadecimal character");
|
|
25497
|
-
}
|
|
25498
|
-
}
|
|
25499
|
-
state.result += charFromCodepoint2(hexResult);
|
|
25500
|
-
state.position++;
|
|
25501
|
-
} else {
|
|
25502
|
-
throwError2(state, "unknown escape sequence");
|
|
25503
|
-
}
|
|
25504
|
-
captureStart = captureEnd = state.position;
|
|
25505
|
-
} else if (is_EOL2(ch)) {
|
|
25506
|
-
captureSegment2(state, captureStart, captureEnd, true);
|
|
25507
|
-
writeFoldedLines2(state, skipSeparationSpace2(state, false, nodeIndent));
|
|
25508
|
-
captureStart = captureEnd = state.position;
|
|
25509
|
-
} else if (state.position === state.lineStart && testDocumentSeparator2(state)) {
|
|
25510
|
-
throwError2(state, "unexpected end of the document within a double quoted scalar");
|
|
25511
|
-
} else {
|
|
25512
|
-
state.position++;
|
|
25513
|
-
captureEnd = state.position;
|
|
25514
|
-
}
|
|
25515
|
-
}
|
|
25516
|
-
throwError2(state, "unexpected end of the stream within a double quoted scalar");
|
|
25517
|
-
}
|
|
25518
|
-
function readFlowCollection2(state, nodeIndent) {
|
|
25519
|
-
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
25520
|
-
ch = state.input.charCodeAt(state.position);
|
|
25521
|
-
if (ch === 91) {
|
|
25522
|
-
terminator = 93;
|
|
25523
|
-
isMapping = false;
|
|
25524
|
-
_result = [];
|
|
25525
|
-
} else if (ch === 123) {
|
|
25526
|
-
terminator = 125;
|
|
25527
|
-
isMapping = true;
|
|
25528
|
-
_result = {};
|
|
25529
|
-
} else {
|
|
25530
|
-
return false;
|
|
25531
|
-
}
|
|
25532
|
-
if (state.anchor !== null) {
|
|
25533
|
-
state.anchorMap[state.anchor] = _result;
|
|
25534
|
-
}
|
|
25535
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25536
|
-
while (ch !== 0) {
|
|
25537
|
-
skipSeparationSpace2(state, true, nodeIndent);
|
|
25538
|
-
ch = state.input.charCodeAt(state.position);
|
|
25539
|
-
if (ch === terminator) {
|
|
25540
|
-
state.position++;
|
|
25541
|
-
state.tag = _tag;
|
|
25542
|
-
state.anchor = _anchor;
|
|
25543
|
-
state.kind = isMapping ? "mapping" : "sequence";
|
|
25544
|
-
state.result = _result;
|
|
25545
|
-
return true;
|
|
25546
|
-
} else if (!readNext) {
|
|
25547
|
-
throwError2(state, "missed comma between flow collection entries");
|
|
25548
|
-
} else if (ch === 44) {
|
|
25549
|
-
throwError2(state, "expected the node content, but found ','");
|
|
25550
|
-
}
|
|
25551
|
-
keyTag = keyNode = valueNode = null;
|
|
25552
|
-
isPair = isExplicitPair = false;
|
|
25553
|
-
if (ch === 63) {
|
|
25554
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
25555
|
-
if (is_WS_OR_EOL2(following)) {
|
|
25556
|
-
isPair = isExplicitPair = true;
|
|
25557
|
-
state.position++;
|
|
25558
|
-
skipSeparationSpace2(state, true, nodeIndent);
|
|
25559
|
-
}
|
|
25560
|
-
}
|
|
25561
|
-
_line = state.line;
|
|
25562
|
-
_lineStart = state.lineStart;
|
|
25563
|
-
_pos = state.position;
|
|
25564
|
-
composeNode2(state, nodeIndent, CONTEXT_FLOW_IN2, false, true);
|
|
25565
|
-
keyTag = state.tag;
|
|
25566
|
-
keyNode = state.result;
|
|
25567
|
-
skipSeparationSpace2(state, true, nodeIndent);
|
|
25568
|
-
ch = state.input.charCodeAt(state.position);
|
|
25569
|
-
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
25570
|
-
isPair = true;
|
|
25571
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25572
|
-
skipSeparationSpace2(state, true, nodeIndent);
|
|
25573
|
-
composeNode2(state, nodeIndent, CONTEXT_FLOW_IN2, false, true);
|
|
25574
|
-
valueNode = state.result;
|
|
25575
|
-
}
|
|
25576
|
-
if (isMapping) {
|
|
25577
|
-
storeMappingPair2(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
25578
|
-
} else if (isPair) {
|
|
25579
|
-
_result.push(storeMappingPair2(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
25580
|
-
} else {
|
|
25581
|
-
_result.push(keyNode);
|
|
25582
|
-
}
|
|
25583
|
-
skipSeparationSpace2(state, true, nodeIndent);
|
|
25584
|
-
ch = state.input.charCodeAt(state.position);
|
|
25585
|
-
if (ch === 44) {
|
|
25586
|
-
readNext = true;
|
|
25587
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25588
|
-
} else {
|
|
25589
|
-
readNext = false;
|
|
25590
|
-
}
|
|
25591
|
-
}
|
|
25592
|
-
throwError2(state, "unexpected end of the stream within a flow collection");
|
|
25593
|
-
}
|
|
25594
|
-
function readBlockScalar2(state, nodeIndent) {
|
|
25595
|
-
var captureStart, folding, chomping = CHOMPING_CLIP2, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
25596
|
-
ch = state.input.charCodeAt(state.position);
|
|
25597
|
-
if (ch === 124) {
|
|
25598
|
-
folding = false;
|
|
25599
|
-
} else if (ch === 62) {
|
|
25600
|
-
folding = true;
|
|
25601
|
-
} else {
|
|
25602
|
-
return false;
|
|
25603
|
-
}
|
|
25604
|
-
state.kind = "scalar";
|
|
25605
|
-
state.result = "";
|
|
25606
|
-
while (ch !== 0) {
|
|
25607
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25608
|
-
if (ch === 43 || ch === 45) {
|
|
25609
|
-
if (CHOMPING_CLIP2 === chomping) {
|
|
25610
|
-
chomping = ch === 43 ? CHOMPING_KEEP2 : CHOMPING_STRIP2;
|
|
25611
|
-
} else {
|
|
25612
|
-
throwError2(state, "repeat of a chomping mode identifier");
|
|
25613
|
-
}
|
|
25614
|
-
} else if ((tmp = fromDecimalCode2(ch)) >= 0) {
|
|
25615
|
-
if (tmp === 0) {
|
|
25616
|
-
throwError2(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
25617
|
-
} else if (!detectedIndent) {
|
|
25618
|
-
textIndent = nodeIndent + tmp - 1;
|
|
25619
|
-
detectedIndent = true;
|
|
25620
|
-
} else {
|
|
25621
|
-
throwError2(state, "repeat of an indentation width identifier");
|
|
25622
|
-
}
|
|
25623
|
-
} else {
|
|
25624
|
-
break;
|
|
25625
|
-
}
|
|
25626
|
-
}
|
|
25627
|
-
if (is_WHITE_SPACE2(ch)) {
|
|
25628
|
-
do {
|
|
25629
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25630
|
-
} while (is_WHITE_SPACE2(ch));
|
|
25631
|
-
if (ch === 35) {
|
|
25632
|
-
do {
|
|
25633
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25634
|
-
} while (!is_EOL2(ch) && ch !== 0);
|
|
25635
|
-
}
|
|
25636
|
-
}
|
|
25637
|
-
while (ch !== 0) {
|
|
25638
|
-
readLineBreak2(state);
|
|
25639
|
-
state.lineIndent = 0;
|
|
25640
|
-
ch = state.input.charCodeAt(state.position);
|
|
25641
|
-
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
25642
|
-
state.lineIndent++;
|
|
25643
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25644
|
-
}
|
|
25645
|
-
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
25646
|
-
textIndent = state.lineIndent;
|
|
25647
|
-
}
|
|
25648
|
-
if (is_EOL2(ch)) {
|
|
25649
|
-
emptyLines++;
|
|
25650
|
-
continue;
|
|
25651
|
-
}
|
|
25652
|
-
if (state.lineIndent < textIndent) {
|
|
25653
|
-
if (chomping === CHOMPING_KEEP2) {
|
|
25654
|
-
state.result += common2.repeat(`
|
|
25655
|
-
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
25656
|
-
} else if (chomping === CHOMPING_CLIP2) {
|
|
25657
|
-
if (didReadContent) {
|
|
25658
|
-
state.result += `
|
|
25659
|
-
`;
|
|
25660
|
-
}
|
|
25661
|
-
}
|
|
25662
|
-
break;
|
|
25663
|
-
}
|
|
25664
|
-
if (folding) {
|
|
25665
|
-
if (is_WHITE_SPACE2(ch)) {
|
|
25666
|
-
atMoreIndented = true;
|
|
25667
|
-
state.result += common2.repeat(`
|
|
25668
|
-
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
25669
|
-
} else if (atMoreIndented) {
|
|
25670
|
-
atMoreIndented = false;
|
|
25671
|
-
state.result += common2.repeat(`
|
|
25672
|
-
`, emptyLines + 1);
|
|
25673
|
-
} else if (emptyLines === 0) {
|
|
25674
|
-
if (didReadContent) {
|
|
25675
|
-
state.result += " ";
|
|
25676
|
-
}
|
|
25677
|
-
} else {
|
|
25678
|
-
state.result += common2.repeat(`
|
|
25679
|
-
`, emptyLines);
|
|
25680
|
-
}
|
|
25681
|
-
} else {
|
|
25682
|
-
state.result += common2.repeat(`
|
|
25683
|
-
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
25684
|
-
}
|
|
25685
|
-
didReadContent = true;
|
|
25686
|
-
detectedIndent = true;
|
|
25687
|
-
emptyLines = 0;
|
|
25688
|
-
captureStart = state.position;
|
|
25689
|
-
while (!is_EOL2(ch) && ch !== 0) {
|
|
25690
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25691
|
-
}
|
|
25692
|
-
captureSegment2(state, captureStart, state.position, false);
|
|
25693
|
-
}
|
|
25694
|
-
return true;
|
|
25695
|
-
}
|
|
25696
|
-
function readBlockSequence2(state, nodeIndent) {
|
|
25697
|
-
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
25698
|
-
if (state.firstTabInLine !== -1)
|
|
25699
|
-
return false;
|
|
25700
|
-
if (state.anchor !== null) {
|
|
25701
|
-
state.anchorMap[state.anchor] = _result;
|
|
25702
|
-
}
|
|
25703
|
-
ch = state.input.charCodeAt(state.position);
|
|
25704
|
-
while (ch !== 0) {
|
|
25705
|
-
if (state.firstTabInLine !== -1) {
|
|
25706
|
-
state.position = state.firstTabInLine;
|
|
25707
|
-
throwError2(state, "tab characters must not be used in indentation");
|
|
25708
|
-
}
|
|
25709
|
-
if (ch !== 45) {
|
|
25710
|
-
break;
|
|
25711
|
-
}
|
|
25712
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
25713
|
-
if (!is_WS_OR_EOL2(following)) {
|
|
25714
|
-
break;
|
|
25715
|
-
}
|
|
25716
|
-
detected = true;
|
|
25717
|
-
state.position++;
|
|
25718
|
-
if (skipSeparationSpace2(state, true, -1)) {
|
|
25719
|
-
if (state.lineIndent <= nodeIndent) {
|
|
25720
|
-
_result.push(null);
|
|
25721
|
-
ch = state.input.charCodeAt(state.position);
|
|
25722
|
-
continue;
|
|
25723
|
-
}
|
|
25724
|
-
}
|
|
25725
|
-
_line = state.line;
|
|
25726
|
-
composeNode2(state, nodeIndent, CONTEXT_BLOCK_IN2, false, true);
|
|
25727
|
-
_result.push(state.result);
|
|
25728
|
-
skipSeparationSpace2(state, true, -1);
|
|
25729
|
-
ch = state.input.charCodeAt(state.position);
|
|
25730
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
25731
|
-
throwError2(state, "bad indentation of a sequence entry");
|
|
25732
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
25733
|
-
break;
|
|
25734
|
-
}
|
|
25735
|
-
}
|
|
25736
|
-
if (detected) {
|
|
25737
|
-
state.tag = _tag;
|
|
25738
|
-
state.anchor = _anchor;
|
|
25739
|
-
state.kind = "sequence";
|
|
25740
|
-
state.result = _result;
|
|
25741
|
-
return true;
|
|
25742
|
-
}
|
|
25743
|
-
return false;
|
|
25744
|
-
}
|
|
25745
|
-
function readBlockMapping2(state, nodeIndent, flowIndent) {
|
|
25746
|
-
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
25747
|
-
if (state.firstTabInLine !== -1)
|
|
25748
|
-
return false;
|
|
25749
|
-
if (state.anchor !== null) {
|
|
25750
|
-
state.anchorMap[state.anchor] = _result;
|
|
25751
|
-
}
|
|
25752
|
-
ch = state.input.charCodeAt(state.position);
|
|
25753
|
-
while (ch !== 0) {
|
|
25754
|
-
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
25755
|
-
state.position = state.firstTabInLine;
|
|
25756
|
-
throwError2(state, "tab characters must not be used in indentation");
|
|
25757
|
-
}
|
|
25758
|
-
following = state.input.charCodeAt(state.position + 1);
|
|
25759
|
-
_line = state.line;
|
|
25760
|
-
if ((ch === 63 || ch === 58) && is_WS_OR_EOL2(following)) {
|
|
25761
|
-
if (ch === 63) {
|
|
25762
|
-
if (atExplicitKey) {
|
|
25763
|
-
storeMappingPair2(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
25764
|
-
keyTag = keyNode = valueNode = null;
|
|
25765
|
-
}
|
|
25766
|
-
detected = true;
|
|
25767
|
-
atExplicitKey = true;
|
|
25768
|
-
allowCompact = true;
|
|
25769
|
-
} else if (atExplicitKey) {
|
|
25770
|
-
atExplicitKey = false;
|
|
25771
|
-
allowCompact = true;
|
|
25772
|
-
} else {
|
|
25773
|
-
throwError2(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
25774
|
-
}
|
|
25775
|
-
state.position += 1;
|
|
25776
|
-
ch = following;
|
|
25777
|
-
} else {
|
|
25778
|
-
_keyLine = state.line;
|
|
25779
|
-
_keyLineStart = state.lineStart;
|
|
25780
|
-
_keyPos = state.position;
|
|
25781
|
-
if (!composeNode2(state, flowIndent, CONTEXT_FLOW_OUT2, false, true)) {
|
|
25782
|
-
break;
|
|
25783
|
-
}
|
|
25784
|
-
if (state.line === _line) {
|
|
25785
|
-
ch = state.input.charCodeAt(state.position);
|
|
25786
|
-
while (is_WHITE_SPACE2(ch)) {
|
|
25787
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25788
|
-
}
|
|
25789
|
-
if (ch === 58) {
|
|
25790
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25791
|
-
if (!is_WS_OR_EOL2(ch)) {
|
|
25792
|
-
throwError2(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
25793
|
-
}
|
|
25794
|
-
if (atExplicitKey) {
|
|
25795
|
-
storeMappingPair2(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
25796
|
-
keyTag = keyNode = valueNode = null;
|
|
25797
|
-
}
|
|
25798
|
-
detected = true;
|
|
25799
|
-
atExplicitKey = false;
|
|
25800
|
-
allowCompact = false;
|
|
25801
|
-
keyTag = state.tag;
|
|
25802
|
-
keyNode = state.result;
|
|
25803
|
-
} else if (detected) {
|
|
25804
|
-
throwError2(state, "can not read an implicit mapping pair; a colon is missed");
|
|
25805
|
-
} else {
|
|
25806
|
-
state.tag = _tag;
|
|
25807
|
-
state.anchor = _anchor;
|
|
25808
|
-
return true;
|
|
25809
|
-
}
|
|
25810
|
-
} else if (detected) {
|
|
25811
|
-
throwError2(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
25812
|
-
} else {
|
|
25813
|
-
state.tag = _tag;
|
|
25814
|
-
state.anchor = _anchor;
|
|
25815
|
-
return true;
|
|
25816
|
-
}
|
|
25817
|
-
}
|
|
25818
|
-
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
25819
|
-
if (atExplicitKey) {
|
|
25820
|
-
_keyLine = state.line;
|
|
25821
|
-
_keyLineStart = state.lineStart;
|
|
25822
|
-
_keyPos = state.position;
|
|
25823
|
-
}
|
|
25824
|
-
if (composeNode2(state, nodeIndent, CONTEXT_BLOCK_OUT2, true, allowCompact)) {
|
|
25825
|
-
if (atExplicitKey) {
|
|
25826
|
-
keyNode = state.result;
|
|
25827
|
-
} else {
|
|
25828
|
-
valueNode = state.result;
|
|
25829
|
-
}
|
|
25830
|
-
}
|
|
25831
|
-
if (!atExplicitKey) {
|
|
25832
|
-
storeMappingPair2(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
25833
|
-
keyTag = keyNode = valueNode = null;
|
|
25834
|
-
}
|
|
25835
|
-
skipSeparationSpace2(state, true, -1);
|
|
25836
|
-
ch = state.input.charCodeAt(state.position);
|
|
25837
|
-
}
|
|
25838
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
25839
|
-
throwError2(state, "bad indentation of a mapping entry");
|
|
25840
|
-
} else if (state.lineIndent < nodeIndent) {
|
|
25841
|
-
break;
|
|
25842
|
-
}
|
|
25843
|
-
}
|
|
25844
|
-
if (atExplicitKey) {
|
|
25845
|
-
storeMappingPair2(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
25846
|
-
}
|
|
25847
|
-
if (detected) {
|
|
25848
|
-
state.tag = _tag;
|
|
25849
|
-
state.anchor = _anchor;
|
|
25850
|
-
state.kind = "mapping";
|
|
25851
|
-
state.result = _result;
|
|
25852
|
-
}
|
|
25853
|
-
return detected;
|
|
25854
|
-
}
|
|
25855
|
-
function readTagProperty2(state) {
|
|
25856
|
-
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
25857
|
-
ch = state.input.charCodeAt(state.position);
|
|
25858
|
-
if (ch !== 33)
|
|
25859
|
-
return false;
|
|
25860
|
-
if (state.tag !== null) {
|
|
25861
|
-
throwError2(state, "duplication of a tag property");
|
|
25862
|
-
}
|
|
25863
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25864
|
-
if (ch === 60) {
|
|
25865
|
-
isVerbatim = true;
|
|
25866
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25867
|
-
} else if (ch === 33) {
|
|
25868
|
-
isNamed = true;
|
|
25869
|
-
tagHandle = "!!";
|
|
25870
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25871
|
-
} else {
|
|
25872
|
-
tagHandle = "!";
|
|
25873
|
-
}
|
|
25874
|
-
_position = state.position;
|
|
25875
|
-
if (isVerbatim) {
|
|
25876
|
-
do {
|
|
25877
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25878
|
-
} while (ch !== 0 && ch !== 62);
|
|
25879
|
-
if (state.position < state.length) {
|
|
25880
|
-
tagName = state.input.slice(_position, state.position);
|
|
25881
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25882
|
-
} else {
|
|
25883
|
-
throwError2(state, "unexpected end of the stream within a verbatim tag");
|
|
25884
|
-
}
|
|
25885
|
-
} else {
|
|
25886
|
-
while (ch !== 0 && !is_WS_OR_EOL2(ch)) {
|
|
25887
|
-
if (ch === 33) {
|
|
25888
|
-
if (!isNamed) {
|
|
25889
|
-
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
25890
|
-
if (!PATTERN_TAG_HANDLE2.test(tagHandle)) {
|
|
25891
|
-
throwError2(state, "named tag handle cannot contain such characters");
|
|
25892
|
-
}
|
|
25893
|
-
isNamed = true;
|
|
25894
|
-
_position = state.position + 1;
|
|
25895
|
-
} else {
|
|
25896
|
-
throwError2(state, "tag suffix cannot contain exclamation marks");
|
|
25897
|
-
}
|
|
25898
|
-
}
|
|
25899
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25900
|
-
}
|
|
25901
|
-
tagName = state.input.slice(_position, state.position);
|
|
25902
|
-
if (PATTERN_FLOW_INDICATORS2.test(tagName)) {
|
|
25903
|
-
throwError2(state, "tag suffix cannot contain flow indicator characters");
|
|
25904
|
-
}
|
|
25905
|
-
}
|
|
25906
|
-
if (tagName && !PATTERN_TAG_URI2.test(tagName)) {
|
|
25907
|
-
throwError2(state, "tag name cannot contain such characters: " + tagName);
|
|
25908
|
-
}
|
|
25909
|
-
try {
|
|
25910
|
-
tagName = decodeURIComponent(tagName);
|
|
25911
|
-
} catch (err) {
|
|
25912
|
-
throwError2(state, "tag name is malformed: " + tagName);
|
|
25913
|
-
}
|
|
25914
|
-
if (isVerbatim) {
|
|
25915
|
-
state.tag = tagName;
|
|
25916
|
-
} else if (_hasOwnProperty$12.call(state.tagMap, tagHandle)) {
|
|
25917
|
-
state.tag = state.tagMap[tagHandle] + tagName;
|
|
25918
|
-
} else if (tagHandle === "!") {
|
|
25919
|
-
state.tag = "!" + tagName;
|
|
25920
|
-
} else if (tagHandle === "!!") {
|
|
25921
|
-
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
25922
|
-
} else {
|
|
25923
|
-
throwError2(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
25924
|
-
}
|
|
25925
|
-
return true;
|
|
25926
|
-
}
|
|
25927
|
-
function readAnchorProperty2(state) {
|
|
25928
|
-
var _position, ch;
|
|
25929
|
-
ch = state.input.charCodeAt(state.position);
|
|
25930
|
-
if (ch !== 38)
|
|
25931
|
-
return false;
|
|
25932
|
-
if (state.anchor !== null) {
|
|
25933
|
-
throwError2(state, "duplication of an anchor property");
|
|
25934
|
-
}
|
|
25935
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25936
|
-
_position = state.position;
|
|
25937
|
-
while (ch !== 0 && !is_WS_OR_EOL2(ch) && !is_FLOW_INDICATOR2(ch)) {
|
|
25938
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25939
|
-
}
|
|
25940
|
-
if (state.position === _position) {
|
|
25941
|
-
throwError2(state, "name of an anchor node must contain at least one character");
|
|
25942
|
-
}
|
|
25943
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
25944
|
-
return true;
|
|
25945
|
-
}
|
|
25946
|
-
function readAlias2(state) {
|
|
25947
|
-
var _position, alias, ch;
|
|
25948
|
-
ch = state.input.charCodeAt(state.position);
|
|
25949
|
-
if (ch !== 42)
|
|
25950
|
-
return false;
|
|
25951
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25952
|
-
_position = state.position;
|
|
25953
|
-
while (ch !== 0 && !is_WS_OR_EOL2(ch) && !is_FLOW_INDICATOR2(ch)) {
|
|
25954
|
-
ch = state.input.charCodeAt(++state.position);
|
|
25955
|
-
}
|
|
25956
|
-
if (state.position === _position) {
|
|
25957
|
-
throwError2(state, "name of an alias node must contain at least one character");
|
|
25958
|
-
}
|
|
25959
|
-
alias = state.input.slice(_position, state.position);
|
|
25960
|
-
if (!_hasOwnProperty$12.call(state.anchorMap, alias)) {
|
|
25961
|
-
throwError2(state, 'unidentified alias "' + alias + '"');
|
|
25962
|
-
}
|
|
25963
|
-
state.result = state.anchorMap[alias];
|
|
25964
|
-
skipSeparationSpace2(state, true, -1);
|
|
25965
|
-
return true;
|
|
25966
|
-
}
|
|
25967
|
-
function composeNode2(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
25968
|
-
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type3, flowIndent, blockIndent;
|
|
25969
|
-
if (state.listener !== null) {
|
|
25970
|
-
state.listener("open", state);
|
|
25971
|
-
}
|
|
25972
|
-
state.tag = null;
|
|
25973
|
-
state.anchor = null;
|
|
25974
|
-
state.kind = null;
|
|
25975
|
-
state.result = null;
|
|
25976
|
-
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT2 === nodeContext || CONTEXT_BLOCK_IN2 === nodeContext;
|
|
25977
|
-
if (allowToSeek) {
|
|
25978
|
-
if (skipSeparationSpace2(state, true, -1)) {
|
|
25979
|
-
atNewLine = true;
|
|
25980
|
-
if (state.lineIndent > parentIndent) {
|
|
25981
|
-
indentStatus = 1;
|
|
25982
|
-
} else if (state.lineIndent === parentIndent) {
|
|
25983
|
-
indentStatus = 0;
|
|
25984
|
-
} else if (state.lineIndent < parentIndent) {
|
|
25985
|
-
indentStatus = -1;
|
|
25986
|
-
}
|
|
25987
|
-
}
|
|
25988
|
-
}
|
|
25989
|
-
if (indentStatus === 1) {
|
|
25990
|
-
while (readTagProperty2(state) || readAnchorProperty2(state)) {
|
|
25991
|
-
if (skipSeparationSpace2(state, true, -1)) {
|
|
25992
|
-
atNewLine = true;
|
|
25993
|
-
allowBlockCollections = allowBlockStyles;
|
|
25994
|
-
if (state.lineIndent > parentIndent) {
|
|
25995
|
-
indentStatus = 1;
|
|
25996
|
-
} else if (state.lineIndent === parentIndent) {
|
|
25997
|
-
indentStatus = 0;
|
|
25998
|
-
} else if (state.lineIndent < parentIndent) {
|
|
25999
|
-
indentStatus = -1;
|
|
26000
|
-
}
|
|
26001
|
-
} else {
|
|
26002
|
-
allowBlockCollections = false;
|
|
26003
|
-
}
|
|
26004
|
-
}
|
|
26005
|
-
}
|
|
26006
|
-
if (allowBlockCollections) {
|
|
26007
|
-
allowBlockCollections = atNewLine || allowCompact;
|
|
26008
|
-
}
|
|
26009
|
-
if (indentStatus === 1 || CONTEXT_BLOCK_OUT2 === nodeContext) {
|
|
26010
|
-
if (CONTEXT_FLOW_IN2 === nodeContext || CONTEXT_FLOW_OUT2 === nodeContext) {
|
|
26011
|
-
flowIndent = parentIndent;
|
|
26012
|
-
} else {
|
|
26013
|
-
flowIndent = parentIndent + 1;
|
|
26014
|
-
}
|
|
26015
|
-
blockIndent = state.position - state.lineStart;
|
|
26016
|
-
if (indentStatus === 1) {
|
|
26017
|
-
if (allowBlockCollections && (readBlockSequence2(state, blockIndent) || readBlockMapping2(state, blockIndent, flowIndent)) || readFlowCollection2(state, flowIndent)) {
|
|
26018
|
-
hasContent = true;
|
|
26019
|
-
} else {
|
|
26020
|
-
if (allowBlockScalars && readBlockScalar2(state, flowIndent) || readSingleQuotedScalar2(state, flowIndent) || readDoubleQuotedScalar2(state, flowIndent)) {
|
|
26021
|
-
hasContent = true;
|
|
26022
|
-
} else if (readAlias2(state)) {
|
|
26023
|
-
hasContent = true;
|
|
26024
|
-
if (state.tag !== null || state.anchor !== null) {
|
|
26025
|
-
throwError2(state, "alias node should not have any properties");
|
|
26026
|
-
}
|
|
26027
|
-
} else if (readPlainScalar2(state, flowIndent, CONTEXT_FLOW_IN2 === nodeContext)) {
|
|
26028
|
-
hasContent = true;
|
|
26029
|
-
if (state.tag === null) {
|
|
26030
|
-
state.tag = "?";
|
|
26031
|
-
}
|
|
26032
|
-
}
|
|
26033
|
-
if (state.anchor !== null) {
|
|
26034
|
-
state.anchorMap[state.anchor] = state.result;
|
|
26035
|
-
}
|
|
26036
|
-
}
|
|
26037
|
-
} else if (indentStatus === 0) {
|
|
26038
|
-
hasContent = allowBlockCollections && readBlockSequence2(state, blockIndent);
|
|
26039
|
-
}
|
|
26040
|
-
}
|
|
26041
|
-
if (state.tag === null) {
|
|
26042
|
-
if (state.anchor !== null) {
|
|
26043
|
-
state.anchorMap[state.anchor] = state.result;
|
|
26044
|
-
}
|
|
26045
|
-
} else if (state.tag === "?") {
|
|
26046
|
-
if (state.result !== null && state.kind !== "scalar") {
|
|
26047
|
-
throwError2(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
26048
|
-
}
|
|
26049
|
-
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
26050
|
-
type3 = state.implicitTypes[typeIndex];
|
|
26051
|
-
if (type3.resolve(state.result)) {
|
|
26052
|
-
state.result = type3.construct(state.result);
|
|
26053
|
-
state.tag = type3.tag;
|
|
26054
|
-
if (state.anchor !== null) {
|
|
26055
|
-
state.anchorMap[state.anchor] = state.result;
|
|
26056
|
-
}
|
|
26057
|
-
break;
|
|
26058
|
-
}
|
|
26059
|
-
}
|
|
26060
|
-
} else if (state.tag !== "!") {
|
|
26061
|
-
if (_hasOwnProperty$12.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
26062
|
-
type3 = state.typeMap[state.kind || "fallback"][state.tag];
|
|
26063
|
-
} else {
|
|
26064
|
-
type3 = null;
|
|
26065
|
-
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
26066
|
-
for (typeIndex = 0, typeQuantity = typeList.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
26067
|
-
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
26068
|
-
type3 = typeList[typeIndex];
|
|
26069
|
-
break;
|
|
26070
|
-
}
|
|
26071
|
-
}
|
|
26072
|
-
}
|
|
26073
|
-
if (!type3) {
|
|
26074
|
-
throwError2(state, "unknown tag !<" + state.tag + ">");
|
|
26075
|
-
}
|
|
26076
|
-
if (state.result !== null && type3.kind !== state.kind) {
|
|
26077
|
-
throwError2(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type3.kind + '", not "' + state.kind + '"');
|
|
26078
|
-
}
|
|
26079
|
-
if (!type3.resolve(state.result, state.tag)) {
|
|
26080
|
-
throwError2(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
26081
|
-
} else {
|
|
26082
|
-
state.result = type3.construct(state.result, state.tag);
|
|
26083
|
-
if (state.anchor !== null) {
|
|
26084
|
-
state.anchorMap[state.anchor] = state.result;
|
|
26085
|
-
}
|
|
26086
|
-
}
|
|
26087
|
-
}
|
|
26088
|
-
if (state.listener !== null) {
|
|
26089
|
-
state.listener("close", state);
|
|
26090
|
-
}
|
|
26091
|
-
return state.tag !== null || state.anchor !== null || hasContent;
|
|
26092
|
-
}
|
|
26093
|
-
function readDocument2(state) {
|
|
26094
|
-
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
26095
|
-
state.version = null;
|
|
26096
|
-
state.checkLineBreaks = state.legacy;
|
|
26097
|
-
state.tagMap = Object.create(null);
|
|
26098
|
-
state.anchorMap = Object.create(null);
|
|
26099
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
26100
|
-
skipSeparationSpace2(state, true, -1);
|
|
26101
|
-
ch = state.input.charCodeAt(state.position);
|
|
26102
|
-
if (state.lineIndent > 0 || ch !== 37) {
|
|
26103
|
-
break;
|
|
26104
|
-
}
|
|
26105
|
-
hasDirectives = true;
|
|
26106
|
-
ch = state.input.charCodeAt(++state.position);
|
|
26107
|
-
_position = state.position;
|
|
26108
|
-
while (ch !== 0 && !is_WS_OR_EOL2(ch)) {
|
|
26109
|
-
ch = state.input.charCodeAt(++state.position);
|
|
26110
|
-
}
|
|
26111
|
-
directiveName = state.input.slice(_position, state.position);
|
|
26112
|
-
directiveArgs = [];
|
|
26113
|
-
if (directiveName.length < 1) {
|
|
26114
|
-
throwError2(state, "directive name must not be less than one character in length");
|
|
26115
|
-
}
|
|
26116
|
-
while (ch !== 0) {
|
|
26117
|
-
while (is_WHITE_SPACE2(ch)) {
|
|
26118
|
-
ch = state.input.charCodeAt(++state.position);
|
|
26119
|
-
}
|
|
26120
|
-
if (ch === 35) {
|
|
26121
|
-
do {
|
|
26122
|
-
ch = state.input.charCodeAt(++state.position);
|
|
26123
|
-
} while (ch !== 0 && !is_EOL2(ch));
|
|
26124
|
-
break;
|
|
26125
|
-
}
|
|
26126
|
-
if (is_EOL2(ch))
|
|
26127
|
-
break;
|
|
26128
|
-
_position = state.position;
|
|
26129
|
-
while (ch !== 0 && !is_WS_OR_EOL2(ch)) {
|
|
26130
|
-
ch = state.input.charCodeAt(++state.position);
|
|
26131
|
-
}
|
|
26132
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
26133
|
-
}
|
|
26134
|
-
if (ch !== 0)
|
|
26135
|
-
readLineBreak2(state);
|
|
26136
|
-
if (_hasOwnProperty$12.call(directiveHandlers2, directiveName)) {
|
|
26137
|
-
directiveHandlers2[directiveName](state, directiveName, directiveArgs);
|
|
26138
|
-
} else {
|
|
26139
|
-
throwWarning2(state, 'unknown document directive "' + directiveName + '"');
|
|
26140
|
-
}
|
|
26141
|
-
}
|
|
26142
|
-
skipSeparationSpace2(state, true, -1);
|
|
26143
|
-
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
26144
|
-
state.position += 3;
|
|
26145
|
-
skipSeparationSpace2(state, true, -1);
|
|
26146
|
-
} else if (hasDirectives) {
|
|
26147
|
-
throwError2(state, "directives end mark is expected");
|
|
26148
|
-
}
|
|
26149
|
-
composeNode2(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT2, false, true);
|
|
26150
|
-
skipSeparationSpace2(state, true, -1);
|
|
26151
|
-
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS2.test(state.input.slice(documentStart, state.position))) {
|
|
26152
|
-
throwWarning2(state, "non-ASCII line breaks are interpreted as content");
|
|
26153
|
-
}
|
|
26154
|
-
state.documents.push(state.result);
|
|
26155
|
-
if (state.position === state.lineStart && testDocumentSeparator2(state)) {
|
|
26156
|
-
if (state.input.charCodeAt(state.position) === 46) {
|
|
26157
|
-
state.position += 3;
|
|
26158
|
-
skipSeparationSpace2(state, true, -1);
|
|
26159
|
-
}
|
|
26160
|
-
return;
|
|
26161
|
-
}
|
|
26162
|
-
if (state.position < state.length - 1) {
|
|
26163
|
-
throwError2(state, "end of the stream or a document separator is expected");
|
|
26164
|
-
} else {
|
|
26165
|
-
return;
|
|
26166
|
-
}
|
|
26167
|
-
}
|
|
26168
|
-
function loadDocuments2(input, options) {
|
|
26169
|
-
input = String(input);
|
|
26170
|
-
options = options || {};
|
|
26171
|
-
if (input.length !== 0) {
|
|
26172
|
-
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
26173
|
-
input += `
|
|
26174
|
-
`;
|
|
26175
|
-
}
|
|
26176
|
-
if (input.charCodeAt(0) === 65279) {
|
|
26177
|
-
input = input.slice(1);
|
|
26178
|
-
}
|
|
26179
|
-
}
|
|
26180
|
-
var state = new State$12(input, options);
|
|
26181
|
-
var nullpos = input.indexOf("\x00");
|
|
26182
|
-
if (nullpos !== -1) {
|
|
26183
|
-
state.position = nullpos;
|
|
26184
|
-
throwError2(state, "null byte is not allowed in input");
|
|
26185
|
-
}
|
|
26186
|
-
state.input += "\x00";
|
|
26187
|
-
while (state.input.charCodeAt(state.position) === 32) {
|
|
26188
|
-
state.lineIndent += 1;
|
|
26189
|
-
state.position += 1;
|
|
26190
|
-
}
|
|
26191
|
-
while (state.position < state.length - 1) {
|
|
26192
|
-
readDocument2(state);
|
|
26193
|
-
}
|
|
26194
|
-
return state.documents;
|
|
26195
|
-
}
|
|
26196
|
-
function loadAll$12(input, iterator, options) {
|
|
26197
|
-
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
26198
|
-
options = iterator;
|
|
26199
|
-
iterator = null;
|
|
26200
|
-
}
|
|
26201
|
-
var documents = loadDocuments2(input, options);
|
|
26202
|
-
if (typeof iterator !== "function") {
|
|
26203
|
-
return documents;
|
|
26204
|
-
}
|
|
26205
|
-
for (var index = 0, length = documents.length;index < length; index += 1) {
|
|
26206
|
-
iterator(documents[index]);
|
|
26207
|
-
}
|
|
26208
|
-
}
|
|
26209
|
-
function load$12(input, options) {
|
|
26210
|
-
var documents = loadDocuments2(input, options);
|
|
26211
|
-
if (documents.length === 0) {
|
|
26212
|
-
return;
|
|
26213
|
-
} else if (documents.length === 1) {
|
|
26214
|
-
return documents[0];
|
|
26215
|
-
}
|
|
26216
|
-
throw new exception2("expected a single document in the stream, but found more");
|
|
26217
|
-
}
|
|
26218
|
-
var loadAll_12 = loadAll$12;
|
|
26219
|
-
var load_12 = load$12;
|
|
26220
|
-
var loader2 = {
|
|
26221
|
-
loadAll: loadAll_12,
|
|
26222
|
-
load: load_12
|
|
26223
|
-
};
|
|
26224
|
-
var _toString2 = Object.prototype.toString;
|
|
26225
|
-
var _hasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
26226
|
-
var CHAR_BOM2 = 65279;
|
|
26227
|
-
var CHAR_TAB2 = 9;
|
|
26228
|
-
var CHAR_LINE_FEED2 = 10;
|
|
26229
|
-
var CHAR_CARRIAGE_RETURN2 = 13;
|
|
26230
|
-
var CHAR_SPACE2 = 32;
|
|
26231
|
-
var CHAR_EXCLAMATION2 = 33;
|
|
26232
|
-
var CHAR_DOUBLE_QUOTE2 = 34;
|
|
26233
|
-
var CHAR_SHARP2 = 35;
|
|
26234
|
-
var CHAR_PERCENT2 = 37;
|
|
26235
|
-
var CHAR_AMPERSAND2 = 38;
|
|
26236
|
-
var CHAR_SINGLE_QUOTE2 = 39;
|
|
26237
|
-
var CHAR_ASTERISK2 = 42;
|
|
26238
|
-
var CHAR_COMMA2 = 44;
|
|
26239
|
-
var CHAR_MINUS2 = 45;
|
|
26240
|
-
var CHAR_COLON2 = 58;
|
|
26241
|
-
var CHAR_EQUALS2 = 61;
|
|
26242
|
-
var CHAR_GREATER_THAN2 = 62;
|
|
26243
|
-
var CHAR_QUESTION2 = 63;
|
|
26244
|
-
var CHAR_COMMERCIAL_AT2 = 64;
|
|
26245
|
-
var CHAR_LEFT_SQUARE_BRACKET2 = 91;
|
|
26246
|
-
var CHAR_RIGHT_SQUARE_BRACKET2 = 93;
|
|
26247
|
-
var CHAR_GRAVE_ACCENT2 = 96;
|
|
26248
|
-
var CHAR_LEFT_CURLY_BRACKET2 = 123;
|
|
26249
|
-
var CHAR_VERTICAL_LINE2 = 124;
|
|
26250
|
-
var CHAR_RIGHT_CURLY_BRACKET2 = 125;
|
|
26251
|
-
var ESCAPE_SEQUENCES2 = {};
|
|
26252
|
-
ESCAPE_SEQUENCES2[0] = "\\0";
|
|
26253
|
-
ESCAPE_SEQUENCES2[7] = "\\a";
|
|
26254
|
-
ESCAPE_SEQUENCES2[8] = "\\b";
|
|
26255
|
-
ESCAPE_SEQUENCES2[9] = "\\t";
|
|
26256
|
-
ESCAPE_SEQUENCES2[10] = "\\n";
|
|
26257
|
-
ESCAPE_SEQUENCES2[11] = "\\v";
|
|
26258
|
-
ESCAPE_SEQUENCES2[12] = "\\f";
|
|
26259
|
-
ESCAPE_SEQUENCES2[13] = "\\r";
|
|
26260
|
-
ESCAPE_SEQUENCES2[27] = "\\e";
|
|
26261
|
-
ESCAPE_SEQUENCES2[34] = "\\\"";
|
|
26262
|
-
ESCAPE_SEQUENCES2[92] = "\\\\";
|
|
26263
|
-
ESCAPE_SEQUENCES2[133] = "\\N";
|
|
26264
|
-
ESCAPE_SEQUENCES2[160] = "\\_";
|
|
26265
|
-
ESCAPE_SEQUENCES2[8232] = "\\L";
|
|
26266
|
-
ESCAPE_SEQUENCES2[8233] = "\\P";
|
|
26267
|
-
var DEPRECATED_BOOLEANS_SYNTAX2 = [
|
|
26268
|
-
"y",
|
|
26269
|
-
"Y",
|
|
26270
|
-
"yes",
|
|
26271
|
-
"Yes",
|
|
26272
|
-
"YES",
|
|
26273
|
-
"on",
|
|
26274
|
-
"On",
|
|
26275
|
-
"ON",
|
|
26276
|
-
"n",
|
|
26277
|
-
"N",
|
|
26278
|
-
"no",
|
|
26279
|
-
"No",
|
|
26280
|
-
"NO",
|
|
26281
|
-
"off",
|
|
26282
|
-
"Off",
|
|
26283
|
-
"OFF"
|
|
26284
|
-
];
|
|
26285
|
-
var DEPRECATED_BASE60_SYNTAX2 = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
26286
|
-
function compileStyleMap2(schema3, map4) {
|
|
26287
|
-
var result, keys, index, length, tag, style, type3;
|
|
26288
|
-
if (map4 === null)
|
|
26289
|
-
return {};
|
|
26290
|
-
result = {};
|
|
26291
|
-
keys = Object.keys(map4);
|
|
26292
|
-
for (index = 0, length = keys.length;index < length; index += 1) {
|
|
26293
|
-
tag = keys[index];
|
|
26294
|
-
style = String(map4[tag]);
|
|
26295
|
-
if (tag.slice(0, 2) === "!!") {
|
|
26296
|
-
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
26297
|
-
}
|
|
26298
|
-
type3 = schema3.compiledTypeMap["fallback"][tag];
|
|
26299
|
-
if (type3 && _hasOwnProperty2.call(type3.styleAliases, style)) {
|
|
26300
|
-
style = type3.styleAliases[style];
|
|
26301
|
-
}
|
|
26302
|
-
result[tag] = style;
|
|
26303
|
-
}
|
|
26304
|
-
return result;
|
|
26305
|
-
}
|
|
26306
|
-
function encodeHex2(character) {
|
|
26307
|
-
var string4, handle, length;
|
|
26308
|
-
string4 = character.toString(16).toUpperCase();
|
|
26309
|
-
if (character <= 255) {
|
|
26310
|
-
handle = "x";
|
|
26311
|
-
length = 2;
|
|
26312
|
-
} else if (character <= 65535) {
|
|
26313
|
-
handle = "u";
|
|
26314
|
-
length = 4;
|
|
26315
|
-
} else if (character <= 4294967295) {
|
|
26316
|
-
handle = "U";
|
|
26317
|
-
length = 8;
|
|
26318
|
-
} else {
|
|
26319
|
-
throw new exception2("code point within a string may not be greater than 0xFFFFFFFF");
|
|
26320
|
-
}
|
|
26321
|
-
return "\\" + handle + common2.repeat("0", length - string4.length) + string4;
|
|
26322
|
-
}
|
|
26323
|
-
var QUOTING_TYPE_SINGLE2 = 1;
|
|
26324
|
-
var QUOTING_TYPE_DOUBLE2 = 2;
|
|
26325
|
-
function State2(options) {
|
|
26326
|
-
this.schema = options["schema"] || _default3;
|
|
26327
|
-
this.indent = Math.max(1, options["indent"] || 2);
|
|
26328
|
-
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
26329
|
-
this.skipInvalid = options["skipInvalid"] || false;
|
|
26330
|
-
this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
26331
|
-
this.styleMap = compileStyleMap2(this.schema, options["styles"] || null);
|
|
26332
|
-
this.sortKeys = options["sortKeys"] || false;
|
|
26333
|
-
this.lineWidth = options["lineWidth"] || 80;
|
|
26334
|
-
this.noRefs = options["noRefs"] || false;
|
|
26335
|
-
this.noCompatMode = options["noCompatMode"] || false;
|
|
26336
|
-
this.condenseFlow = options["condenseFlow"] || false;
|
|
26337
|
-
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE2 : QUOTING_TYPE_SINGLE2;
|
|
26338
|
-
this.forceQuotes = options["forceQuotes"] || false;
|
|
26339
|
-
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
26340
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
26341
|
-
this.explicitTypes = this.schema.compiledExplicit;
|
|
26342
|
-
this.tag = null;
|
|
26343
|
-
this.result = "";
|
|
26344
|
-
this.duplicates = [];
|
|
26345
|
-
this.usedDuplicates = null;
|
|
26346
|
-
}
|
|
26347
|
-
function indentString2(string4, spaces) {
|
|
26348
|
-
var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string4.length;
|
|
26349
|
-
while (position < length) {
|
|
26350
|
-
next = string4.indexOf(`
|
|
26351
|
-
`, position);
|
|
26352
|
-
if (next === -1) {
|
|
26353
|
-
line = string4.slice(position);
|
|
26354
|
-
position = length;
|
|
26355
|
-
} else {
|
|
26356
|
-
line = string4.slice(position, next + 1);
|
|
26357
|
-
position = next + 1;
|
|
26358
|
-
}
|
|
26359
|
-
if (line.length && line !== `
|
|
26360
|
-
`)
|
|
26361
|
-
result += ind;
|
|
26362
|
-
result += line;
|
|
26363
|
-
}
|
|
26364
|
-
return result;
|
|
26365
|
-
}
|
|
26366
|
-
function generateNextLine2(state, level) {
|
|
26367
|
-
return `
|
|
26368
|
-
` + common2.repeat(" ", state.indent * level);
|
|
26369
|
-
}
|
|
26370
|
-
function testImplicitResolving2(state, str3) {
|
|
26371
|
-
var index, length, type3;
|
|
26372
|
-
for (index = 0, length = state.implicitTypes.length;index < length; index += 1) {
|
|
26373
|
-
type3 = state.implicitTypes[index];
|
|
26374
|
-
if (type3.resolve(str3)) {
|
|
26375
|
-
return true;
|
|
26376
|
-
}
|
|
26377
|
-
}
|
|
26378
|
-
return false;
|
|
26379
|
-
}
|
|
26380
|
-
function isWhitespace2(c) {
|
|
26381
|
-
return c === CHAR_SPACE2 || c === CHAR_TAB2;
|
|
26382
|
-
}
|
|
26383
|
-
function isPrintable2(c) {
|
|
26384
|
-
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM2 || 65536 <= c && c <= 1114111;
|
|
26385
|
-
}
|
|
26386
|
-
function isNsCharOrWhitespace2(c) {
|
|
26387
|
-
return isPrintable2(c) && c !== CHAR_BOM2 && c !== CHAR_CARRIAGE_RETURN2 && c !== CHAR_LINE_FEED2;
|
|
26388
|
-
}
|
|
26389
|
-
function isPlainSafe2(c, prev, inblock) {
|
|
26390
|
-
var cIsNsCharOrWhitespace = isNsCharOrWhitespace2(c);
|
|
26391
|
-
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace2(c);
|
|
26392
|
-
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA2 && c !== CHAR_LEFT_SQUARE_BRACKET2 && c !== CHAR_RIGHT_SQUARE_BRACKET2 && c !== CHAR_LEFT_CURLY_BRACKET2 && c !== CHAR_RIGHT_CURLY_BRACKET2) && c !== CHAR_SHARP2 && !(prev === CHAR_COLON2 && !cIsNsChar) || isNsCharOrWhitespace2(prev) && !isWhitespace2(prev) && c === CHAR_SHARP2 || prev === CHAR_COLON2 && cIsNsChar;
|
|
26393
|
-
}
|
|
26394
|
-
function isPlainSafeFirst2(c) {
|
|
26395
|
-
return isPrintable2(c) && c !== CHAR_BOM2 && !isWhitespace2(c) && c !== CHAR_MINUS2 && c !== CHAR_QUESTION2 && c !== CHAR_COLON2 && c !== CHAR_COMMA2 && c !== CHAR_LEFT_SQUARE_BRACKET2 && c !== CHAR_RIGHT_SQUARE_BRACKET2 && c !== CHAR_LEFT_CURLY_BRACKET2 && c !== CHAR_RIGHT_CURLY_BRACKET2 && c !== CHAR_SHARP2 && c !== CHAR_AMPERSAND2 && c !== CHAR_ASTERISK2 && c !== CHAR_EXCLAMATION2 && c !== CHAR_VERTICAL_LINE2 && c !== CHAR_EQUALS2 && c !== CHAR_GREATER_THAN2 && c !== CHAR_SINGLE_QUOTE2 && c !== CHAR_DOUBLE_QUOTE2 && c !== CHAR_PERCENT2 && c !== CHAR_COMMERCIAL_AT2 && c !== CHAR_GRAVE_ACCENT2;
|
|
26396
|
-
}
|
|
26397
|
-
function isPlainSafeLast2(c) {
|
|
26398
|
-
return !isWhitespace2(c) && c !== CHAR_COLON2;
|
|
26399
|
-
}
|
|
26400
|
-
function codePointAt2(string4, pos) {
|
|
26401
|
-
var first = string4.charCodeAt(pos), second;
|
|
26402
|
-
if (first >= 55296 && first <= 56319 && pos + 1 < string4.length) {
|
|
26403
|
-
second = string4.charCodeAt(pos + 1);
|
|
26404
|
-
if (second >= 56320 && second <= 57343) {
|
|
26405
|
-
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
26406
|
-
}
|
|
26407
|
-
}
|
|
26408
|
-
return first;
|
|
26409
|
-
}
|
|
26410
|
-
function needIndentIndicator2(string4) {
|
|
26411
|
-
var leadingSpaceRe = /^\n* /;
|
|
26412
|
-
return leadingSpaceRe.test(string4);
|
|
26413
|
-
}
|
|
26414
|
-
var STYLE_PLAIN2 = 1;
|
|
26415
|
-
var STYLE_SINGLE2 = 2;
|
|
26416
|
-
var STYLE_LITERAL2 = 3;
|
|
26417
|
-
var STYLE_FOLDED2 = 4;
|
|
26418
|
-
var STYLE_DOUBLE2 = 5;
|
|
26419
|
-
function chooseScalarStyle2(string4, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
26420
|
-
var i3;
|
|
26421
|
-
var char = 0;
|
|
26422
|
-
var prevChar = null;
|
|
26423
|
-
var hasLineBreak = false;
|
|
26424
|
-
var hasFoldableLine = false;
|
|
26425
|
-
var shouldTrackWidth = lineWidth !== -1;
|
|
26426
|
-
var previousLineBreak = -1;
|
|
26427
|
-
var plain = isPlainSafeFirst2(codePointAt2(string4, 0)) && isPlainSafeLast2(codePointAt2(string4, string4.length - 1));
|
|
26428
|
-
if (singleLineOnly || forceQuotes) {
|
|
26429
|
-
for (i3 = 0;i3 < string4.length; char >= 65536 ? i3 += 2 : i3++) {
|
|
26430
|
-
char = codePointAt2(string4, i3);
|
|
26431
|
-
if (!isPrintable2(char)) {
|
|
26432
|
-
return STYLE_DOUBLE2;
|
|
26433
|
-
}
|
|
26434
|
-
plain = plain && isPlainSafe2(char, prevChar, inblock);
|
|
26435
|
-
prevChar = char;
|
|
26436
|
-
}
|
|
26437
|
-
} else {
|
|
26438
|
-
for (i3 = 0;i3 < string4.length; char >= 65536 ? i3 += 2 : i3++) {
|
|
26439
|
-
char = codePointAt2(string4, i3);
|
|
26440
|
-
if (char === CHAR_LINE_FEED2) {
|
|
26441
|
-
hasLineBreak = true;
|
|
26442
|
-
if (shouldTrackWidth) {
|
|
26443
|
-
hasFoldableLine = hasFoldableLine || i3 - previousLineBreak - 1 > lineWidth && string4[previousLineBreak + 1] !== " ";
|
|
26444
|
-
previousLineBreak = i3;
|
|
26445
|
-
}
|
|
26446
|
-
} else if (!isPrintable2(char)) {
|
|
26447
|
-
return STYLE_DOUBLE2;
|
|
26448
|
-
}
|
|
26449
|
-
plain = plain && isPlainSafe2(char, prevChar, inblock);
|
|
26450
|
-
prevChar = char;
|
|
26451
|
-
}
|
|
26452
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i3 - previousLineBreak - 1 > lineWidth && string4[previousLineBreak + 1] !== " ");
|
|
26453
|
-
}
|
|
26454
|
-
if (!hasLineBreak && !hasFoldableLine) {
|
|
26455
|
-
if (plain && !forceQuotes && !testAmbiguousType(string4)) {
|
|
26456
|
-
return STYLE_PLAIN2;
|
|
26457
|
-
}
|
|
26458
|
-
return quotingType === QUOTING_TYPE_DOUBLE2 ? STYLE_DOUBLE2 : STYLE_SINGLE2;
|
|
26459
|
-
}
|
|
26460
|
-
if (indentPerLevel > 9 && needIndentIndicator2(string4)) {
|
|
26461
|
-
return STYLE_DOUBLE2;
|
|
26462
|
-
}
|
|
26463
|
-
if (!forceQuotes) {
|
|
26464
|
-
return hasFoldableLine ? STYLE_FOLDED2 : STYLE_LITERAL2;
|
|
26465
|
-
}
|
|
26466
|
-
return quotingType === QUOTING_TYPE_DOUBLE2 ? STYLE_DOUBLE2 : STYLE_SINGLE2;
|
|
26467
|
-
}
|
|
26468
|
-
function writeScalar2(state, string4, level, iskey, inblock) {
|
|
26469
|
-
state.dump = function() {
|
|
26470
|
-
if (string4.length === 0) {
|
|
26471
|
-
return state.quotingType === QUOTING_TYPE_DOUBLE2 ? '""' : "''";
|
|
26472
|
-
}
|
|
26473
|
-
if (!state.noCompatMode) {
|
|
26474
|
-
if (DEPRECATED_BOOLEANS_SYNTAX2.indexOf(string4) !== -1 || DEPRECATED_BASE60_SYNTAX2.test(string4)) {
|
|
26475
|
-
return state.quotingType === QUOTING_TYPE_DOUBLE2 ? '"' + string4 + '"' : "'" + string4 + "'";
|
|
26476
|
-
}
|
|
26477
|
-
}
|
|
26478
|
-
var indent = state.indent * Math.max(1, level);
|
|
26479
|
-
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
26480
|
-
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
26481
|
-
function testAmbiguity(string5) {
|
|
26482
|
-
return testImplicitResolving2(state, string5);
|
|
26483
|
-
}
|
|
26484
|
-
switch (chooseScalarStyle2(string4, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
26485
|
-
case STYLE_PLAIN2:
|
|
26486
|
-
return string4;
|
|
26487
|
-
case STYLE_SINGLE2:
|
|
26488
|
-
return "'" + string4.replace(/'/g, "''") + "'";
|
|
26489
|
-
case STYLE_LITERAL2:
|
|
26490
|
-
return "|" + blockHeader2(string4, state.indent) + dropEndingNewline2(indentString2(string4, indent));
|
|
26491
|
-
case STYLE_FOLDED2:
|
|
26492
|
-
return ">" + blockHeader2(string4, state.indent) + dropEndingNewline2(indentString2(foldString2(string4, lineWidth), indent));
|
|
26493
|
-
case STYLE_DOUBLE2:
|
|
26494
|
-
return '"' + escapeString2(string4) + '"';
|
|
26495
|
-
default:
|
|
26496
|
-
throw new exception2("impossible error: invalid scalar style");
|
|
26497
|
-
}
|
|
26498
|
-
}();
|
|
26499
|
-
}
|
|
26500
|
-
function blockHeader2(string4, indentPerLevel) {
|
|
26501
|
-
var indentIndicator = needIndentIndicator2(string4) ? String(indentPerLevel) : "";
|
|
26502
|
-
var clip = string4[string4.length - 1] === `
|
|
26503
|
-
`;
|
|
26504
|
-
var keep = clip && (string4[string4.length - 2] === `
|
|
26505
|
-
` || string4 === `
|
|
26506
|
-
`);
|
|
26507
|
-
var chomp = keep ? "+" : clip ? "" : "-";
|
|
26508
|
-
return indentIndicator + chomp + `
|
|
26509
|
-
`;
|
|
26510
|
-
}
|
|
26511
|
-
function dropEndingNewline2(string4) {
|
|
26512
|
-
return string4[string4.length - 1] === `
|
|
26513
|
-
` ? string4.slice(0, -1) : string4;
|
|
26514
|
-
}
|
|
26515
|
-
function foldString2(string4, width) {
|
|
26516
|
-
var lineRe = /(\n+)([^\n]*)/g;
|
|
26517
|
-
var result = function() {
|
|
26518
|
-
var nextLF = string4.indexOf(`
|
|
26519
|
-
`);
|
|
26520
|
-
nextLF = nextLF !== -1 ? nextLF : string4.length;
|
|
26521
|
-
lineRe.lastIndex = nextLF;
|
|
26522
|
-
return foldLine2(string4.slice(0, nextLF), width);
|
|
26523
|
-
}();
|
|
26524
|
-
var prevMoreIndented = string4[0] === `
|
|
26525
|
-
` || string4[0] === " ";
|
|
26526
|
-
var moreIndented;
|
|
26527
|
-
var match;
|
|
26528
|
-
while (match = lineRe.exec(string4)) {
|
|
26529
|
-
var prefix = match[1], line = match[2];
|
|
26530
|
-
moreIndented = line[0] === " ";
|
|
26531
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
|
|
26532
|
-
` : "") + foldLine2(line, width);
|
|
26533
|
-
prevMoreIndented = moreIndented;
|
|
26534
|
-
}
|
|
26535
|
-
return result;
|
|
26536
|
-
}
|
|
26537
|
-
function foldLine2(line, width) {
|
|
26538
|
-
if (line === "" || line[0] === " ")
|
|
26539
|
-
return line;
|
|
26540
|
-
var breakRe = / [^ ]/g;
|
|
26541
|
-
var match;
|
|
26542
|
-
var start = 0, end, curr = 0, next = 0;
|
|
26543
|
-
var result = "";
|
|
26544
|
-
while (match = breakRe.exec(line)) {
|
|
26545
|
-
next = match.index;
|
|
26546
|
-
if (next - start > width) {
|
|
26547
|
-
end = curr > start ? curr : next;
|
|
26548
|
-
result += `
|
|
26549
|
-
` + line.slice(start, end);
|
|
26550
|
-
start = end + 1;
|
|
26551
|
-
}
|
|
26552
|
-
curr = next;
|
|
26553
|
-
}
|
|
26554
|
-
result += `
|
|
26555
|
-
`;
|
|
26556
|
-
if (line.length - start > width && curr > start) {
|
|
26557
|
-
result += line.slice(start, curr) + `
|
|
26558
|
-
` + line.slice(curr + 1);
|
|
26559
|
-
} else {
|
|
26560
|
-
result += line.slice(start);
|
|
26561
|
-
}
|
|
26562
|
-
return result.slice(1);
|
|
26563
|
-
}
|
|
26564
|
-
function escapeString2(string4) {
|
|
26565
|
-
var result = "";
|
|
26566
|
-
var char = 0;
|
|
26567
|
-
var escapeSeq;
|
|
26568
|
-
for (var i3 = 0;i3 < string4.length; char >= 65536 ? i3 += 2 : i3++) {
|
|
26569
|
-
char = codePointAt2(string4, i3);
|
|
26570
|
-
escapeSeq = ESCAPE_SEQUENCES2[char];
|
|
26571
|
-
if (!escapeSeq && isPrintable2(char)) {
|
|
26572
|
-
result += string4[i3];
|
|
26573
|
-
if (char >= 65536)
|
|
26574
|
-
result += string4[i3 + 1];
|
|
26575
|
-
} else {
|
|
26576
|
-
result += escapeSeq || encodeHex2(char);
|
|
26577
|
-
}
|
|
26578
|
-
}
|
|
26579
|
-
return result;
|
|
26580
|
-
}
|
|
26581
|
-
function writeFlowSequence2(state, level, object4) {
|
|
26582
|
-
var _result = "", _tag = state.tag, index, length, value;
|
|
26583
|
-
for (index = 0, length = object4.length;index < length; index += 1) {
|
|
26584
|
-
value = object4[index];
|
|
26585
|
-
if (state.replacer) {
|
|
26586
|
-
value = state.replacer.call(object4, String(index), value);
|
|
26587
|
-
}
|
|
26588
|
-
if (writeNode2(state, level, value, false, false) || typeof value === "undefined" && writeNode2(state, level, null, false, false)) {
|
|
26589
|
-
if (_result !== "")
|
|
26590
|
-
_result += "," + (!state.condenseFlow ? " " : "");
|
|
26591
|
-
_result += state.dump;
|
|
26592
|
-
}
|
|
26593
|
-
}
|
|
26594
|
-
state.tag = _tag;
|
|
26595
|
-
state.dump = "[" + _result + "]";
|
|
26596
|
-
}
|
|
26597
|
-
function writeBlockSequence2(state, level, object4, compact) {
|
|
26598
|
-
var _result = "", _tag = state.tag, index, length, value;
|
|
26599
|
-
for (index = 0, length = object4.length;index < length; index += 1) {
|
|
26600
|
-
value = object4[index];
|
|
26601
|
-
if (state.replacer) {
|
|
26602
|
-
value = state.replacer.call(object4, String(index), value);
|
|
26603
|
-
}
|
|
26604
|
-
if (writeNode2(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode2(state, level + 1, null, true, true, false, true)) {
|
|
26605
|
-
if (!compact || _result !== "") {
|
|
26606
|
-
_result += generateNextLine2(state, level);
|
|
26607
|
-
}
|
|
26608
|
-
if (state.dump && CHAR_LINE_FEED2 === state.dump.charCodeAt(0)) {
|
|
26609
|
-
_result += "-";
|
|
26610
|
-
} else {
|
|
26611
|
-
_result += "- ";
|
|
26612
|
-
}
|
|
26613
|
-
_result += state.dump;
|
|
26614
|
-
}
|
|
26615
|
-
}
|
|
26616
|
-
state.tag = _tag;
|
|
26617
|
-
state.dump = _result || "[]";
|
|
26618
|
-
}
|
|
26619
|
-
function writeFlowMapping2(state, level, object4) {
|
|
26620
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object4), index, length, objectKey, objectValue, pairBuffer;
|
|
26621
|
-
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
26622
|
-
pairBuffer = "";
|
|
26623
|
-
if (_result !== "")
|
|
26624
|
-
pairBuffer += ", ";
|
|
26625
|
-
if (state.condenseFlow)
|
|
26626
|
-
pairBuffer += '"';
|
|
26627
|
-
objectKey = objectKeyList[index];
|
|
26628
|
-
objectValue = object4[objectKey];
|
|
26629
|
-
if (state.replacer) {
|
|
26630
|
-
objectValue = state.replacer.call(object4, objectKey, objectValue);
|
|
26631
|
-
}
|
|
26632
|
-
if (!writeNode2(state, level, objectKey, false, false)) {
|
|
26633
|
-
continue;
|
|
26634
|
-
}
|
|
26635
|
-
if (state.dump.length > 1024)
|
|
26636
|
-
pairBuffer += "? ";
|
|
26637
|
-
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
26638
|
-
if (!writeNode2(state, level, objectValue, false, false)) {
|
|
26639
|
-
continue;
|
|
26640
|
-
}
|
|
26641
|
-
pairBuffer += state.dump;
|
|
26642
|
-
_result += pairBuffer;
|
|
26643
|
-
}
|
|
26644
|
-
state.tag = _tag;
|
|
26645
|
-
state.dump = "{" + _result + "}";
|
|
26646
|
-
}
|
|
26647
|
-
function writeBlockMapping2(state, level, object4, compact) {
|
|
26648
|
-
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object4), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
26649
|
-
if (state.sortKeys === true) {
|
|
26650
|
-
objectKeyList.sort();
|
|
26651
|
-
} else if (typeof state.sortKeys === "function") {
|
|
26652
|
-
objectKeyList.sort(state.sortKeys);
|
|
26653
|
-
} else if (state.sortKeys) {
|
|
26654
|
-
throw new exception2("sortKeys must be a boolean or a function");
|
|
26655
|
-
}
|
|
26656
|
-
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
26657
|
-
pairBuffer = "";
|
|
26658
|
-
if (!compact || _result !== "") {
|
|
26659
|
-
pairBuffer += generateNextLine2(state, level);
|
|
26660
|
-
}
|
|
26661
|
-
objectKey = objectKeyList[index];
|
|
26662
|
-
objectValue = object4[objectKey];
|
|
26663
|
-
if (state.replacer) {
|
|
26664
|
-
objectValue = state.replacer.call(object4, objectKey, objectValue);
|
|
26665
|
-
}
|
|
26666
|
-
if (!writeNode2(state, level + 1, objectKey, true, true, true)) {
|
|
26667
|
-
continue;
|
|
26668
|
-
}
|
|
26669
|
-
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
26670
|
-
if (explicitPair) {
|
|
26671
|
-
if (state.dump && CHAR_LINE_FEED2 === state.dump.charCodeAt(0)) {
|
|
26672
|
-
pairBuffer += "?";
|
|
26673
|
-
} else {
|
|
26674
|
-
pairBuffer += "? ";
|
|
26675
|
-
}
|
|
26676
|
-
}
|
|
26677
|
-
pairBuffer += state.dump;
|
|
26678
|
-
if (explicitPair) {
|
|
26679
|
-
pairBuffer += generateNextLine2(state, level);
|
|
26680
|
-
}
|
|
26681
|
-
if (!writeNode2(state, level + 1, objectValue, true, explicitPair)) {
|
|
26682
|
-
continue;
|
|
26683
|
-
}
|
|
26684
|
-
if (state.dump && CHAR_LINE_FEED2 === state.dump.charCodeAt(0)) {
|
|
26685
|
-
pairBuffer += ":";
|
|
26686
|
-
} else {
|
|
26687
|
-
pairBuffer += ": ";
|
|
26688
|
-
}
|
|
26689
|
-
pairBuffer += state.dump;
|
|
26690
|
-
_result += pairBuffer;
|
|
26691
|
-
}
|
|
26692
|
-
state.tag = _tag;
|
|
26693
|
-
state.dump = _result || "{}";
|
|
26694
|
-
}
|
|
26695
|
-
function detectType2(state, object4, explicit) {
|
|
26696
|
-
var _result, typeList, index, length, type3, style;
|
|
26697
|
-
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
26698
|
-
for (index = 0, length = typeList.length;index < length; index += 1) {
|
|
26699
|
-
type3 = typeList[index];
|
|
26700
|
-
if ((type3.instanceOf || type3.predicate) && (!type3.instanceOf || typeof object4 === "object" && object4 instanceof type3.instanceOf) && (!type3.predicate || type3.predicate(object4))) {
|
|
26701
|
-
if (explicit) {
|
|
26702
|
-
if (type3.multi && type3.representName) {
|
|
26703
|
-
state.tag = type3.representName(object4);
|
|
26704
|
-
} else {
|
|
26705
|
-
state.tag = type3.tag;
|
|
26706
|
-
}
|
|
26707
|
-
} else {
|
|
26708
|
-
state.tag = "?";
|
|
26709
|
-
}
|
|
26710
|
-
if (type3.represent) {
|
|
26711
|
-
style = state.styleMap[type3.tag] || type3.defaultStyle;
|
|
26712
|
-
if (_toString2.call(type3.represent) === "[object Function]") {
|
|
26713
|
-
_result = type3.represent(object4, style);
|
|
26714
|
-
} else if (_hasOwnProperty2.call(type3.represent, style)) {
|
|
26715
|
-
_result = type3.represent[style](object4, style);
|
|
26716
|
-
} else {
|
|
26717
|
-
throw new exception2("!<" + type3.tag + '> tag resolver accepts not "' + style + '" style');
|
|
26718
|
-
}
|
|
26719
|
-
state.dump = _result;
|
|
26720
|
-
}
|
|
26721
|
-
return true;
|
|
26722
|
-
}
|
|
26723
|
-
}
|
|
26724
|
-
return false;
|
|
26725
|
-
}
|
|
26726
|
-
function writeNode2(state, level, object4, block, compact, iskey, isblockseq) {
|
|
26727
|
-
state.tag = null;
|
|
26728
|
-
state.dump = object4;
|
|
26729
|
-
if (!detectType2(state, object4, false)) {
|
|
26730
|
-
detectType2(state, object4, true);
|
|
26731
|
-
}
|
|
26732
|
-
var type3 = _toString2.call(state.dump);
|
|
26733
|
-
var inblock = block;
|
|
26734
|
-
var tagStr;
|
|
26735
|
-
if (block) {
|
|
26736
|
-
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
26737
|
-
}
|
|
26738
|
-
var objectOrArray = type3 === "[object Object]" || type3 === "[object Array]", duplicateIndex, duplicate;
|
|
26739
|
-
if (objectOrArray) {
|
|
26740
|
-
duplicateIndex = state.duplicates.indexOf(object4);
|
|
26741
|
-
duplicate = duplicateIndex !== -1;
|
|
26742
|
-
}
|
|
26743
|
-
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
26744
|
-
compact = false;
|
|
26745
|
-
}
|
|
26746
|
-
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
26747
|
-
state.dump = "*ref_" + duplicateIndex;
|
|
26748
|
-
} else {
|
|
26749
|
-
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
26750
|
-
state.usedDuplicates[duplicateIndex] = true;
|
|
26751
|
-
}
|
|
26752
|
-
if (type3 === "[object Object]") {
|
|
26753
|
-
if (block && Object.keys(state.dump).length !== 0) {
|
|
26754
|
-
writeBlockMapping2(state, level, state.dump, compact);
|
|
26755
|
-
if (duplicate) {
|
|
26756
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
26757
|
-
}
|
|
26758
|
-
} else {
|
|
26759
|
-
writeFlowMapping2(state, level, state.dump);
|
|
26760
|
-
if (duplicate) {
|
|
26761
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
26762
|
-
}
|
|
26763
|
-
}
|
|
26764
|
-
} else if (type3 === "[object Array]") {
|
|
26765
|
-
if (block && state.dump.length !== 0) {
|
|
26766
|
-
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
26767
|
-
writeBlockSequence2(state, level - 1, state.dump, compact);
|
|
26768
|
-
} else {
|
|
26769
|
-
writeBlockSequence2(state, level, state.dump, compact);
|
|
26770
|
-
}
|
|
26771
|
-
if (duplicate) {
|
|
26772
|
-
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
26773
|
-
}
|
|
26774
|
-
} else {
|
|
26775
|
-
writeFlowSequence2(state, level, state.dump);
|
|
26776
|
-
if (duplicate) {
|
|
26777
|
-
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
26778
|
-
}
|
|
26779
|
-
}
|
|
26780
|
-
} else if (type3 === "[object String]") {
|
|
26781
|
-
if (state.tag !== "?") {
|
|
26782
|
-
writeScalar2(state, state.dump, level, iskey, inblock);
|
|
26783
|
-
}
|
|
26784
|
-
} else if (type3 === "[object Undefined]") {
|
|
26785
|
-
return false;
|
|
26786
|
-
} else {
|
|
26787
|
-
if (state.skipInvalid)
|
|
26788
|
-
return false;
|
|
26789
|
-
throw new exception2("unacceptable kind of an object to dump " + type3);
|
|
26790
|
-
}
|
|
26791
|
-
if (state.tag !== null && state.tag !== "?") {
|
|
26792
|
-
tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
26793
|
-
if (state.tag[0] === "!") {
|
|
26794
|
-
tagStr = "!" + tagStr;
|
|
26795
|
-
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
26796
|
-
tagStr = "!!" + tagStr.slice(18);
|
|
26797
|
-
} else {
|
|
26798
|
-
tagStr = "!<" + tagStr + ">";
|
|
26799
|
-
}
|
|
26800
|
-
state.dump = tagStr + " " + state.dump;
|
|
26801
|
-
}
|
|
26802
|
-
}
|
|
26803
|
-
return true;
|
|
26804
|
-
}
|
|
26805
|
-
function getDuplicateReferences2(object4, state) {
|
|
26806
|
-
var objects = [], duplicatesIndexes = [], index, length;
|
|
26807
|
-
inspectNode2(object4, objects, duplicatesIndexes);
|
|
26808
|
-
for (index = 0, length = duplicatesIndexes.length;index < length; index += 1) {
|
|
26809
|
-
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
26810
|
-
}
|
|
26811
|
-
state.usedDuplicates = new Array(length);
|
|
26812
|
-
}
|
|
26813
|
-
function inspectNode2(object4, objects, duplicatesIndexes) {
|
|
26814
|
-
var objectKeyList, index, length;
|
|
26815
|
-
if (object4 !== null && typeof object4 === "object") {
|
|
26816
|
-
index = objects.indexOf(object4);
|
|
26817
|
-
if (index !== -1) {
|
|
26818
|
-
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
26819
|
-
duplicatesIndexes.push(index);
|
|
26820
|
-
}
|
|
26821
|
-
} else {
|
|
26822
|
-
objects.push(object4);
|
|
26823
|
-
if (Array.isArray(object4)) {
|
|
26824
|
-
for (index = 0, length = object4.length;index < length; index += 1) {
|
|
26825
|
-
inspectNode2(object4[index], objects, duplicatesIndexes);
|
|
26826
|
-
}
|
|
26827
|
-
} else {
|
|
26828
|
-
objectKeyList = Object.keys(object4);
|
|
26829
|
-
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
26830
|
-
inspectNode2(object4[objectKeyList[index]], objects, duplicatesIndexes);
|
|
26831
|
-
}
|
|
26832
|
-
}
|
|
26833
|
-
}
|
|
26834
|
-
}
|
|
26835
|
-
}
|
|
26836
|
-
function dump$12(input, options) {
|
|
26837
|
-
options = options || {};
|
|
26838
|
-
var state = new State2(options);
|
|
26839
|
-
if (!state.noRefs)
|
|
26840
|
-
getDuplicateReferences2(input, state);
|
|
26841
|
-
var value = input;
|
|
26842
|
-
if (state.replacer) {
|
|
26843
|
-
value = state.replacer.call({ "": value }, "", value);
|
|
26844
|
-
}
|
|
26845
|
-
if (writeNode2(state, 0, value, true, true))
|
|
26846
|
-
return state.dump + `
|
|
26847
|
-
`;
|
|
26848
|
-
return "";
|
|
26849
|
-
}
|
|
26850
|
-
var dump_12 = dump$12;
|
|
26851
|
-
var dumper2 = {
|
|
26852
|
-
dump: dump_12
|
|
24215
|
+
var EMBEDDED_SQL = {
|
|
24216
|
+
express_version: `
|
|
24217
|
+
select
|
|
24218
|
+
name,
|
|
24219
|
+
setting
|
|
24220
|
+
from pg_settings
|
|
24221
|
+
where name in ('server_version', 'server_version_num');
|
|
24222
|
+
`,
|
|
24223
|
+
express_settings: `
|
|
24224
|
+
select
|
|
24225
|
+
name,
|
|
24226
|
+
setting,
|
|
24227
|
+
unit,
|
|
24228
|
+
category,
|
|
24229
|
+
context,
|
|
24230
|
+
vartype,
|
|
24231
|
+
case when (source <> 'default') then 0 else 1 end as is_default,
|
|
24232
|
+
case
|
|
24233
|
+
when unit = '8kB' then pg_size_pretty(setting::bigint * 8192)
|
|
24234
|
+
when unit = 'kB' then pg_size_pretty(setting::bigint * 1024)
|
|
24235
|
+
when unit = 'MB' then pg_size_pretty(setting::bigint * 1024 * 1024)
|
|
24236
|
+
when unit = 'B' then pg_size_pretty(setting::bigint)
|
|
24237
|
+
when unit = 'ms' then setting || ' ms'
|
|
24238
|
+
when unit = 's' then setting || ' s'
|
|
24239
|
+
when unit = 'min' then setting || ' min'
|
|
24240
|
+
else setting
|
|
24241
|
+
end as pretty_value
|
|
24242
|
+
from pg_settings
|
|
24243
|
+
order by name;
|
|
24244
|
+
`,
|
|
24245
|
+
express_altered_settings: `
|
|
24246
|
+
select
|
|
24247
|
+
name,
|
|
24248
|
+
setting,
|
|
24249
|
+
unit,
|
|
24250
|
+
category,
|
|
24251
|
+
case
|
|
24252
|
+
when unit = '8kB' then pg_size_pretty(setting::bigint * 8192)
|
|
24253
|
+
when unit = 'kB' then pg_size_pretty(setting::bigint * 1024)
|
|
24254
|
+
when unit = 'MB' then pg_size_pretty(setting::bigint * 1024 * 1024)
|
|
24255
|
+
when unit = 'B' then pg_size_pretty(setting::bigint)
|
|
24256
|
+
when unit = 'ms' then setting || ' ms'
|
|
24257
|
+
when unit = 's' then setting || ' s'
|
|
24258
|
+
when unit = 'min' then setting || ' min'
|
|
24259
|
+
else setting
|
|
24260
|
+
end as pretty_value
|
|
24261
|
+
from pg_settings
|
|
24262
|
+
where source <> 'default'
|
|
24263
|
+
order by name;
|
|
24264
|
+
`,
|
|
24265
|
+
express_database_sizes: `
|
|
24266
|
+
select
|
|
24267
|
+
datname,
|
|
24268
|
+
pg_database_size(datname) as size_bytes
|
|
24269
|
+
from pg_database
|
|
24270
|
+
where datistemplate = false
|
|
24271
|
+
order by size_bytes desc;
|
|
24272
|
+
`,
|
|
24273
|
+
express_cluster_stats: `
|
|
24274
|
+
select
|
|
24275
|
+
sum(numbackends) as total_connections,
|
|
24276
|
+
sum(xact_commit) as total_commits,
|
|
24277
|
+
sum(xact_rollback) as total_rollbacks,
|
|
24278
|
+
sum(blks_read) as blocks_read,
|
|
24279
|
+
sum(blks_hit) as blocks_hit,
|
|
24280
|
+
sum(tup_returned) as tuples_returned,
|
|
24281
|
+
sum(tup_fetched) as tuples_fetched,
|
|
24282
|
+
sum(tup_inserted) as tuples_inserted,
|
|
24283
|
+
sum(tup_updated) as tuples_updated,
|
|
24284
|
+
sum(tup_deleted) as tuples_deleted,
|
|
24285
|
+
sum(deadlocks) as total_deadlocks,
|
|
24286
|
+
sum(temp_files) as temp_files_created,
|
|
24287
|
+
sum(temp_bytes) as temp_bytes_written
|
|
24288
|
+
from pg_stat_database
|
|
24289
|
+
where datname is not null;
|
|
24290
|
+
`,
|
|
24291
|
+
express_connection_states: `
|
|
24292
|
+
select
|
|
24293
|
+
coalesce(state, 'null') as state,
|
|
24294
|
+
count(*) as count
|
|
24295
|
+
from pg_stat_activity
|
|
24296
|
+
group by state;
|
|
24297
|
+
`,
|
|
24298
|
+
express_uptime: `
|
|
24299
|
+
select
|
|
24300
|
+
pg_postmaster_start_time() as start_time,
|
|
24301
|
+
current_timestamp - pg_postmaster_start_time() as uptime;
|
|
24302
|
+
`,
|
|
24303
|
+
express_stats_reset: `
|
|
24304
|
+
select
|
|
24305
|
+
extract(epoch from stats_reset) as stats_reset_epoch,
|
|
24306
|
+
stats_reset::text as stats_reset_time,
|
|
24307
|
+
extract(day from (now() - stats_reset))::integer as days_since_reset,
|
|
24308
|
+
extract(epoch from pg_postmaster_start_time()) as postmaster_startup_epoch,
|
|
24309
|
+
pg_postmaster_start_time()::text as postmaster_startup_time
|
|
24310
|
+
from pg_stat_database
|
|
24311
|
+
where datname = current_database();
|
|
24312
|
+
`,
|
|
24313
|
+
express_current_database: `
|
|
24314
|
+
select
|
|
24315
|
+
current_database() as datname,
|
|
24316
|
+
pg_database_size(current_database()) as size_bytes;
|
|
24317
|
+
`,
|
|
24318
|
+
pg_invalid_indexes: `
|
|
24319
|
+
with fk_indexes as (
|
|
24320
|
+
select
|
|
24321
|
+
schemaname as tag_schema_name,
|
|
24322
|
+
(indexrelid::regclass)::text as tag_index_name,
|
|
24323
|
+
(relid::regclass)::text as tag_table_name,
|
|
24324
|
+
(confrelid::regclass)::text as tag_fk_table_ref,
|
|
24325
|
+
array_to_string(indclass, ', ') as tag_opclasses
|
|
24326
|
+
from
|
|
24327
|
+
pg_stat_all_indexes
|
|
24328
|
+
join pg_index using (indexrelid)
|
|
24329
|
+
left join pg_constraint
|
|
24330
|
+
on array_to_string(indkey, ',') = array_to_string(conkey, ',')
|
|
24331
|
+
and schemaname = (connamespace::regnamespace)::text
|
|
24332
|
+
and conrelid = relid
|
|
24333
|
+
and contype = 'f'
|
|
24334
|
+
where idx_scan = 0
|
|
24335
|
+
and indisunique is false
|
|
24336
|
+
and conkey is not null
|
|
24337
|
+
), data as (
|
|
24338
|
+
select
|
|
24339
|
+
pci.relname as tag_index_name,
|
|
24340
|
+
pn.nspname as tag_schema_name,
|
|
24341
|
+
pct.relname as tag_table_name,
|
|
24342
|
+
quote_ident(pn.nspname) as tag_schema_name,
|
|
24343
|
+
quote_ident(pci.relname) as tag_index_name,
|
|
24344
|
+
quote_ident(pct.relname) as tag_table_name,
|
|
24345
|
+
coalesce(nullif(quote_ident(pn.nspname), 'public') || '.', '') || quote_ident(pct.relname) as tag_relation_name,
|
|
24346
|
+
pg_relation_size(pidx.indexrelid) index_size_bytes,
|
|
24347
|
+
((
|
|
24348
|
+
select count(1)
|
|
24349
|
+
from fk_indexes fi
|
|
24350
|
+
where
|
|
24351
|
+
fi.tag_fk_table_ref = pct.relname
|
|
24352
|
+
and fi.tag_opclasses like (array_to_string(pidx.indclass, ', ') || '%')
|
|
24353
|
+
) > 0)::int as supports_fk
|
|
24354
|
+
from pg_index pidx
|
|
24355
|
+
join pg_class as pci on pci.oid = pidx.indexrelid
|
|
24356
|
+
join pg_class as pct on pct.oid = pidx.indrelid
|
|
24357
|
+
left join pg_namespace pn on pn.oid = pct.relnamespace
|
|
24358
|
+
where pidx.indisvalid = false
|
|
24359
|
+
), data_total as (
|
|
24360
|
+
select
|
|
24361
|
+
sum(index_size_bytes) as index_size_bytes_sum
|
|
24362
|
+
from data
|
|
24363
|
+
), num_data as (
|
|
24364
|
+
select
|
|
24365
|
+
row_number() over () num,
|
|
24366
|
+
data.*
|
|
24367
|
+
from data
|
|
24368
|
+
)
|
|
24369
|
+
select
|
|
24370
|
+
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
|
|
24371
|
+
current_database() as tag_datname,
|
|
24372
|
+
num_data.*
|
|
24373
|
+
from num_data
|
|
24374
|
+
limit 1000;
|
|
24375
|
+
`,
|
|
24376
|
+
unused_indexes: `
|
|
24377
|
+
with fk_indexes as (
|
|
24378
|
+
select
|
|
24379
|
+
n.nspname as schema_name,
|
|
24380
|
+
ci.relname as index_name,
|
|
24381
|
+
cr.relname as table_name,
|
|
24382
|
+
(confrelid::regclass)::text as fk_table_ref,
|
|
24383
|
+
array_to_string(indclass, ', ') as opclasses
|
|
24384
|
+
from pg_index i
|
|
24385
|
+
join pg_class ci on ci.oid = i.indexrelid and ci.relkind = 'i'
|
|
24386
|
+
join pg_class cr on cr.oid = i.indrelid and cr.relkind = 'r'
|
|
24387
|
+
join pg_namespace n on n.oid = ci.relnamespace
|
|
24388
|
+
join pg_constraint cn on cn.conrelid = cr.oid
|
|
24389
|
+
left join pg_stat_all_indexes as si on si.indexrelid = i.indexrelid
|
|
24390
|
+
where
|
|
24391
|
+
contype = 'f'
|
|
24392
|
+
and i.indisunique is false
|
|
24393
|
+
and conkey is not null
|
|
24394
|
+
and ci.relpages > 5
|
|
24395
|
+
and si.idx_scan < 10
|
|
24396
|
+
), table_scans as (
|
|
24397
|
+
select relid,
|
|
24398
|
+
tables.idx_scan + tables.seq_scan as all_scans,
|
|
24399
|
+
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
|
|
24400
|
+
pg_relation_size(relid) as table_size
|
|
24401
|
+
from pg_stat_all_tables as tables
|
|
24402
|
+
join pg_class c on c.oid = relid
|
|
24403
|
+
where c.relpages > 5
|
|
24404
|
+
), indexes as (
|
|
24405
|
+
select
|
|
24406
|
+
i.indrelid,
|
|
24407
|
+
i.indexrelid,
|
|
24408
|
+
n.nspname as schema_name,
|
|
24409
|
+
cr.relname as table_name,
|
|
24410
|
+
ci.relname as index_name,
|
|
24411
|
+
si.idx_scan,
|
|
24412
|
+
pg_relation_size(i.indexrelid) as index_bytes,
|
|
24413
|
+
ci.relpages,
|
|
24414
|
+
(case when a.amname = 'btree' then true else false end) as idx_is_btree,
|
|
24415
|
+
array_to_string(i.indclass, ', ') as opclasses
|
|
24416
|
+
from pg_index i
|
|
24417
|
+
join pg_class ci on ci.oid = i.indexrelid and ci.relkind = 'i'
|
|
24418
|
+
join pg_class cr on cr.oid = i.indrelid and cr.relkind = 'r'
|
|
24419
|
+
join pg_namespace n on n.oid = ci.relnamespace
|
|
24420
|
+
join pg_am a on ci.relam = a.oid
|
|
24421
|
+
left join pg_stat_all_indexes as si on si.indexrelid = i.indexrelid
|
|
24422
|
+
where
|
|
24423
|
+
i.indisunique = false
|
|
24424
|
+
and i.indisvalid = true
|
|
24425
|
+
and ci.relpages > 5
|
|
24426
|
+
), index_ratios as (
|
|
24427
|
+
select
|
|
24428
|
+
i.indexrelid as index_id,
|
|
24429
|
+
i.schema_name,
|
|
24430
|
+
i.table_name,
|
|
24431
|
+
i.index_name,
|
|
24432
|
+
idx_scan,
|
|
24433
|
+
all_scans,
|
|
24434
|
+
round(( case when all_scans = 0 then 0.0::numeric
|
|
24435
|
+
else idx_scan::numeric/all_scans * 100 end), 2) as index_scan_pct,
|
|
24436
|
+
writes,
|
|
24437
|
+
round((case when writes = 0 then idx_scan::numeric else idx_scan::numeric/writes end), 2)
|
|
24438
|
+
as scans_per_write,
|
|
24439
|
+
index_bytes as index_size_bytes,
|
|
24440
|
+
table_size as table_size_bytes,
|
|
24441
|
+
i.relpages,
|
|
24442
|
+
idx_is_btree,
|
|
24443
|
+
i.opclasses,
|
|
24444
|
+
(
|
|
24445
|
+
select count(1)
|
|
24446
|
+
from fk_indexes fi
|
|
24447
|
+
where fi.fk_table_ref = i.table_name
|
|
24448
|
+
and fi.schema_name = i.schema_name
|
|
24449
|
+
and fi.opclasses like (i.opclasses || '%')
|
|
24450
|
+
) > 0 as supports_fk
|
|
24451
|
+
from indexes i
|
|
24452
|
+
join table_scans ts on ts.relid = i.indrelid
|
|
24453
|
+
)
|
|
24454
|
+
select
|
|
24455
|
+
'Never Used Indexes' as tag_reason,
|
|
24456
|
+
current_database() as tag_datname,
|
|
24457
|
+
index_id,
|
|
24458
|
+
schema_name as tag_schema_name,
|
|
24459
|
+
table_name as tag_table_name,
|
|
24460
|
+
index_name as tag_index_name,
|
|
24461
|
+
pg_get_indexdef(index_id) as index_definition,
|
|
24462
|
+
idx_scan,
|
|
24463
|
+
all_scans,
|
|
24464
|
+
index_scan_pct,
|
|
24465
|
+
writes,
|
|
24466
|
+
scans_per_write,
|
|
24467
|
+
index_size_bytes,
|
|
24468
|
+
table_size_bytes,
|
|
24469
|
+
relpages,
|
|
24470
|
+
idx_is_btree,
|
|
24471
|
+
opclasses as tag_opclasses,
|
|
24472
|
+
supports_fk
|
|
24473
|
+
from index_ratios
|
|
24474
|
+
where
|
|
24475
|
+
idx_scan = 0
|
|
24476
|
+
and idx_is_btree
|
|
24477
|
+
order by index_size_bytes desc
|
|
24478
|
+
limit 1000;
|
|
24479
|
+
`,
|
|
24480
|
+
redundant_indexes: `
|
|
24481
|
+
with fk_indexes as (
|
|
24482
|
+
select
|
|
24483
|
+
n.nspname as schema_name,
|
|
24484
|
+
ci.relname as index_name,
|
|
24485
|
+
cr.relname as table_name,
|
|
24486
|
+
(confrelid::regclass)::text as fk_table_ref,
|
|
24487
|
+
array_to_string(indclass, ', ') as opclasses
|
|
24488
|
+
from pg_index i
|
|
24489
|
+
join pg_class ci on ci.oid = i.indexrelid and ci.relkind = 'i'
|
|
24490
|
+
join pg_class cr on cr.oid = i.indrelid and cr.relkind = 'r'
|
|
24491
|
+
join pg_namespace n on n.oid = ci.relnamespace
|
|
24492
|
+
join pg_constraint cn on cn.conrelid = cr.oid
|
|
24493
|
+
left join pg_stat_all_indexes as si on si.indexrelid = i.indexrelid
|
|
24494
|
+
where
|
|
24495
|
+
contype = 'f'
|
|
24496
|
+
and i.indisunique is false
|
|
24497
|
+
and conkey is not null
|
|
24498
|
+
and ci.relpages > 5
|
|
24499
|
+
and si.idx_scan < 10
|
|
24500
|
+
),
|
|
24501
|
+
index_data as (
|
|
24502
|
+
select
|
|
24503
|
+
*,
|
|
24504
|
+
indkey::text as columns,
|
|
24505
|
+
array_to_string(indclass, ', ') as opclasses
|
|
24506
|
+
from pg_index i
|
|
24507
|
+
join pg_class ci on ci.oid = i.indexrelid and ci.relkind = 'i'
|
|
24508
|
+
where indisvalid = true and ci.relpages > 5
|
|
24509
|
+
), redundant_indexes as (
|
|
24510
|
+
select
|
|
24511
|
+
i2.indexrelid as index_id,
|
|
24512
|
+
tnsp.nspname as schema_name,
|
|
24513
|
+
trel.relname as table_name,
|
|
24514
|
+
pg_relation_size(trel.oid) as table_size_bytes,
|
|
24515
|
+
irel.relname as index_name,
|
|
24516
|
+
am1.amname as access_method,
|
|
24517
|
+
(i1.indexrelid::regclass)::text as reason,
|
|
24518
|
+
i1.indexrelid as reason_index_id,
|
|
24519
|
+
pg_get_indexdef(i1.indexrelid) main_index_def,
|
|
24520
|
+
pg_size_pretty(pg_relation_size(i1.indexrelid)) main_index_size,
|
|
24521
|
+
pg_get_indexdef(i2.indexrelid) index_def,
|
|
24522
|
+
pg_relation_size(i2.indexrelid) index_size_bytes,
|
|
24523
|
+
s.idx_scan as index_usage,
|
|
24524
|
+
quote_ident(tnsp.nspname) as formated_schema_name,
|
|
24525
|
+
coalesce(nullif(quote_ident(tnsp.nspname), 'public') || '.', '') || quote_ident(irel.relname) as formated_index_name,
|
|
24526
|
+
quote_ident(trel.relname) as formated_table_name,
|
|
24527
|
+
coalesce(nullif(quote_ident(tnsp.nspname), 'public') || '.', '') || quote_ident(trel.relname) as formated_relation_name,
|
|
24528
|
+
i2.opclasses
|
|
24529
|
+
from (
|
|
24530
|
+
select indrelid, indexrelid, opclasses, indclass, indexprs, indpred, indisprimary, indisunique, columns
|
|
24531
|
+
from index_data
|
|
24532
|
+
order by indexrelid
|
|
24533
|
+
) as i1
|
|
24534
|
+
join index_data as i2 on (
|
|
24535
|
+
i1.indrelid = i2.indrelid
|
|
24536
|
+
and i1.indexrelid <> i2.indexrelid
|
|
24537
|
+
)
|
|
24538
|
+
inner join pg_opclass op1 on i1.indclass[0] = op1.oid
|
|
24539
|
+
inner join pg_opclass op2 on i2.indclass[0] = op2.oid
|
|
24540
|
+
inner join pg_am am1 on op1.opcmethod = am1.oid
|
|
24541
|
+
inner join pg_am am2 on op2.opcmethod = am2.oid
|
|
24542
|
+
join pg_stat_all_indexes as s on s.indexrelid = i2.indexrelid
|
|
24543
|
+
join pg_class as trel on trel.oid = i2.indrelid
|
|
24544
|
+
join pg_namespace as tnsp on trel.relnamespace = tnsp.oid
|
|
24545
|
+
join pg_class as irel on irel.oid = i2.indexrelid
|
|
24546
|
+
where
|
|
24547
|
+
not i2.indisprimary
|
|
24548
|
+
and not i2.indisunique
|
|
24549
|
+
and am1.amname = am2.amname
|
|
24550
|
+
and i1.columns like (i2.columns || '%')
|
|
24551
|
+
and i1.opclasses like (i2.opclasses || '%')
|
|
24552
|
+
and pg_get_expr(i1.indexprs, i1.indrelid) is not distinct from pg_get_expr(i2.indexprs, i2.indrelid)
|
|
24553
|
+
and pg_get_expr(i1.indpred, i1.indrelid) is not distinct from pg_get_expr(i2.indpred, i2.indrelid)
|
|
24554
|
+
), redundant_indexes_fk as (
|
|
24555
|
+
select
|
|
24556
|
+
ri.*,
|
|
24557
|
+
((
|
|
24558
|
+
select count(1)
|
|
24559
|
+
from fk_indexes fi
|
|
24560
|
+
where
|
|
24561
|
+
fi.fk_table_ref = ri.table_name
|
|
24562
|
+
and fi.opclasses like (ri.opclasses || '%')
|
|
24563
|
+
) > 0)::int as supports_fk
|
|
24564
|
+
from redundant_indexes ri
|
|
24565
|
+
),
|
|
24566
|
+
redundant_indexes_tmp_num as (
|
|
24567
|
+
select row_number() over () num, rig.*
|
|
24568
|
+
from redundant_indexes_fk rig
|
|
24569
|
+
), redundant_indexes_tmp_links as (
|
|
24570
|
+
select
|
|
24571
|
+
ri1.*,
|
|
24572
|
+
ri2.num as r_num
|
|
24573
|
+
from redundant_indexes_tmp_num ri1
|
|
24574
|
+
left join redundant_indexes_tmp_num ri2 on ri2.reason_index_id = ri1.index_id and ri1.reason_index_id = ri2.index_id
|
|
24575
|
+
), redundant_indexes_tmp_cut as (
|
|
24576
|
+
select
|
|
24577
|
+
*
|
|
24578
|
+
from redundant_indexes_tmp_links
|
|
24579
|
+
where num < r_num or r_num is null
|
|
24580
|
+
), redundant_indexes_cut_grouped as (
|
|
24581
|
+
select
|
|
24582
|
+
distinct(num),
|
|
24583
|
+
*
|
|
24584
|
+
from redundant_indexes_tmp_cut
|
|
24585
|
+
order by index_size_bytes desc
|
|
24586
|
+
), redundant_indexes_grouped as (
|
|
24587
|
+
select
|
|
24588
|
+
index_id,
|
|
24589
|
+
schema_name as tag_schema_name,
|
|
24590
|
+
table_name,
|
|
24591
|
+
table_size_bytes,
|
|
24592
|
+
index_name as tag_index_name,
|
|
24593
|
+
access_method as tag_access_method,
|
|
24594
|
+
string_agg(distinct reason, ', ') as tag_reason,
|
|
24595
|
+
index_size_bytes,
|
|
24596
|
+
index_usage,
|
|
24597
|
+
index_def as index_definition,
|
|
24598
|
+
formated_index_name as tag_index_name,
|
|
24599
|
+
formated_schema_name as tag_schema_name,
|
|
24600
|
+
formated_table_name as tag_table_name,
|
|
24601
|
+
formated_relation_name as tag_relation_name,
|
|
24602
|
+
supports_fk::int as supports_fk
|
|
24603
|
+
from redundant_indexes_cut_grouped
|
|
24604
|
+
group by
|
|
24605
|
+
index_id,
|
|
24606
|
+
table_size_bytes,
|
|
24607
|
+
schema_name,
|
|
24608
|
+
table_name,
|
|
24609
|
+
index_name,
|
|
24610
|
+
access_method,
|
|
24611
|
+
index_def,
|
|
24612
|
+
index_size_bytes,
|
|
24613
|
+
index_usage,
|
|
24614
|
+
formated_index_name,
|
|
24615
|
+
formated_schema_name,
|
|
24616
|
+
formated_table_name,
|
|
24617
|
+
formated_relation_name,
|
|
24618
|
+
supports_fk
|
|
24619
|
+
order by index_size_bytes desc
|
|
24620
|
+
)
|
|
24621
|
+
select * from redundant_indexes_grouped
|
|
24622
|
+
limit 1000;
|
|
24623
|
+
`
|
|
26853
24624
|
};
|
|
26854
|
-
function
|
|
26855
|
-
|
|
26856
|
-
|
|
26857
|
-
|
|
26858
|
-
}
|
|
26859
|
-
var load2 = loader2.load;
|
|
26860
|
-
var loadAll2 = loader2.loadAll;
|
|
26861
|
-
var dump2 = dumper2.dump;
|
|
26862
|
-
var safeLoad2 = renamed2("safeLoad", "load");
|
|
26863
|
-
var safeLoadAll2 = renamed2("safeLoadAll", "loadAll");
|
|
26864
|
-
var safeDump2 = renamed2("safeDump", "dump");
|
|
26865
|
-
|
|
26866
|
-
// lib/metrics-loader.ts
|
|
26867
|
-
var __dirname = "/builds/postgres-ai/postgres_ai/cli/lib";
|
|
26868
|
-
function getMetricsYmlPath() {
|
|
26869
|
-
const currentDir = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
|
26870
|
-
const possiblePaths = [
|
|
26871
|
-
resolve4(currentDir, "../../config/pgwatch-prometheus/metrics.yml"),
|
|
26872
|
-
resolve4(currentDir, "../../../config/pgwatch-prometheus/metrics.yml"),
|
|
26873
|
-
resolve4(currentDir, "../../../../config/pgwatch-prometheus/metrics.yml")
|
|
26874
|
-
];
|
|
26875
|
-
for (const path4 of possiblePaths) {
|
|
26876
|
-
try {
|
|
26877
|
-
readFileSync4(path4);
|
|
26878
|
-
return path4;
|
|
26879
|
-
} catch {}
|
|
26880
|
-
}
|
|
26881
|
-
throw new Error(`Cannot find metrics.yml. Tried: ${possiblePaths.join(", ")}`);
|
|
26882
|
-
}
|
|
26883
|
-
var cachedMetrics = null;
|
|
26884
|
-
function loadMetricsYml() {
|
|
26885
|
-
if (cachedMetrics) {
|
|
26886
|
-
return cachedMetrics;
|
|
26887
|
-
}
|
|
26888
|
-
const metricsPath = getMetricsYmlPath();
|
|
26889
|
-
const content = readFileSync4(metricsPath, "utf8");
|
|
26890
|
-
cachedMetrics = load2(content);
|
|
26891
|
-
return cachedMetrics;
|
|
26892
|
-
}
|
|
26893
|
-
function getMetricSql(metricName, pgMajorVersion = 16) {
|
|
26894
|
-
const root = loadMetricsYml();
|
|
26895
|
-
const metric = root.metrics[metricName];
|
|
26896
|
-
if (!metric) {
|
|
26897
|
-
throw new Error(`Metric "${metricName}" not found in metrics.yml`);
|
|
26898
|
-
}
|
|
26899
|
-
if (!metric.sqls) {
|
|
26900
|
-
throw new Error(`Metric "${metricName}" has no SQL queries defined`);
|
|
26901
|
-
}
|
|
26902
|
-
const versions2 = Object.keys(metric.sqls).map(Number).filter((v) => !isNaN(v)).sort((a, b) => b - a);
|
|
26903
|
-
for (const version3 of versions2) {
|
|
26904
|
-
if (version3 <= pgMajorVersion) {
|
|
26905
|
-
return metric.sqls[version3.toString()];
|
|
26906
|
-
}
|
|
24625
|
+
function getMetricSql(metricName, _pgMajorVersion = 16) {
|
|
24626
|
+
const sql = EMBEDDED_SQL[metricName];
|
|
24627
|
+
if (!sql) {
|
|
24628
|
+
throw new Error(`Metric "${metricName}" not found. Available metrics: ${Object.keys(EMBEDDED_SQL).join(", ")}`);
|
|
26907
24629
|
}
|
|
26908
|
-
|
|
26909
|
-
if (lowestVersion !== undefined) {
|
|
26910
|
-
return metric.sqls[lowestVersion.toString()];
|
|
26911
|
-
}
|
|
26912
|
-
throw new Error(`No SQL query found for metric "${metricName}"`);
|
|
24630
|
+
return sql;
|
|
26913
24631
|
}
|
|
26914
24632
|
var METRIC_NAMES = {
|
|
26915
24633
|
H001: "pg_invalid_indexes",
|
|
@@ -26957,8 +24675,8 @@ function formatBytes(bytes) {
|
|
|
26957
24675
|
if (bytes === 0)
|
|
26958
24676
|
return "0 B";
|
|
26959
24677
|
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
|
26960
|
-
const
|
|
26961
|
-
return `${(bytes / Math.pow(1024,
|
|
24678
|
+
const i2 = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
24679
|
+
return `${(bytes / Math.pow(1024, i2)).toFixed(2)} ${units[i2]}`;
|
|
26962
24680
|
}
|
|
26963
24681
|
async function getPostgresVersion(client) {
|
|
26964
24682
|
const sql = getMetricSql(METRIC_NAMES.version);
|
|
@@ -27684,7 +25402,7 @@ async function postRpc(params) {
|
|
|
27684
25402
|
"Content-Type": "application/json",
|
|
27685
25403
|
"Content-Length": Buffer.byteLength(body).toString()
|
|
27686
25404
|
};
|
|
27687
|
-
return new Promise((
|
|
25405
|
+
return new Promise((resolve5, reject) => {
|
|
27688
25406
|
const req = https.request(url, {
|
|
27689
25407
|
method: "POST",
|
|
27690
25408
|
headers
|
|
@@ -27695,7 +25413,7 @@ async function postRpc(params) {
|
|
|
27695
25413
|
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
|
|
27696
25414
|
try {
|
|
27697
25415
|
const parsed = JSON.parse(data);
|
|
27698
|
-
|
|
25416
|
+
resolve5(unwrapRpcResponse(parsed));
|
|
27699
25417
|
} catch {
|
|
27700
25418
|
reject(new Error(`Failed to parse RPC response: ${data}`));
|
|
27701
25419
|
}
|
|
@@ -27777,27 +25495,27 @@ function closeReadline() {
|
|
|
27777
25495
|
}
|
|
27778
25496
|
}
|
|
27779
25497
|
async function execPromise(command) {
|
|
27780
|
-
return new Promise((
|
|
25498
|
+
return new Promise((resolve6, reject) => {
|
|
27781
25499
|
childProcess.exec(command, (error2, stdout, stderr) => {
|
|
27782
25500
|
if (error2) {
|
|
27783
25501
|
const err = error2;
|
|
27784
25502
|
err.code = error2.code ?? 1;
|
|
27785
25503
|
reject(err);
|
|
27786
25504
|
} else {
|
|
27787
|
-
|
|
25505
|
+
resolve6({ stdout, stderr });
|
|
27788
25506
|
}
|
|
27789
25507
|
});
|
|
27790
25508
|
});
|
|
27791
25509
|
}
|
|
27792
25510
|
async function execFilePromise(file, args) {
|
|
27793
|
-
return new Promise((
|
|
25511
|
+
return new Promise((resolve6, reject) => {
|
|
27794
25512
|
childProcess.execFile(file, args, (error2, stdout, stderr) => {
|
|
27795
25513
|
if (error2) {
|
|
27796
25514
|
const err = error2;
|
|
27797
25515
|
err.code = error2.code ?? 1;
|
|
27798
25516
|
reject(err);
|
|
27799
25517
|
} else {
|
|
27800
|
-
|
|
25518
|
+
resolve6({ stdout, stderr });
|
|
27801
25519
|
}
|
|
27802
25520
|
});
|
|
27803
25521
|
});
|
|
@@ -27838,9 +25556,9 @@ function spawn2(cmd, args, options) {
|
|
|
27838
25556
|
};
|
|
27839
25557
|
}
|
|
27840
25558
|
async function question(prompt) {
|
|
27841
|
-
return new Promise((
|
|
25559
|
+
return new Promise((resolve6) => {
|
|
27842
25560
|
getReadline().question(prompt, (answer) => {
|
|
27843
|
-
|
|
25561
|
+
resolve6(answer);
|
|
27844
25562
|
});
|
|
27845
25563
|
});
|
|
27846
25564
|
}
|
|
@@ -27974,14 +25692,14 @@ function getConfig(opts) {
|
|
|
27974
25692
|
}
|
|
27975
25693
|
return { apiKey };
|
|
27976
25694
|
}
|
|
27977
|
-
function printResult(result,
|
|
25695
|
+
function printResult(result, json2) {
|
|
27978
25696
|
if (typeof result === "string") {
|
|
27979
25697
|
process.stdout.write(result);
|
|
27980
25698
|
if (!/\n$/.test(result))
|
|
27981
25699
|
console.log();
|
|
27982
25700
|
return;
|
|
27983
25701
|
}
|
|
27984
|
-
if (
|
|
25702
|
+
if (json2 || !process.stdout.isTTY) {
|
|
27985
25703
|
console.log(JSON.stringify(result, null, 2));
|
|
27986
25704
|
} else {
|
|
27987
25705
|
let text = dump(result);
|
|
@@ -28553,13 +26271,13 @@ async function runCompose(args) {
|
|
|
28553
26271
|
}
|
|
28554
26272
|
} catch (err) {}
|
|
28555
26273
|
}
|
|
28556
|
-
return new Promise((
|
|
26274
|
+
return new Promise((resolve6) => {
|
|
28557
26275
|
const child = spawn2(cmd[0], [...cmd.slice(1), "-f", composeFile, ...args], {
|
|
28558
26276
|
stdio: "inherit",
|
|
28559
26277
|
env,
|
|
28560
26278
|
cwd: projectDir
|
|
28561
26279
|
});
|
|
28562
|
-
child.on("close", (code) =>
|
|
26280
|
+
child.on("close", (code) => resolve6(code || 0));
|
|
28563
26281
|
});
|
|
28564
26282
|
}
|
|
28565
26283
|
program2.command("help", { isDefault: true }).description("show help").action(() => {
|
|
@@ -28949,7 +26667,7 @@ mon.command("health").description("health check for monitoring services").option
|
|
|
28949
26667
|
if (attempt > 1) {
|
|
28950
26668
|
console.log(`Retrying (attempt ${attempt}/${maxAttempts})...
|
|
28951
26669
|
`);
|
|
28952
|
-
await new Promise((
|
|
26670
|
+
await new Promise((resolve6) => setTimeout(resolve6, 5000));
|
|
28953
26671
|
}
|
|
28954
26672
|
allHealthy = true;
|
|
28955
26673
|
for (const service of services) {
|
|
@@ -29334,7 +27052,7 @@ auth.command("login", { isDefault: true }).description("authenticate via browser
|
|
|
29334
27052
|
console.log("Starting local callback server...");
|
|
29335
27053
|
const requestedPort = opts.port || 0;
|
|
29336
27054
|
const callbackServer = createCallbackServer(requestedPort, params.state, 120000);
|
|
29337
|
-
await new Promise((
|
|
27055
|
+
await new Promise((resolve6) => setTimeout(resolve6, 100));
|
|
29338
27056
|
const actualPort = callbackServer.getPort();
|
|
29339
27057
|
const redirectUri = `http://localhost:${actualPort}/callback`;
|
|
29340
27058
|
console.log(`Callback server listening on port ${actualPort}`);
|
|
@@ -29618,8 +27336,8 @@ Grafana credentials:`);
|
|
|
29618
27336
|
console.log(` Password: ${password}`);
|
|
29619
27337
|
console.log("");
|
|
29620
27338
|
});
|
|
29621
|
-
function interpretEscapes(
|
|
29622
|
-
return
|
|
27339
|
+
function interpretEscapes(str2) {
|
|
27340
|
+
return str2.replace(/\\\\/g, "\x00").replace(/\\n/g, `
|
|
29623
27341
|
`).replace(/\\t/g, "\t").replace(/\\r/g, "\r").replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\x00/g, "\\");
|
|
29624
27342
|
}
|
|
29625
27343
|
var issues = program2.command("issues").description("issues management");
|