@forklaunch/core 4.2.0 → 4.4.0
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/bin/gateway-mock/routes/payments.mjs +5 -2
- package/lib/http/index.d.ts +2 -0
- package/lib/http/index.d.ts.map +1 -1
- package/lib/http/index.js +609 -219
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +606 -220
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/mcpGenerator/mcpAuth.d.ts +52 -0
- package/lib/http/mcpGenerator/mcpAuth.d.ts.map +1 -0
- package/lib/http/mcpGenerator/mcpGenerator.d.ts +2 -1
- package/lib/http/mcpGenerator/mcpGenerator.d.ts.map +1 -1
- package/lib/http/mcpGenerator/mcpHttpHandler.d.ts +14 -1
- package/lib/http/mcpGenerator/mcpHttpHandler.d.ts.map +1 -1
- package/lib/http/mcpGenerator/mcpOAuth.d.ts +110 -0
- package/lib/http/mcpGenerator/mcpOAuth.d.ts.map +1 -0
- package/lib/http/paymentsClient.d.ts +6 -0
- package/lib/http/paymentsClient.d.ts.map +1 -1
- package/lib/http/types/expressLikeOptions.d.ts +8 -0
- package/lib/http/types/expressLikeOptions.d.ts.map +1 -1
- package/lib/http/voiceClient.d.ts +14 -4
- package/lib/http/voiceClient.d.ts.map +1 -1
- package/lib/persistence/complianceTypes.d.ts +27 -1
- package/lib/persistence/complianceTypes.d.ts.map +1 -1
- package/lib/persistence/defineComplianceEntity.d.ts +1 -1
- package/lib/persistence/defineComplianceEntity.d.ts.map +1 -1
- package/lib/persistence/index.d.ts +2 -1
- package/lib/persistence/index.d.ts.map +1 -1
- package/lib/persistence/index.js +62 -2
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs +59 -2
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/persistence/migrationLock.d.ts +61 -0
- package/lib/persistence/migrationLock.d.ts.map +1 -0
- package/lib/services/index.js +8 -2
- package/lib/services/index.js.map +1 -1
- package/lib/services/index.mjs +8 -2
- package/lib/services/index.mjs.map +1 -1
- package/lib/services/retentionService.d.ts +2 -2
- package/lib/services/retentionService.d.ts.map +1 -1
- package/package.json +7 -5
|
@@ -33,6 +33,10 @@ var RetentionAction = {
|
|
|
33
33
|
delete: "delete",
|
|
34
34
|
anonymize: "anonymize"
|
|
35
35
|
};
|
|
36
|
+
var DEFAULT_RETENTION_FROM = "createdAt";
|
|
37
|
+
function retentionFrom(policy) {
|
|
38
|
+
return policy.from ?? DEFAULT_RETENTION_FROM;
|
|
39
|
+
}
|
|
36
40
|
var RetentionDuration = {
|
|
37
41
|
days: (n) => `P${n}D`,
|
|
38
42
|
months: (n) => `P${n}M`,
|
|
@@ -1530,9 +1534,22 @@ function defineComplianceEntity(meta) {
|
|
|
1530
1534
|
registerEntityCompliance(entityName, complianceFields);
|
|
1531
1535
|
if (meta.retention) {
|
|
1532
1536
|
parseDuration(meta.retention.duration);
|
|
1533
|
-
|
|
1537
|
+
const from = retentionFrom(meta.retention);
|
|
1538
|
+
const fromProperty = resolvedProperties[from];
|
|
1539
|
+
if (!fromProperty) {
|
|
1540
|
+
throw new Error(
|
|
1541
|
+
from === DEFAULT_RETENTION_FROM ? `Entity '${entityName}' has a retention policy but no 'createdAt' property. Retention requires createdAt to compute expiration.` : `Entity '${entityName}' has a retention policy counting from '${from}', but no '${from}' property. Add it (a nullable datetime) or count from another date property.`
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
if (typeof fromProperty === "function") {
|
|
1534
1545
|
throw new Error(
|
|
1535
|
-
`Entity '${entityName}'
|
|
1546
|
+
`Entity '${entityName}' retention counts from '${from}', which is a relation. Count from a date property instead.`
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
const fromLevel = complianceFields.get(from);
|
|
1550
|
+
if (fromLevel && fromLevel !== "none") {
|
|
1551
|
+
throw new Error(
|
|
1552
|
+
`Entity '${entityName}' retention counts from '${from}', which is classified '${fromLevel}' and therefore encrypted. Count from an unclassified (compliance('none')) date property.`
|
|
1536
1553
|
);
|
|
1537
1554
|
}
|
|
1538
1555
|
registerEntityRetention(entityName, meta.retention);
|
|
@@ -2107,6 +2124,43 @@ function wrapEmWithTenantContext(em, tenantId) {
|
|
|
2107
2124
|
function rebind(result, target, proxy) {
|
|
2108
2125
|
return result === target ? proxy : result;
|
|
2109
2126
|
}
|
|
2127
|
+
|
|
2128
|
+
// src/persistence/migrationLock.ts
|
|
2129
|
+
async function runMigrationsWithLock(orm, options = {}) {
|
|
2130
|
+
const run = options.run ?? (() => {
|
|
2131
|
+
const migrator = orm.migrator ?? orm.getMigrator?.();
|
|
2132
|
+
if (!migrator) {
|
|
2133
|
+
throw new Error(
|
|
2134
|
+
"runMigrationsWithLock: the ORM has no Migrator extension; add `extensions: [Migrator]` to the config"
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
return migrator.up();
|
|
2138
|
+
});
|
|
2139
|
+
const log = options.log ?? (() => void 0);
|
|
2140
|
+
const isPostgres = orm.em.getPlatform().getDefaultSchemaName?.() === "public";
|
|
2141
|
+
if (!isPostgres) {
|
|
2142
|
+
await run();
|
|
2143
|
+
return;
|
|
2144
|
+
}
|
|
2145
|
+
const connection = orm.em.getConnection();
|
|
2146
|
+
await connection.transactional(async (trx) => {
|
|
2147
|
+
const name = options.lockName ?? `${(await connection.execute(
|
|
2148
|
+
"select current_database() as name",
|
|
2149
|
+
[],
|
|
2150
|
+
"get",
|
|
2151
|
+
trx
|
|
2152
|
+
)).name}:migrations`;
|
|
2153
|
+
log(`[migrations] waiting for lock ${name}`);
|
|
2154
|
+
await connection.execute(
|
|
2155
|
+
"select pg_advisory_xact_lock(hashtext(?))",
|
|
2156
|
+
[name],
|
|
2157
|
+
"run",
|
|
2158
|
+
trx
|
|
2159
|
+
);
|
|
2160
|
+
log(`[migrations] holding lock ${name}`);
|
|
2161
|
+
await run();
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2110
2164
|
export {
|
|
2111
2165
|
Anon,
|
|
2112
2166
|
BLIND_INDEX_PREFIX,
|
|
@@ -2115,6 +2169,7 @@ export {
|
|
|
2115
2169
|
CompliantIndexType,
|
|
2116
2170
|
CompliantQueryError,
|
|
2117
2171
|
CompliantType,
|
|
2172
|
+
DEFAULT_RETENTION_FROM,
|
|
2118
2173
|
DecryptionError,
|
|
2119
2174
|
ENCRYPTED_PREFIXES2 as ENCRYPTED_PREFIXES,
|
|
2120
2175
|
ENCRYPTION_FORMAT_ENV,
|
|
@@ -2165,7 +2220,9 @@ export {
|
|
|
2165
2220
|
parseEncryptionKeyList,
|
|
2166
2221
|
reencryptEncryptedColumns,
|
|
2167
2222
|
registerEncryptor,
|
|
2223
|
+
retentionFrom,
|
|
2168
2224
|
rotationTotals,
|
|
2225
|
+
runMigrationsWithLock,
|
|
2169
2226
|
sealedAnon,
|
|
2170
2227
|
setEncryptionTenantId,
|
|
2171
2228
|
setupRls,
|