core-outline 1.1.30 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +42 -27
- package/dist/index.js +42 -27
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -4478,33 +4478,32 @@ function _doAuthorize2() {
|
|
|
4478
4478
|
});
|
|
4479
4479
|
case 3:
|
|
4480
4480
|
res = _context2.sent;
|
|
4481
|
-
console.log("Auth here: ", res);
|
|
4482
4481
|
if (res.ok) {
|
|
4483
|
-
_context2.next =
|
|
4482
|
+
_context2.next = 7;
|
|
4484
4483
|
break;
|
|
4485
4484
|
}
|
|
4486
4485
|
console.error('[CoreOutline] Authorization failed:', res.status);
|
|
4487
4486
|
return _context2.abrupt("return", false);
|
|
4488
|
-
case
|
|
4489
|
-
_context2.next =
|
|
4487
|
+
case 7:
|
|
4488
|
+
_context2.next = 9;
|
|
4490
4489
|
return res.json();
|
|
4491
|
-
case
|
|
4490
|
+
case 9:
|
|
4492
4491
|
data = _context2.sent;
|
|
4493
4492
|
_token = data.access_token;
|
|
4494
4493
|
_organizationId = data.organization_id;
|
|
4495
4494
|
expiresIn = data.expires_in || 24 * 3600;
|
|
4496
4495
|
_scheduleTokenRefresh(expiresIn);
|
|
4497
4496
|
return _context2.abrupt("return", true);
|
|
4498
|
-
case
|
|
4499
|
-
_context2.prev =
|
|
4497
|
+
case 17:
|
|
4498
|
+
_context2.prev = 17;
|
|
4500
4499
|
_context2.t0 = _context2["catch"](0);
|
|
4501
4500
|
console.error('[CoreOutline] Authorization error:', _context2.t0);
|
|
4502
4501
|
return _context2.abrupt("return", false);
|
|
4503
|
-
case
|
|
4502
|
+
case 21:
|
|
4504
4503
|
case "end":
|
|
4505
4504
|
return _context2.stop();
|
|
4506
4505
|
}
|
|
4507
|
-
}, _callee2, null, [[0,
|
|
4506
|
+
}, _callee2, null, [[0, 17]]);
|
|
4508
4507
|
}));
|
|
4509
4508
|
return _doAuthorize2.apply(this, arguments);
|
|
4510
4509
|
}
|
|
@@ -4536,13 +4535,19 @@ function _ensureFreshToken2() {
|
|
|
4536
4535
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4537
4536
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4538
4537
|
case 0:
|
|
4538
|
+
if (!_token) {
|
|
4539
|
+
_context4.next = 2;
|
|
4540
|
+
break;
|
|
4541
|
+
}
|
|
4542
|
+
return _context4.abrupt("return");
|
|
4543
|
+
case 2:
|
|
4539
4544
|
if (!(_warehouseId && _dataSourceId && _dataSourceSecret)) {
|
|
4540
|
-
_context4.next =
|
|
4545
|
+
_context4.next = 5;
|
|
4541
4546
|
break;
|
|
4542
4547
|
}
|
|
4543
|
-
_context4.next =
|
|
4548
|
+
_context4.next = 5;
|
|
4544
4549
|
return _doAuthorize(_warehouseId, _dataSourceId, _dataSourceSecret);
|
|
4545
|
-
case
|
|
4550
|
+
case 5:
|
|
4546
4551
|
case "end":
|
|
4547
4552
|
return _context4.stop();
|
|
4548
4553
|
}
|
|
@@ -4551,12 +4556,12 @@ function _ensureFreshToken2() {
|
|
|
4551
4556
|
return _ensureFreshToken2.apply(this, arguments);
|
|
4552
4557
|
}
|
|
4553
4558
|
function trackEvent(eventType, payload) {
|
|
4554
|
-
|
|
4555
|
-
|
|
4559
|
+
if (!_token) return;
|
|
4556
4560
|
var event = _objectSpread2({
|
|
4557
4561
|
event_id: v4(),
|
|
4558
4562
|
event_type: eventType,
|
|
4559
|
-
event_ts: new Date().toISOString()
|
|
4563
|
+
event_ts: new Date().toISOString(),
|
|
4564
|
+
account_id: _dataSourceId
|
|
4560
4565
|
}, payload);
|
|
4561
4566
|
_buffer.push(event);
|
|
4562
4567
|
if (!_flushInterval) {
|
|
@@ -4575,7 +4580,12 @@ function _flush() {
|
|
|
4575
4580
|
_context5.next = 2;
|
|
4576
4581
|
return _ensureFreshToken();
|
|
4577
4582
|
case 2:
|
|
4578
|
-
|
|
4583
|
+
if (!(!_token || _buffer.length === 0)) {
|
|
4584
|
+
_context5.next = 4;
|
|
4585
|
+
break;
|
|
4586
|
+
}
|
|
4587
|
+
return _context5.abrupt("return");
|
|
4588
|
+
case 4:
|
|
4579
4589
|
console.log(_token);
|
|
4580
4590
|
events = _buffer.splice(0, _buffer.length);
|
|
4581
4591
|
body = JSON.stringify({
|
|
@@ -4595,7 +4605,7 @@ function _flush() {
|
|
|
4595
4605
|
})["catch"](function (err) {
|
|
4596
4606
|
return console.error('[CoreOutline] Flush error:', err);
|
|
4597
4607
|
});
|
|
4598
|
-
case
|
|
4608
|
+
case 9:
|
|
4599
4609
|
case "end":
|
|
4600
4610
|
return _context5.stop();
|
|
4601
4611
|
}
|
|
@@ -4614,11 +4624,16 @@ function _sendRrwebBatch() {
|
|
|
4614
4624
|
_context6.next = 2;
|
|
4615
4625
|
return _ensureFreshToken();
|
|
4616
4626
|
case 2:
|
|
4617
|
-
|
|
4627
|
+
if (!(!_token || !chunks || chunks.length === 0)) {
|
|
4628
|
+
_context6.next = 4;
|
|
4629
|
+
break;
|
|
4630
|
+
}
|
|
4631
|
+
return _context6.abrupt("return");
|
|
4632
|
+
case 4:
|
|
4618
4633
|
console.log(_token);
|
|
4619
4634
|
console.log("RRWeb here: ", chunks);
|
|
4620
|
-
_context6.prev =
|
|
4621
|
-
_context6.next =
|
|
4635
|
+
_context6.prev = 6;
|
|
4636
|
+
_context6.next = 9;
|
|
4622
4637
|
return fetch("".concat(INGEST_BASE, "/api/ingest/rrweb"), {
|
|
4623
4638
|
method: 'POST',
|
|
4624
4639
|
headers: {
|
|
@@ -4634,18 +4649,18 @@ function _sendRrwebBatch() {
|
|
|
4634
4649
|
}),
|
|
4635
4650
|
keepalive: true
|
|
4636
4651
|
});
|
|
4637
|
-
case 7:
|
|
4638
|
-
_context6.next = 12;
|
|
4639
|
-
break;
|
|
4640
4652
|
case 9:
|
|
4641
|
-
_context6.
|
|
4642
|
-
|
|
4653
|
+
_context6.next = 14;
|
|
4654
|
+
break;
|
|
4655
|
+
case 11:
|
|
4656
|
+
_context6.prev = 11;
|
|
4657
|
+
_context6.t0 = _context6["catch"](6);
|
|
4643
4658
|
console.error('[CoreOutline] rrweb upload error:', _context6.t0);
|
|
4644
|
-
case
|
|
4659
|
+
case 14:
|
|
4645
4660
|
case "end":
|
|
4646
4661
|
return _context6.stop();
|
|
4647
4662
|
}
|
|
4648
|
-
}, _callee6, null, [[
|
|
4663
|
+
}, _callee6, null, [[6, 11]]);
|
|
4649
4664
|
}));
|
|
4650
4665
|
return _sendRrwebBatch.apply(this, arguments);
|
|
4651
4666
|
}
|
package/dist/index.js
CHANGED
|
@@ -4486,33 +4486,32 @@ function _doAuthorize2() {
|
|
|
4486
4486
|
});
|
|
4487
4487
|
case 3:
|
|
4488
4488
|
res = _context2.sent;
|
|
4489
|
-
console.log("Auth here: ", res);
|
|
4490
4489
|
if (res.ok) {
|
|
4491
|
-
_context2.next =
|
|
4490
|
+
_context2.next = 7;
|
|
4492
4491
|
break;
|
|
4493
4492
|
}
|
|
4494
4493
|
console.error('[CoreOutline] Authorization failed:', res.status);
|
|
4495
4494
|
return _context2.abrupt("return", false);
|
|
4496
|
-
case
|
|
4497
|
-
_context2.next =
|
|
4495
|
+
case 7:
|
|
4496
|
+
_context2.next = 9;
|
|
4498
4497
|
return res.json();
|
|
4499
|
-
case
|
|
4498
|
+
case 9:
|
|
4500
4499
|
data = _context2.sent;
|
|
4501
4500
|
_token = data.access_token;
|
|
4502
4501
|
_organizationId = data.organization_id;
|
|
4503
4502
|
expiresIn = data.expires_in || 24 * 3600;
|
|
4504
4503
|
_scheduleTokenRefresh(expiresIn);
|
|
4505
4504
|
return _context2.abrupt("return", true);
|
|
4506
|
-
case
|
|
4507
|
-
_context2.prev =
|
|
4505
|
+
case 17:
|
|
4506
|
+
_context2.prev = 17;
|
|
4508
4507
|
_context2.t0 = _context2["catch"](0);
|
|
4509
4508
|
console.error('[CoreOutline] Authorization error:', _context2.t0);
|
|
4510
4509
|
return _context2.abrupt("return", false);
|
|
4511
|
-
case
|
|
4510
|
+
case 21:
|
|
4512
4511
|
case "end":
|
|
4513
4512
|
return _context2.stop();
|
|
4514
4513
|
}
|
|
4515
|
-
}, _callee2, null, [[0,
|
|
4514
|
+
}, _callee2, null, [[0, 17]]);
|
|
4516
4515
|
}));
|
|
4517
4516
|
return _doAuthorize2.apply(this, arguments);
|
|
4518
4517
|
}
|
|
@@ -4544,13 +4543,19 @@ function _ensureFreshToken2() {
|
|
|
4544
4543
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4545
4544
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4546
4545
|
case 0:
|
|
4546
|
+
if (!_token) {
|
|
4547
|
+
_context4.next = 2;
|
|
4548
|
+
break;
|
|
4549
|
+
}
|
|
4550
|
+
return _context4.abrupt("return");
|
|
4551
|
+
case 2:
|
|
4547
4552
|
if (!(_warehouseId && _dataSourceId && _dataSourceSecret)) {
|
|
4548
|
-
_context4.next =
|
|
4553
|
+
_context4.next = 5;
|
|
4549
4554
|
break;
|
|
4550
4555
|
}
|
|
4551
|
-
_context4.next =
|
|
4556
|
+
_context4.next = 5;
|
|
4552
4557
|
return _doAuthorize(_warehouseId, _dataSourceId, _dataSourceSecret);
|
|
4553
|
-
case
|
|
4558
|
+
case 5:
|
|
4554
4559
|
case "end":
|
|
4555
4560
|
return _context4.stop();
|
|
4556
4561
|
}
|
|
@@ -4559,12 +4564,12 @@ function _ensureFreshToken2() {
|
|
|
4559
4564
|
return _ensureFreshToken2.apply(this, arguments);
|
|
4560
4565
|
}
|
|
4561
4566
|
function trackEvent(eventType, payload) {
|
|
4562
|
-
|
|
4563
|
-
|
|
4567
|
+
if (!_token) return;
|
|
4564
4568
|
var event = _objectSpread2({
|
|
4565
4569
|
event_id: uuid.v4(),
|
|
4566
4570
|
event_type: eventType,
|
|
4567
|
-
event_ts: new Date().toISOString()
|
|
4571
|
+
event_ts: new Date().toISOString(),
|
|
4572
|
+
account_id: _dataSourceId
|
|
4568
4573
|
}, payload);
|
|
4569
4574
|
_buffer.push(event);
|
|
4570
4575
|
if (!_flushInterval) {
|
|
@@ -4583,7 +4588,12 @@ function _flush() {
|
|
|
4583
4588
|
_context5.next = 2;
|
|
4584
4589
|
return _ensureFreshToken();
|
|
4585
4590
|
case 2:
|
|
4586
|
-
|
|
4591
|
+
if (!(!_token || _buffer.length === 0)) {
|
|
4592
|
+
_context5.next = 4;
|
|
4593
|
+
break;
|
|
4594
|
+
}
|
|
4595
|
+
return _context5.abrupt("return");
|
|
4596
|
+
case 4:
|
|
4587
4597
|
console.log(_token);
|
|
4588
4598
|
events = _buffer.splice(0, _buffer.length);
|
|
4589
4599
|
body = JSON.stringify({
|
|
@@ -4603,7 +4613,7 @@ function _flush() {
|
|
|
4603
4613
|
})["catch"](function (err) {
|
|
4604
4614
|
return console.error('[CoreOutline] Flush error:', err);
|
|
4605
4615
|
});
|
|
4606
|
-
case
|
|
4616
|
+
case 9:
|
|
4607
4617
|
case "end":
|
|
4608
4618
|
return _context5.stop();
|
|
4609
4619
|
}
|
|
@@ -4622,11 +4632,16 @@ function _sendRrwebBatch() {
|
|
|
4622
4632
|
_context6.next = 2;
|
|
4623
4633
|
return _ensureFreshToken();
|
|
4624
4634
|
case 2:
|
|
4625
|
-
|
|
4635
|
+
if (!(!_token || !chunks || chunks.length === 0)) {
|
|
4636
|
+
_context6.next = 4;
|
|
4637
|
+
break;
|
|
4638
|
+
}
|
|
4639
|
+
return _context6.abrupt("return");
|
|
4640
|
+
case 4:
|
|
4626
4641
|
console.log(_token);
|
|
4627
4642
|
console.log("RRWeb here: ", chunks);
|
|
4628
|
-
_context6.prev =
|
|
4629
|
-
_context6.next =
|
|
4643
|
+
_context6.prev = 6;
|
|
4644
|
+
_context6.next = 9;
|
|
4630
4645
|
return fetch("".concat(INGEST_BASE, "/api/ingest/rrweb"), {
|
|
4631
4646
|
method: 'POST',
|
|
4632
4647
|
headers: {
|
|
@@ -4642,18 +4657,18 @@ function _sendRrwebBatch() {
|
|
|
4642
4657
|
}),
|
|
4643
4658
|
keepalive: true
|
|
4644
4659
|
});
|
|
4645
|
-
case 7:
|
|
4646
|
-
_context6.next = 12;
|
|
4647
|
-
break;
|
|
4648
4660
|
case 9:
|
|
4649
|
-
_context6.
|
|
4650
|
-
|
|
4661
|
+
_context6.next = 14;
|
|
4662
|
+
break;
|
|
4663
|
+
case 11:
|
|
4664
|
+
_context6.prev = 11;
|
|
4665
|
+
_context6.t0 = _context6["catch"](6);
|
|
4651
4666
|
console.error('[CoreOutline] rrweb upload error:', _context6.t0);
|
|
4652
|
-
case
|
|
4667
|
+
case 14:
|
|
4653
4668
|
case "end":
|
|
4654
4669
|
return _context6.stop();
|
|
4655
4670
|
}
|
|
4656
|
-
}, _callee6, null, [[
|
|
4671
|
+
}, _callee6, null, [[6, 11]]);
|
|
4657
4672
|
}));
|
|
4658
4673
|
return _sendRrwebBatch.apply(this, arguments);
|
|
4659
4674
|
}
|