corsair 0.1.30 → 0.1.32
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/core/auth/key-manager.d.ts.map +1 -1
- package/dist/core.js +16 -3
- package/dist/index.js +26 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-manager.d.ts","sourceRoot":"","sources":["../../../core/auth/key-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAS9C,OAAO,KAAK,EAEX,oBAAoB,EAEpB,wBAAwB,EAExB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"key-manager.d.ts","sourceRoot":"","sources":["../../../core/auth/key-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAS9C,OAAO,KAAK,EAEX,oBAAoB,EAEpB,wBAAwB,EAExB,MAAM,SAAS,CAAC;AAyDjB,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,SAAS,IAAI;IAC/D,QAAQ,EAAE,CAAC,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,CAAC;IAC1B,4DAA4D;IAC5D,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,SAAS,EAC9D,OAAO,EAAE,4BAA4B,CAAC,CAAC,CAAC,GACtC,wBAAwB,CAAC,CAAC,CAAC,CA2J7B;AAMD,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,SAAS,IAAI;IAC3D,QAAQ,EAAE,CAAC,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,eAAe,CAAC;IAC1B,wDAAwD;IACxD,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,SAAS,EAC1D,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAClC,oBAAoB,CAAC,CAAC,CAAC,CA4OzB;AAMD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC7C,QAAQ,EAAE,eAAe,EACzB,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC,CAwBjB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACzC,QAAQ,EAAE,eAAe,EACzB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC,CAqCjB"}
|
package/dist/core.js
CHANGED
|
@@ -497,7 +497,8 @@ function createFieldAccessors(getDecryptedConfig, updateConfig, fields) {
|
|
|
497
497
|
return config[field] ?? null;
|
|
498
498
|
};
|
|
499
499
|
accessors[`set_${field}`] = async (value) => {
|
|
500
|
-
|
|
500
|
+
const normalized = [null, void 0, ""].includes(value) ? null : value;
|
|
501
|
+
await updateConfig({ [field]: normalized });
|
|
501
502
|
};
|
|
502
503
|
}
|
|
503
504
|
return accessors;
|
|
@@ -577,7 +578,13 @@ function createIntegrationKeyManager(options) {
|
|
|
577
578
|
};
|
|
578
579
|
const updateConfig = async (updates) => {
|
|
579
580
|
const dek = await getDecryptedDek();
|
|
580
|
-
|
|
581
|
+
let currentConfig;
|
|
582
|
+
try {
|
|
583
|
+
currentConfig = await getDecryptedConfig();
|
|
584
|
+
} catch (err) {
|
|
585
|
+
console.error(`[corsair] Failed to decrypt config for integration "${integrationName}", starting fresh:`, err);
|
|
586
|
+
currentConfig = {};
|
|
587
|
+
}
|
|
581
588
|
const newConfig = { ...currentConfig };
|
|
582
589
|
for (const [key, value] of Object.entries(updates)) {
|
|
583
590
|
if (value === null) {
|
|
@@ -720,7 +727,13 @@ function createAccountKeyManager(options) {
|
|
|
720
727
|
};
|
|
721
728
|
const updateConfig = async (updates) => {
|
|
722
729
|
const dek = await getDecryptedDek();
|
|
723
|
-
|
|
730
|
+
let currentConfig;
|
|
731
|
+
try {
|
|
732
|
+
currentConfig = await getDecryptedConfig();
|
|
733
|
+
} catch (err) {
|
|
734
|
+
console.error(`[corsair] Failed to decrypt config for account (tenant: "${tenantId}", integration: "${integrationName}"), starting fresh:`, err);
|
|
735
|
+
currentConfig = {};
|
|
736
|
+
}
|
|
724
737
|
const newConfig = { ...currentConfig };
|
|
725
738
|
for (const [key, value] of Object.entries(updates)) {
|
|
726
739
|
if (value === null) {
|
package/dist/index.js
CHANGED
|
@@ -509,7 +509,8 @@ function createFieldAccessors(getDecryptedConfig, updateConfig, fields) {
|
|
|
509
509
|
return config[field] ?? null;
|
|
510
510
|
};
|
|
511
511
|
accessors[`set_${field}`] = async (value) => {
|
|
512
|
-
|
|
512
|
+
const normalized = [null, void 0, ""].includes(value) ? null : value;
|
|
513
|
+
await updateConfig({ [field]: normalized });
|
|
513
514
|
};
|
|
514
515
|
}
|
|
515
516
|
return accessors;
|
|
@@ -589,7 +590,13 @@ function createIntegrationKeyManager(options) {
|
|
|
589
590
|
};
|
|
590
591
|
const updateConfig = async (updates) => {
|
|
591
592
|
const dek = await getDecryptedDek();
|
|
592
|
-
|
|
593
|
+
let currentConfig;
|
|
594
|
+
try {
|
|
595
|
+
currentConfig = await getDecryptedConfig();
|
|
596
|
+
} catch (err) {
|
|
597
|
+
console.error(`[corsair] Failed to decrypt config for integration "${integrationName}", starting fresh:`, err);
|
|
598
|
+
currentConfig = {};
|
|
599
|
+
}
|
|
593
600
|
const newConfig = { ...currentConfig };
|
|
594
601
|
for (const [key, value] of Object.entries(updates)) {
|
|
595
602
|
if (value === null) {
|
|
@@ -732,7 +739,13 @@ function createAccountKeyManager(options) {
|
|
|
732
739
|
};
|
|
733
740
|
const updateConfig = async (updates) => {
|
|
734
741
|
const dek = await getDecryptedDek();
|
|
735
|
-
|
|
742
|
+
let currentConfig;
|
|
743
|
+
try {
|
|
744
|
+
currentConfig = await getDecryptedConfig();
|
|
745
|
+
} catch (err) {
|
|
746
|
+
console.error(`[corsair] Failed to decrypt config for account (tenant: "${tenantId}", integration: "${integrationName}"), starting fresh:`, err);
|
|
747
|
+
currentConfig = {};
|
|
748
|
+
}
|
|
736
749
|
const newConfig = { ...currentConfig };
|
|
737
750
|
for (const [key, value] of Object.entries(updates)) {
|
|
738
751
|
if (value === null) {
|
|
@@ -35801,7 +35814,11 @@ async function checkAuthStatus(pluginId, authType, integrationKeyMgr, accountKey
|
|
|
35801
35814
|
if (OPTIONAL_FIELDS.has(field)) continue;
|
|
35802
35815
|
const getter = integrationKeyMgr[`get_${field}`];
|
|
35803
35816
|
if (!getter) continue;
|
|
35804
|
-
|
|
35817
|
+
let value = null;
|
|
35818
|
+
try {
|
|
35819
|
+
value = await getter();
|
|
35820
|
+
} catch {
|
|
35821
|
+
}
|
|
35805
35822
|
if (!value) missingIntegration.push(field);
|
|
35806
35823
|
}
|
|
35807
35824
|
for (const key of Object.keys(accountKeyMgr)) {
|
|
@@ -35810,7 +35827,11 @@ async function checkAuthStatus(pluginId, authType, integrationKeyMgr, accountKey
|
|
|
35810
35827
|
if (OPTIONAL_FIELDS.has(field)) continue;
|
|
35811
35828
|
const getter = accountKeyMgr[`get_${field}`];
|
|
35812
35829
|
if (!getter) continue;
|
|
35813
|
-
|
|
35830
|
+
let value = null;
|
|
35831
|
+
try {
|
|
35832
|
+
value = await getter();
|
|
35833
|
+
} catch {
|
|
35834
|
+
}
|
|
35814
35835
|
if (!value) missingAccount.push(field);
|
|
35815
35836
|
}
|
|
35816
35837
|
const isReady = missingIntegration.length === 0 && missingAccount.length === 0;
|