231 lines
5.4 KiB
JavaScript
231 lines
5.4 KiB
JavaScript
// Generated, do not edit. sha256:49025914ad8e6294f0b8c9d075be9b80de842094dd53941a1aaa93bc73409a0d
|
|||
|
|
import { CONFIG } from '../../shared/config.js';
|
||
|
|
|
||
|
|
const RANG = new Map(CONFIG.AI.FIELD_CLASSES.map((k, i) => [k, i]));
|
||
|
|
|
||
|
|
export const FIELD_POLICY = Object.freeze({
|
||
|
|
rawData: 'drop',
|
||
|
|
settings: 'drop',
|
||
|
|
value: 'drop',
|
||
|
|
arguments: 'drop',
|
||
|
|
text: 'drop',
|
||
|
|
payload: 'drop',
|
||
|
|
messageParts: 'drop',
|
||
|
|
keyHeader: 'drop',
|
||
|
|
signatureHeader: 'drop',
|
||
|
|
timestampHeader: 'drop',
|
||
|
|
windowHeader: 'drop',
|
||
|
|
authenticationHeaderName: 'drop',
|
||
|
|
authenticationParameterName: 'drop',
|
||
|
|
|
||
|
|
address: 'chain',
|
||
|
|
externalAddress: 'chain',
|
||
|
|
automaticLabel: 'chain',
|
||
|
|
txid: 'chain',
|
||
|
|
transactionHash: 'chain',
|
||
|
|
blockHeight: 'chain',
|
||
|
|
blockTime: 'chain',
|
||
|
|
chainIndex: 'chain',
|
||
|
|
derivationIndex: 'chain',
|
||
|
|
scriptType: 'chain',
|
||
|
|
|
||
|
|
id: 'handle',
|
||
|
|
assetId: 'handle',
|
||
|
|
accountId: 'handle',
|
||
|
|
fromAccountId: 'handle',
|
||
|
|
toAccountId: 'handle',
|
||
|
|
productId: 'handle',
|
||
|
|
providerId: 'handle',
|
||
|
|
connectionId: 'handle',
|
||
|
|
sourceId: 'handle',
|
||
|
|
labelId: 'handle',
|
||
|
|
eventId: 'handle',
|
||
|
|
scheduleId: 'handle',
|
||
|
|
profileId: 'handle',
|
||
|
|
walletTransactionId: 'handle',
|
||
|
|
resolvedEventId: 'handle',
|
||
|
|
createdEventId: 'handle',
|
||
|
|
createdAccountId: 'handle',
|
||
|
|
createdValuationId: 'handle',
|
||
|
|
callId: 'handle',
|
||
|
|
claimedBy: 'handle',
|
||
|
|
principalAssetId: 'handle',
|
||
|
|
payoutAssetId: 'handle',
|
||
|
|
name: 'handle',
|
||
|
|
searchName: 'handle',
|
||
|
|
description: 'handle',
|
||
|
|
note: 'handle',
|
||
|
|
memo: 'handle',
|
||
|
|
body: 'handle',
|
||
|
|
fingerprint: 'handle',
|
||
|
|
summary: 'handle',
|
||
|
|
origin: 'handle',
|
||
|
|
filename: 'handle',
|
||
|
|
importReference: 'handle',
|
||
|
|
externalId: 'handle',
|
||
|
|
instanceKey: 'handle',
|
||
|
|
sessionId: 'handle',
|
||
|
|
client: 'handle',
|
||
|
|
detail: 'handle',
|
||
|
|
fieldsShared: 'handle',
|
||
|
|
url: 'handle',
|
||
|
|
baseUrl: 'handle',
|
||
|
|
scope: 'plain',
|
||
|
|
|
||
|
|
amount: 'quantity',
|
||
|
|
balance: 'quantity',
|
||
|
|
balanceSats: 'quantity',
|
||
|
|
balanceFound: 'quantity',
|
||
|
|
valueSats: 'quantity',
|
||
|
|
feeSats: 'quantity',
|
||
|
|
unitFee: 'quantity',
|
||
|
|
principalAmount: 'quantity',
|
||
|
|
fineGrams: 'quantity',
|
||
|
|
productCount: 'quantity',
|
||
|
|
|
||
|
|
fiatFee: 'quantityFiat',
|
||
|
|
fiatValue: 'quantityFiat',
|
||
|
|
|
||
|
|
fiatPrice: 'rate',
|
||
|
|
fiatRate: 'rate',
|
||
|
|
annualRate: 'rate',
|
||
|
|
|
||
|
|
key: 'plain',
|
||
|
|
portfolio: 'plain',
|
||
|
|
symbol: 'plain',
|
||
|
|
unit: 'plain',
|
||
|
|
subunit: 'plain',
|
||
|
|
displayUnit: 'plain',
|
||
|
|
decimals: 'plain',
|
||
|
|
kind: 'plain',
|
||
|
|
taxCategory: 'plain',
|
||
|
|
taxScope: 'plain',
|
||
|
|
wealthScope: 'plain',
|
||
|
|
balanceCapture: 'plain',
|
||
|
|
state: 'plain',
|
||
|
|
form: 'plain',
|
||
|
|
type: 'plain',
|
||
|
|
accountKind: 'plain',
|
||
|
|
eventType: 'plain',
|
||
|
|
source: 'plain',
|
||
|
|
priceOrigin: 'plain',
|
||
|
|
sourceName: 'plain',
|
||
|
|
status: 'plain',
|
||
|
|
lastStatus: 'plain',
|
||
|
|
direction: 'plain',
|
||
|
|
suggestedType: 'plain',
|
||
|
|
method: 'plain',
|
||
|
|
capability: 'plain',
|
||
|
|
resolution: 'plain',
|
||
|
|
transform: 'plain',
|
||
|
|
internalField: 'plain',
|
||
|
|
jsonPath: 'plain',
|
||
|
|
pathTemplate: 'plain',
|
||
|
|
queryTemplate: 'plain',
|
||
|
|
quoteCurrency: 'plain',
|
||
|
|
baseCurrency: 'plain',
|
||
|
|
currency: 'plain',
|
||
|
|
quoteUnit: 'plain',
|
||
|
|
minIntervalSeconds: 'plain',
|
||
|
|
callsPerMonth: 'plain',
|
||
|
|
hashAlgorithm: 'plain',
|
||
|
|
encoding: 'plain',
|
||
|
|
authenticationKind: 'plain',
|
||
|
|
authenticationRequired: 'plain',
|
||
|
|
rateKind: 'plain',
|
||
|
|
creditCadence: 'plain',
|
||
|
|
creditWeekday: 'plain',
|
||
|
|
creditDayOfMonth: 'plain',
|
||
|
|
compounding: 'plain',
|
||
|
|
outcome: 'plain',
|
||
|
|
tool: 'plain',
|
||
|
|
isActive: 'plain',
|
||
|
|
isSeed: 'plain',
|
||
|
|
isSystem: 'plain',
|
||
|
|
isCatchAll: 'plain',
|
||
|
|
isOwnCustody: 'plain',
|
||
|
|
scanEnabled: 'plain',
|
||
|
|
rank: 'plain',
|
||
|
|
sortOrder: 'plain',
|
||
|
|
version: 'plain',
|
||
|
|
serverVersion: 'plain',
|
||
|
|
count: 'plain',
|
||
|
|
highWater: 'plain',
|
||
|
|
rowCount: 'plain',
|
||
|
|
okCount: 'plain',
|
||
|
|
failCount: 'plain',
|
||
|
|
addressesFound: 'plain',
|
||
|
|
proposalsCreated: 'plain',
|
||
|
|
transactionCount: 'plain',
|
||
|
|
charactersOut: 'plain',
|
||
|
|
sumLatencyMs: 'plain',
|
||
|
|
maxLatencyMs: 'plain',
|
||
|
|
layer: 'plain',
|
||
|
|
target: 'plain',
|
||
|
|
providerKey: 'plain',
|
||
|
|
subject: 'plain',
|
||
|
|
httpStatus: 'plain',
|
||
|
|
errorKey: 'plain',
|
||
|
|
latencyMs: 'plain',
|
||
|
|
requestId: 'plain',
|
||
|
|
windowMs: 'plain',
|
||
|
|
gridX: 'plain',
|
||
|
|
gridY: 'plain',
|
||
|
|
spanWidth: 'plain',
|
||
|
|
spanHeight: 'plain',
|
||
|
|
bucketMinute: 'plain',
|
||
|
|
tableName: 'plain',
|
||
|
|
operation: 'plain',
|
||
|
|
rowId: 'handle',
|
||
|
|
originId: 'handle',
|
||
|
|
changes: 'drop',
|
||
|
|
occurredAt: 'plain',
|
||
|
|
claimedAt: 'plain',
|
||
|
|
expiresAt: 'plain',
|
||
|
|
resolvedAt: 'plain',
|
||
|
|
createdAt: 'plain',
|
||
|
|
updatedAt: 'plain',
|
||
|
|
closedAt: 'plain',
|
||
|
|
detectedAt: 'plain',
|
||
|
|
dismissedAt: 'plain',
|
||
|
|
gapAcceptedAt: 'plain',
|
||
|
|
importedAt: 'plain',
|
||
|
|
observedAt: 'plain',
|
||
|
|
scannedAt: 'plain',
|
||
|
|
lastScannedAt: 'plain',
|
||
|
|
lastCheckedAt: 'plain',
|
||
|
|
rateAt: 'plain',
|
||
|
|
valuedOn: 'plain',
|
||
|
|
fromDay: 'plain',
|
||
|
|
untilDay: 'plain',
|
||
|
|
day: 'plain',
|
||
|
|
startsOn: 'plain',
|
||
|
|
endsOn: 'plain',
|
||
|
|
periodStart: 'plain',
|
||
|
|
periodEnd: 'plain',
|
||
|
|
});
|
||
|
|
|
||
|
|
export const TABLE_POLICY = Object.freeze({
|
||
|
|
Preference: Object.freeze({ value: 'plain' }),
|
||
|
|
});
|
||
|
|
|
||
|
|
export function fieldClass(field, table = null) {
|
||
|
|
if (table == null && typeof field === 'string') {
|
||
|
|
const punt = field.indexOf('.');
|
||
|
|
if (punt > 0) return fieldClass(field.slice(punt + 1), field.slice(0, punt));
|
||
|
|
}
|
||
|
|
|
||
|
|
const basis = Object.hasOwn(FIELD_POLICY, field) ? FIELD_POLICY[field] : null;
|
||
|
|
|
||
|
|
if (basis === null || table == null) return basis;
|
||
|
|
if (!Object.hasOwn(TABLE_POLICY, table)) return basis;
|
||
|
|
|
||
|
|
const perTabel = TABLE_POLICY[table];
|
||
|
|
return Object.hasOwn(perTabel, field) ? perTabel[field] : basis;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function strictestClass(a, b) {
|
||
|
|
if (a == null) return b;
|
||
|
|
if (b == null) return a;
|
||
|
|
return (RANG.get(a) ?? -1) >= (RANG.get(b) ?? -1) ? a : b;
|
||
|
|
}
|