@powerhousedao/connect 1.0.17-dev.2 → 1.0.17-dev.3
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/assets/{app-CayLrjAy.js → app-BdUxze73.js} +735 -117
- package/dist/assets/{app-CayLrjAy.js.map → app-BdUxze73.js.map} +1 -1
- package/dist/assets/{app-CDOWlDp2.css → app-b1jkE5Vo.css} +115 -0
- package/dist/assets/{app-loader-DiF8OhX3.css → app-loader-B74nopv_.css} +130 -0
- package/dist/assets/{app-loader-Ej0QwX6c.js → app-loader-BVN3aSFC.js} +9 -5
- package/dist/assets/app-loader-BVN3aSFC.js.map +1 -0
- package/dist/assets/{browser-BfB4Waw5.js → browser-CzAjKVis.js} +4 -5
- package/dist/assets/{browser-BfB4Waw5.js.map → browser-CzAjKVis.js.map} +1 -1
- package/dist/assets/{ccip-DBZNMhmz.js → ccip-CbFWJKu1.js} +4 -4
- package/dist/assets/{ccip-DBZNMhmz.js.map → ccip-CbFWJKu1.js.map} +1 -1
- package/dist/assets/{content-DnXO71l4.js → content-C1JKApwb.js} +1010 -374
- package/dist/assets/content-C1JKApwb.js.map +1 -0
- package/dist/assets/{index-CCSrpy8s.js → index-D1myKexe.js} +4 -4
- package/dist/assets/{index-CCSrpy8s.js.map → index-D1myKexe.js.map} +1 -1
- package/dist/assets/{index-BbMglwKh.js → index-DtwSBKZB.js} +14 -14
- package/dist/assets/index-DtwSBKZB.js.map +1 -0
- package/dist/assets/{index-CU3_V46J.js → index-qIrGoURI.js} +4 -4
- package/dist/assets/{index-CU3_V46J.js.map → index-qIrGoURI.js.map} +1 -1
- package/dist/assets/{main.D0KZAQpb.js → main.DCtGjfg0.js} +2 -2
- package/dist/assets/{main.D0KZAQpb.js.map → main.DCtGjfg0.js.map} +1 -1
- package/dist/assets/reactor-analytics-BUR_Njds.js +15 -0
- package/dist/assets/reactor-analytics-BUR_Njds.js.map +1 -0
- package/dist/assets/{router-BF9pgdRU.js → router-LLmzUc4B.js} +8 -7
- package/dist/assets/{router-BF9pgdRU.js.map → router-LLmzUc4B.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/vite-envs.sh +1 -1
- package/package.json +8 -8
- package/dist/assets/AnalyticsProfiler-DD1sT8NE.js +0 -22
- package/dist/assets/AnalyticsProfiler-DD1sT8NE.js.map +0 -1
- package/dist/assets/app-loader-Ej0QwX6c.js.map +0 -1
- package/dist/assets/content-DnXO71l4.js.map +0 -1
- package/dist/assets/index-BbMglwKh.js.map +0 -1
- package/dist/assets/reactor-analytics-BioFquA0.js +0 -605
- package/dist/assets/reactor-analytics-BioFquA0.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-CbFWJKu1.js","assets/main.DCtGjfg0.js","assets/app-loader-BVN3aSFC.js","assets/app-loader-B74nopv_.css","assets/index-D1myKexe.js","assets/style-Ce3V83BE.css","assets/index-DtwSBKZB.js","assets/browser-CzAjKVis.js","assets/router-LLmzUc4B.js","assets/reactor-analytics-BUR_Njds.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __typeError = (msg) => {
|
|
4
4
|
throw TypeError(msg);
|
|
@@ -19,9 +19,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
var _InternalTransmitter_instances, buildInternalOperationUpdate_fn, _focused, _cleanup, _setup, _a, _online, _cleanup2, _setup2, _b, _gcTimeout, _c, _initialState, _revertState, _cache, _client, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, dispatch_fn, _d, _queries, _e2, _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _f, _mutations, _scopes, _mutationId, _g, _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _h, _subtleCrypto, _keyPair, _keyPairStorage, _did, _ConnectCrypto_instances, initCrypto_fn, initialize_fn, parseDid_fn, generateECDSAKeyPair_fn, exportKeyPair_fn, importKeyPair_fn, _sign, _verify, _DB_NAME, _STORE_NAME, _KEY, _db, _BrowserKeyStorage_instances, useStore_fn;
|
|
22
|
-
import { _ as __vitePreload } from "./main.
|
|
22
|
+
import { _ as __vitePreload } from "./main.DCtGjfg0.js";
|
|
23
23
|
import { jsx as jsx$1, Fragment, jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { c as createAction, a as createReducer, i as isDocumentAction, R as ReorderStateExamplesInputSchema, D as DeleteStateExampleInputSchema, U as UpdateStateExampleInputSchema, A as AddStateExampleInputSchema, S as SetInitialStateInputSchema, b as SetStateSchemaInputSchema, d as ReorderModuleOperationsInputSchema, e as DeleteOperationInputSchema, M as MoveOperationInputSchema, f as SetOperationReducerInputSchema, g as SetOperationTemplateInputSchema, h as SetOperationDescriptionInputSchema, j as SetOperationSchemaInputSchema, k as SetOperationScopeInputSchema, l as SetOperationNameInputSchema, m as AddOperationInputSchema, n as ReorderOperationExamplesInputSchema, o as DeleteOperationExampleInputSchema, p as UpdateOperationExampleInputSchema, q as AddOperationExampleInputSchema, r as ReorderOperationErrorsInputSchema, s as DeleteOperationErrorInputSchema, t as SetOperationErrorTemplateInputSchema, u as SetOperationErrorDescriptionInputSchema, v as SetOperationErrorNameInputSchema, w as SetOperationErrorCodeInputSchema, x as AddOperationErrorInputSchema, y as ReorderModulesInputSchema, z as DeleteModuleInputSchema, B as SetModuleDescriptionInputSchema, C as SetModuleNameInputSchema, E as AddModuleInputSchema, F as ReorderChangeLogItemsInputSchema, G as DeleteChangeLogItemInputSchema, H as UpdateChangeLogItemInputSchema, I as AddChangeLogItemInputSchema, J as SetAuthorWebsiteInputSchema, K as SetAuthorNameInputSchema, L as SetModelDescriptionInputSchema, N as SetModelExtensionInputSchema, O as SetModelIdInputSchema, P as SetModelNameInputSchema, Q as baseCreateExtendedState, T as baseCreateDocument, V as baseSaveToFile, W as baseSaveToFileHandle, X as baseLoadFromFile, Y as baseLoadFromInput, Z as pascalCase, _ as logger$1, $ as Icon, a0 as getDefaultExportFromCjs, a1 as LOCAL, a2 as commonjsGlobal, a3 as PUBLIC, a4 as SWITCHBOARD, a5 as locationInfoByLocation, a6 as sharingTypeOptions, a7 as objectType, a8 as recordType, a9 as stringType, aa as capitalCase, ab as CLOUD, ac as createZip, ad as LZString, ae as buildSignedOperation, af as getI18n, ag as getDefaults, ah as connectConfig, ai as hashDocumentStateForScope, aj as getAugmentedNamespace, ak as process, al as setErrorHandler, am as driveDocumentModelModule, an as createBrowserDocumentDriveServer, ao as hashKey$1, ap as childLogger, aq as reducer$8, ar as isDocumentDrive, as as generateAddNodeAction, at as isFileNode, au as uploadDocumentOperations, av as updateFile, aw as addFolder, ax as isFolderNode, ay as deleteNode, az as updateNode, aA as FILE$1, aB as moveNode, aC as generateNodesCopy, aD as copyNode, aE as createState$1, aF as setDriveName, aG as setAvailableOffline, aH as setSharingType, aI as SynchronizationUnitNotFoundError, aJ as removeTrigger, aK as generateUUID, aL as PullResponderTransmitter, aM as addTrigger, aN as ReadDriveNotFoundError, aO as openUrl, aP as getNodeOptions, aQ as DRIVE$1, aR as FOLDER, aS as requestPublicDrive, aT as serviceWorkerManager, aU as packageJson, aV as t$1, aW as generateId } from "./app-loader-
|
|
24
|
+
import { c as createAction, a as createReducer, i as isDocumentAction, R as ReorderStateExamplesInputSchema, D as DeleteStateExampleInputSchema, U as UpdateStateExampleInputSchema, A as AddStateExampleInputSchema, S as SetInitialStateInputSchema, b as SetStateSchemaInputSchema, d as ReorderModuleOperationsInputSchema, e as DeleteOperationInputSchema, M as MoveOperationInputSchema, f as SetOperationReducerInputSchema, g as SetOperationTemplateInputSchema, h as SetOperationDescriptionInputSchema, j as SetOperationSchemaInputSchema, k as SetOperationScopeInputSchema, l as SetOperationNameInputSchema, m as AddOperationInputSchema, n as ReorderOperationExamplesInputSchema, o as DeleteOperationExampleInputSchema, p as UpdateOperationExampleInputSchema, q as AddOperationExampleInputSchema, r as ReorderOperationErrorsInputSchema, s as DeleteOperationErrorInputSchema, t as SetOperationErrorTemplateInputSchema, u as SetOperationErrorDescriptionInputSchema, v as SetOperationErrorNameInputSchema, w as SetOperationErrorCodeInputSchema, x as AddOperationErrorInputSchema, y as ReorderModulesInputSchema, z as DeleteModuleInputSchema, B as SetModuleDescriptionInputSchema, C as SetModuleNameInputSchema, E as AddModuleInputSchema, F as ReorderChangeLogItemsInputSchema, G as DeleteChangeLogItemInputSchema, H as UpdateChangeLogItemInputSchema, I as AddChangeLogItemInputSchema, J as SetAuthorWebsiteInputSchema, K as SetAuthorNameInputSchema, L as SetModelDescriptionInputSchema, N as SetModelExtensionInputSchema, O as SetModelIdInputSchema, P as SetModelNameInputSchema, Q as baseCreateExtendedState, T as baseCreateDocument, V as baseSaveToFile, W as baseSaveToFileHandle, X as baseLoadFromFile, Y as baseLoadFromInput, Z as pascalCase, _ as logger$1, $ as Icon, a0 as getDefaultExportFromCjs, a1 as LOCAL, a2 as commonjsGlobal, a3 as PUBLIC, a4 as SWITCHBOARD, a5 as locationInfoByLocation, a6 as sharingTypeOptions, a7 as objectType, a8 as recordType, a9 as stringType, aa as capitalCase, ab as CLOUD, ac as createZip, ad as LZString, ae as buildSignedOperation, af as getI18n, ag as getDefaults, ah as connectConfig, ai as hashDocumentStateForScope, aj as getAugmentedNamespace, ak as process, al as setErrorHandler, am as driveDocumentModelModule, an as createBrowserDocumentDriveServer, ao as hashKey$1, ap as childLogger, aq as reducer$8, ar as isDocumentDrive, as as generateAddNodeAction, at as isFileNode, au as uploadDocumentOperations, av as updateFile, aw as addFolder, ax as isFolderNode, ay as deleteNode, az as updateNode, aA as FILE$1, aB as moveNode, aC as generateNodesCopy, aD as copyNode, aE as createState$1, aF as setDriveName, aG as setAvailableOffline, aH as setSharingType, aI as SynchronizationUnitNotFoundError, aJ as removeTrigger, aK as generateUUID, aL as PullResponderTransmitter, aM as addTrigger, aN as ReadDriveNotFoundError, aO as openUrl, aP as getNodeOptions, aQ as DRIVE$1, aR as FOLDER, aS as requestPublicDrive, aT as serviceWorkerManager, aU as packageJson, aV as t$1, aW as generateId } from "./app-loader-BVN3aSFC.js";
|
|
25
25
|
import * as React from "react";
|
|
26
26
|
import React__default, { useLayoutEffect, useEffect, useState, forwardRef, useCallback, useContext, useRef, useMemo, createContext, Component, Fragment as Fragment$1, createElement, useId as useId$1, useSyncExternalStore, isValidElement, cloneElement, Children, useReducer, useDebugValue, Suspense, lazy } from "react";
|
|
27
27
|
import * as ReactDOM from "react-dom";
|
|
@@ -20581,7 +20581,7 @@ async function call(client2, args) {
|
|
|
20581
20581
|
} catch (err) {
|
|
20582
20582
|
const data2 = getRevertErrorData(err);
|
|
20583
20583
|
const { offchainLookup, offchainLookupSignature } = await __vitePreload(async () => {
|
|
20584
|
-
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-
|
|
20584
|
+
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-CbFWJKu1.js");
|
|
20585
20585
|
return { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 };
|
|
20586
20586
|
}, true ? __vite__mapDeps([0,1,2,3]) : void 0);
|
|
20587
20587
|
if (client2.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature && to)
|
|
@@ -50707,11 +50707,11 @@ const wagmiConfig = createConfig({
|
|
|
50707
50707
|
[mainnet.id]: http()
|
|
50708
50708
|
}
|
|
50709
50709
|
});
|
|
50710
|
-
const defaultQueryClient = new QueryClient();
|
|
50710
|
+
const defaultQueryClient$1 = new QueryClient();
|
|
50711
50711
|
function WagmiContext(props) {
|
|
50712
50712
|
const { children, wagmiProviderProps, queryClientProviderProps } = props;
|
|
50713
50713
|
const { config = wagmiConfig, ...wagmiProps } = wagmiProviderProps ?? {};
|
|
50714
|
-
const { client: client2 = defaultQueryClient, ...queryClientProps } = queryClientProviderProps ?? {};
|
|
50714
|
+
const { client: client2 = defaultQueryClient$1, ...queryClientProps } = queryClientProviderProps ?? {};
|
|
50715
50715
|
return jsx$1(WagmiProvider, { config, ...wagmiProps, children: jsx$1(QueryClientProvider, { client: client2, ...queryClientProps, children }) });
|
|
50716
50716
|
}
|
|
50717
50717
|
const downloadFile = async (document2) => {
|
|
@@ -72610,7 +72610,7 @@ const useFilteredDocumentModels = () => {
|
|
|
72610
72610
|
return filteredDocumentModels;
|
|
72611
72611
|
};
|
|
72612
72612
|
async function loadBaseEditors() {
|
|
72613
|
-
const documentModelEditor = await __vitePreload(() => import("./index-
|
|
72613
|
+
const documentModelEditor = await __vitePreload(() => import("./index-D1myKexe.js"), true ? __vite__mapDeps([4,2,1,3]) : void 0);
|
|
72614
72614
|
await __vitePreload(() => Promise.resolve({}), true ? __vite__mapDeps([5]) : void 0);
|
|
72615
72615
|
const module = documentModelEditor.documentModelEditorModule;
|
|
72616
72616
|
return [module];
|
|
@@ -72761,11 +72761,11 @@ const connectCrypto = (async () => {
|
|
|
72761
72761
|
return window.connectCrypto;
|
|
72762
72762
|
}
|
|
72763
72763
|
const { ConnectCrypto: ConnectCrypto2 } = await __vitePreload(async () => {
|
|
72764
|
-
const { ConnectCrypto: ConnectCrypto3 } = await import("./index-
|
|
72764
|
+
const { ConnectCrypto: ConnectCrypto3 } = await import("./index-DtwSBKZB.js");
|
|
72765
72765
|
return { ConnectCrypto: ConnectCrypto3 };
|
|
72766
72766
|
}, true ? __vite__mapDeps([6,1,2,3]) : void 0);
|
|
72767
72767
|
const { BrowserKeyStorage: BrowserKeyStorage2 } = await __vitePreload(async () => {
|
|
72768
|
-
const { BrowserKeyStorage: BrowserKeyStorage3 } = await import("./index-
|
|
72768
|
+
const { BrowserKeyStorage: BrowserKeyStorage3 } = await import("./index-DtwSBKZB.js");
|
|
72769
72769
|
return { BrowserKeyStorage: BrowserKeyStorage3 };
|
|
72770
72770
|
}, true ? __vite__mapDeps([6,1,2,3]) : void 0);
|
|
72771
72771
|
const connectCrypto2 = new ConnectCrypto2(new BrowserKeyStorage2());
|
|
@@ -72814,7 +72814,7 @@ function useRenown() {
|
|
|
72814
72814
|
return;
|
|
72815
72815
|
}
|
|
72816
72816
|
const { initRenownBrowser } = await __vitePreload(async () => {
|
|
72817
|
-
const { initRenownBrowser: initRenownBrowser2 } = await import("./index-
|
|
72817
|
+
const { initRenownBrowser: initRenownBrowser2 } = await import("./index-DtwSBKZB.js");
|
|
72818
72818
|
return { initRenownBrowser: initRenownBrowser2 };
|
|
72819
72819
|
}, true ? __vite__mapDeps([6,1,2,3]) : void 0);
|
|
72820
72820
|
const renownBrowser = initRenownBrowser(did2);
|
|
@@ -73126,11 +73126,11 @@ function useDocumentDriveServer() {
|
|
|
73126
73126
|
const getDocumentModelModule2 = useGetDocumentModelModule();
|
|
73127
73127
|
const [documentDrives, refreshDocumentDrives, , documentDrivesStatus] = useDocumentDrives$1();
|
|
73128
73128
|
const openFile = useCallback(
|
|
73129
|
-
async (drive, id) => {
|
|
73129
|
+
async (drive, id, options2) => {
|
|
73130
73130
|
if (!reactor) {
|
|
73131
73131
|
throw new Error("Reactor is not loaded");
|
|
73132
73132
|
}
|
|
73133
|
-
const document2 = await reactor.getDocument(drive, id);
|
|
73133
|
+
const document2 = await reactor.getDocument(drive, id, options2);
|
|
73134
73134
|
if (!document2) {
|
|
73135
73135
|
throw new Error(
|
|
73136
73136
|
`There was an error opening file with id ${id} on drive ${drive}`
|
|
@@ -80521,6 +80521,24 @@ const SearchBar = () => {
|
|
|
80521
80521
|
const [value, setValue] = useState("");
|
|
80522
80522
|
return jsx$1(ConnectSearchBar, { className: "max-w-searchbar-width m-4 shrink-0 bg-gray-100", placeholder: t2("searchbar.placeholder"), filterLabel: t2("searchbar.filterLabel"), filterItems: defaultFilterItems, value, onChange: setValue });
|
|
80523
80523
|
};
|
|
80524
|
+
class PassthroughAnalyticsProfiler {
|
|
80525
|
+
get prefix() {
|
|
80526
|
+
return "";
|
|
80527
|
+
}
|
|
80528
|
+
push(system) {
|
|
80529
|
+
}
|
|
80530
|
+
pop() {
|
|
80531
|
+
}
|
|
80532
|
+
popAndReturn(result) {
|
|
80533
|
+
return result;
|
|
80534
|
+
}
|
|
80535
|
+
async record(metric, fn) {
|
|
80536
|
+
return await fn();
|
|
80537
|
+
}
|
|
80538
|
+
recordSync(metric, fn) {
|
|
80539
|
+
return fn();
|
|
80540
|
+
}
|
|
80541
|
+
}
|
|
80524
80542
|
var AnalyticsSerializerTypes;
|
|
80525
80543
|
(function(AnalyticsSerializerTypes2) {
|
|
80526
80544
|
AnalyticsSerializerTypes2[AnalyticsSerializerTypes2["AnalyticsPath"] = 0] = "AnalyticsPath";
|
|
@@ -87072,6 +87090,606 @@ function friendlyDateTime(dateTimeish) {
|
|
|
87072
87090
|
);
|
|
87073
87091
|
}
|
|
87074
87092
|
}
|
|
87093
|
+
const getPeriodSeriesArray = (range) => {
|
|
87094
|
+
const result = [];
|
|
87095
|
+
const series = getPeriodSeries(range);
|
|
87096
|
+
let next2 = series.next();
|
|
87097
|
+
while (next2) {
|
|
87098
|
+
result.push(next2);
|
|
87099
|
+
next2 = series.next();
|
|
87100
|
+
}
|
|
87101
|
+
return result;
|
|
87102
|
+
};
|
|
87103
|
+
const getPeriodSeries = (range) => {
|
|
87104
|
+
return {
|
|
87105
|
+
...range,
|
|
87106
|
+
next: _createFactoryFn(range)
|
|
87107
|
+
};
|
|
87108
|
+
};
|
|
87109
|
+
const _createFactoryFn = (range) => {
|
|
87110
|
+
let current = range.start;
|
|
87111
|
+
return () => {
|
|
87112
|
+
if (current == null) {
|
|
87113
|
+
return null;
|
|
87114
|
+
}
|
|
87115
|
+
let result = null;
|
|
87116
|
+
switch (range.granularity) {
|
|
87117
|
+
case AnalyticsGranularity.Total:
|
|
87118
|
+
result = _nextTotalPeriod(current, range.end);
|
|
87119
|
+
break;
|
|
87120
|
+
case AnalyticsGranularity.Annual:
|
|
87121
|
+
result = _nextAnnualPeriod(current, range.end);
|
|
87122
|
+
break;
|
|
87123
|
+
case AnalyticsGranularity.SemiAnnual:
|
|
87124
|
+
result = _nextSemiAnnualPeriod(current, range.end);
|
|
87125
|
+
break;
|
|
87126
|
+
case AnalyticsGranularity.Quarterly:
|
|
87127
|
+
result = _nextQuarterlyPeriod(current, range.end);
|
|
87128
|
+
break;
|
|
87129
|
+
case AnalyticsGranularity.Monthly:
|
|
87130
|
+
result = _nextMonthlyPeriod(current, range.end);
|
|
87131
|
+
break;
|
|
87132
|
+
case AnalyticsGranularity.Weekly:
|
|
87133
|
+
result = _nextWeeklyPeriod(current, range.end);
|
|
87134
|
+
break;
|
|
87135
|
+
case AnalyticsGranularity.Daily:
|
|
87136
|
+
result = _nextDailyPeriod(current, range.end);
|
|
87137
|
+
break;
|
|
87138
|
+
case AnalyticsGranularity.Hourly:
|
|
87139
|
+
result = _nextHourlyPeriod(current, range.end);
|
|
87140
|
+
}
|
|
87141
|
+
if (result === null) {
|
|
87142
|
+
current = null;
|
|
87143
|
+
} else {
|
|
87144
|
+
current = result.end.plus({ milliseconds: 1 });
|
|
87145
|
+
}
|
|
87146
|
+
return result;
|
|
87147
|
+
};
|
|
87148
|
+
};
|
|
87149
|
+
const _nextTotalPeriod = (nextStart, seriesEnd) => {
|
|
87150
|
+
if (seriesEnd <= nextStart) {
|
|
87151
|
+
return null;
|
|
87152
|
+
}
|
|
87153
|
+
return {
|
|
87154
|
+
period: "total",
|
|
87155
|
+
start: nextStart,
|
|
87156
|
+
end: seriesEnd
|
|
87157
|
+
};
|
|
87158
|
+
};
|
|
87159
|
+
const _nextAnnualPeriod = (nextStart, seriesEnd) => {
|
|
87160
|
+
if (seriesEnd <= nextStart) {
|
|
87161
|
+
return null;
|
|
87162
|
+
}
|
|
87163
|
+
const inputUtc = nextStart.toUTC();
|
|
87164
|
+
const oneYearLater = DateTime.utc(inputUtc.year, inputUtc.month, inputUtc.day).plus({ years: 1 });
|
|
87165
|
+
return {
|
|
87166
|
+
period: "annual",
|
|
87167
|
+
start: nextStart,
|
|
87168
|
+
end: oneYearLater
|
|
87169
|
+
};
|
|
87170
|
+
};
|
|
87171
|
+
const _nextSemiAnnualPeriod = (nextStart, seriesEnd) => {
|
|
87172
|
+
if (seriesEnd <= nextStart) {
|
|
87173
|
+
return null;
|
|
87174
|
+
}
|
|
87175
|
+
const midYear = DateTime.utc(nextStart.year, 7, 1);
|
|
87176
|
+
const endYear = DateTime.utc(nextStart.year, 12, 31, 23, 59, 59, 999);
|
|
87177
|
+
let endDate;
|
|
87178
|
+
if (midYear > nextStart) {
|
|
87179
|
+
endDate = midYear;
|
|
87180
|
+
} else {
|
|
87181
|
+
endDate = endYear;
|
|
87182
|
+
}
|
|
87183
|
+
if (endDate > seriesEnd) {
|
|
87184
|
+
endDate = seriesEnd;
|
|
87185
|
+
}
|
|
87186
|
+
return {
|
|
87187
|
+
period: "semiAnnual",
|
|
87188
|
+
start: nextStart,
|
|
87189
|
+
end: endDate
|
|
87190
|
+
};
|
|
87191
|
+
};
|
|
87192
|
+
const _nextQuarterlyPeriod = (nextStart, seriesEnd) => {
|
|
87193
|
+
if (seriesEnd <= nextStart) {
|
|
87194
|
+
return null;
|
|
87195
|
+
}
|
|
87196
|
+
let endDate;
|
|
87197
|
+
const nextStartUtc = nextStart.toUTC();
|
|
87198
|
+
const startMonth = nextStartUtc.month;
|
|
87199
|
+
if (startMonth < 3) {
|
|
87200
|
+
endDate = DateTime.utc(nextStartUtc.year, 4, 1);
|
|
87201
|
+
} else if (startMonth < 6) {
|
|
87202
|
+
endDate = DateTime.utc(nextStartUtc.year, 7, 1);
|
|
87203
|
+
} else if (startMonth < 9) {
|
|
87204
|
+
endDate = DateTime.utc(nextStartUtc.year, 10, 1);
|
|
87205
|
+
} else {
|
|
87206
|
+
endDate = DateTime.utc(nextStartUtc.year, 12, 31, 23, 59, 59, 999);
|
|
87207
|
+
}
|
|
87208
|
+
if (endDate > seriesEnd) {
|
|
87209
|
+
endDate = seriesEnd;
|
|
87210
|
+
}
|
|
87211
|
+
return {
|
|
87212
|
+
period: "quarterly",
|
|
87213
|
+
start: nextStart,
|
|
87214
|
+
end: endDate
|
|
87215
|
+
};
|
|
87216
|
+
};
|
|
87217
|
+
const _nextMonthlyPeriod = (nextStart, seriesEnd) => {
|
|
87218
|
+
if (seriesEnd <= nextStart) {
|
|
87219
|
+
return null;
|
|
87220
|
+
}
|
|
87221
|
+
const nextStartUtc = nextStart.toUTC();
|
|
87222
|
+
let endDate = DateTime.utc(nextStartUtc.year, nextStartUtc.month, nextStartUtc.day).plus({ months: 1 }).startOf("month");
|
|
87223
|
+
if (endDate > seriesEnd) {
|
|
87224
|
+
if (!nextStart.hasSame(seriesEnd, "month")) {
|
|
87225
|
+
endDate = seriesEnd;
|
|
87226
|
+
}
|
|
87227
|
+
}
|
|
87228
|
+
return {
|
|
87229
|
+
period: "monthly",
|
|
87230
|
+
start: nextStart,
|
|
87231
|
+
end: endDate
|
|
87232
|
+
};
|
|
87233
|
+
};
|
|
87234
|
+
const _nextWeeklyPeriod = (nextStart, seriesEnd) => {
|
|
87235
|
+
if (seriesEnd <= nextStart) {
|
|
87236
|
+
return null;
|
|
87237
|
+
}
|
|
87238
|
+
const nextStartUtc = nextStart.toUTC();
|
|
87239
|
+
const nextWeekStartUTC = DateTime.utc(nextStartUtc.year, nextStartUtc.month, nextStartUtc.day).plus({ weeks: 1 }).startOf("week");
|
|
87240
|
+
if (nextWeekStartUTC > seriesEnd) {
|
|
87241
|
+
if (!nextWeekStartUTC.hasSame(seriesEnd, "day")) {
|
|
87242
|
+
return {
|
|
87243
|
+
period: "weekly",
|
|
87244
|
+
start: nextStart,
|
|
87245
|
+
end: seriesEnd
|
|
87246
|
+
};
|
|
87247
|
+
}
|
|
87248
|
+
}
|
|
87249
|
+
return {
|
|
87250
|
+
period: "weekly",
|
|
87251
|
+
start: nextStart,
|
|
87252
|
+
end: nextWeekStartUTC
|
|
87253
|
+
};
|
|
87254
|
+
};
|
|
87255
|
+
const _nextDailyPeriod = (nextStart, seriesEnd) => {
|
|
87256
|
+
if (seriesEnd <= nextStart) {
|
|
87257
|
+
return null;
|
|
87258
|
+
}
|
|
87259
|
+
const nextStartUtc = nextStart.toUTC();
|
|
87260
|
+
let endDate = nextStartUtc.plus({ days: 1 }).startOf("day");
|
|
87261
|
+
if (endDate > seriesEnd || endDate.hasSame(seriesEnd, "day")) {
|
|
87262
|
+
endDate = seriesEnd;
|
|
87263
|
+
}
|
|
87264
|
+
return {
|
|
87265
|
+
period: "daily",
|
|
87266
|
+
start: nextStart,
|
|
87267
|
+
end: endDate
|
|
87268
|
+
};
|
|
87269
|
+
};
|
|
87270
|
+
const _nextHourlyPeriod = (nextStart, seriesEnd) => {
|
|
87271
|
+
if (seriesEnd <= nextStart) {
|
|
87272
|
+
return null;
|
|
87273
|
+
}
|
|
87274
|
+
const startDate = nextStart.toUTC();
|
|
87275
|
+
let endDate = startDate.plus({ hours: 1 });
|
|
87276
|
+
if (endDate > seriesEnd) {
|
|
87277
|
+
if (nextStart.hour !== seriesEnd.hour) {
|
|
87278
|
+
endDate = seriesEnd.toUTC();
|
|
87279
|
+
}
|
|
87280
|
+
}
|
|
87281
|
+
return {
|
|
87282
|
+
period: "hourly",
|
|
87283
|
+
start: nextStart,
|
|
87284
|
+
end: endDate
|
|
87285
|
+
};
|
|
87286
|
+
};
|
|
87287
|
+
const getQuarter = (date) => {
|
|
87288
|
+
return Math.floor((date.month - 1) / 3) + 1;
|
|
87289
|
+
};
|
|
87290
|
+
class AnalyticsDiscretizer {
|
|
87291
|
+
static discretize(series, dimensions, start, end, granularity) {
|
|
87292
|
+
const index2 = this._buildIndex(series, dimensions);
|
|
87293
|
+
const periods = getPeriodSeriesArray(this._calculateRange(start, end, granularity, series));
|
|
87294
|
+
const disretizedResults = this._discretizeNode(index2, {}, dimensions, periods);
|
|
87295
|
+
const groupedResults = this._groupResultsByPeriod(periods, disretizedResults);
|
|
87296
|
+
return groupedResults;
|
|
87297
|
+
}
|
|
87298
|
+
static _calculateRange(start, end, granularity, results) {
|
|
87299
|
+
let calculatedStart = start || null;
|
|
87300
|
+
let calculatedEnd = end || null;
|
|
87301
|
+
if (calculatedStart == null || calculatedEnd == null) {
|
|
87302
|
+
for (const r2 of results) {
|
|
87303
|
+
if (calculatedStart == null) {
|
|
87304
|
+
calculatedStart = r2.start;
|
|
87305
|
+
}
|
|
87306
|
+
const endValue = r2.end || r2.start;
|
|
87307
|
+
if (calculatedEnd == null || calculatedEnd < endValue) {
|
|
87308
|
+
calculatedEnd = endValue;
|
|
87309
|
+
}
|
|
87310
|
+
}
|
|
87311
|
+
}
|
|
87312
|
+
if (calculatedStart == null || calculatedEnd == null) {
|
|
87313
|
+
throw new Error("Cannot determine query start and/or end.");
|
|
87314
|
+
}
|
|
87315
|
+
return {
|
|
87316
|
+
start: calculatedStart,
|
|
87317
|
+
end: calculatedEnd,
|
|
87318
|
+
granularity
|
|
87319
|
+
};
|
|
87320
|
+
}
|
|
87321
|
+
static _groupResultsByPeriod(periods, dimensionedResults) {
|
|
87322
|
+
const result = {};
|
|
87323
|
+
for (const p2 of periods) {
|
|
87324
|
+
const id = p2.start.toISO() + "-" + p2.period;
|
|
87325
|
+
const period = AnalyticsDiscretizer._getPeriodString(p2);
|
|
87326
|
+
result[id] = {
|
|
87327
|
+
period,
|
|
87328
|
+
start: p2.start,
|
|
87329
|
+
end: p2.end,
|
|
87330
|
+
rows: []
|
|
87331
|
+
};
|
|
87332
|
+
}
|
|
87333
|
+
for (const r2 of dimensionedResults) {
|
|
87334
|
+
for (const period of Object.keys(r2.series)) {
|
|
87335
|
+
result[period].rows.push({
|
|
87336
|
+
dimensions: r2.dimensions,
|
|
87337
|
+
metric: r2.metric,
|
|
87338
|
+
unit: r2.unit == "__NULL__" ? null : r2.unit,
|
|
87339
|
+
value: r2.series[period].inc,
|
|
87340
|
+
sum: r2.series[period].sum
|
|
87341
|
+
});
|
|
87342
|
+
}
|
|
87343
|
+
}
|
|
87344
|
+
return Object.values(result);
|
|
87345
|
+
}
|
|
87346
|
+
static _getPeriodString(p2) {
|
|
87347
|
+
switch (p2.period) {
|
|
87348
|
+
case "annual":
|
|
87349
|
+
return p2.start.year.toString();
|
|
87350
|
+
case "semiAnnual":
|
|
87351
|
+
return `${p2.start.year}/${p2.start.month < 7 ? "H1" : "H2"}`;
|
|
87352
|
+
case "quarterly":
|
|
87353
|
+
return `${p2.start.year}/Q${getQuarter(p2.start)}`;
|
|
87354
|
+
case "monthly":
|
|
87355
|
+
const month = p2.start.toUTC().month;
|
|
87356
|
+
const formattedMonth = month < 10 ? `0${month}` : `${month}`;
|
|
87357
|
+
return `${p2.start.year}/${formattedMonth}`;
|
|
87358
|
+
case "weekly":
|
|
87359
|
+
return `${p2.start.weekYear}/W${p2.start.weekNumber}`;
|
|
87360
|
+
case "daily":
|
|
87361
|
+
const monthD = p2.start.month;
|
|
87362
|
+
const day = p2.start.day;
|
|
87363
|
+
const formattedMonthD = monthD < 10 ? `0${monthD}` : `${monthD}`;
|
|
87364
|
+
const formattedDay = day < 10 ? `0${day}` : `${day}`;
|
|
87365
|
+
return `${p2.start.year}/${formattedMonthD}/${formattedDay}`;
|
|
87366
|
+
case "hourly":
|
|
87367
|
+
const monthH = p2.start.month;
|
|
87368
|
+
const dayH = p2.start.day;
|
|
87369
|
+
const hourH = p2.start.hour;
|
|
87370
|
+
const formattedMonthH = monthH < 10 ? `0${monthH}` : `${monthH}`;
|
|
87371
|
+
const formattedDayH = dayH < 10 ? `0${dayH}` : `${dayH}`;
|
|
87372
|
+
const formattedHourH = hourH < 10 ? `0${hourH}` : `${hourH}`;
|
|
87373
|
+
return `${p2.start.year}/${formattedMonthH}/${formattedDayH}/${formattedHourH}`;
|
|
87374
|
+
default:
|
|
87375
|
+
return p2.period;
|
|
87376
|
+
}
|
|
87377
|
+
}
|
|
87378
|
+
static _discretizeNode(node2, dimensionValues, remainingDimensions, periods) {
|
|
87379
|
+
const result = [];
|
|
87380
|
+
if (remainingDimensions.length > 0) {
|
|
87381
|
+
const subdimension = remainingDimensions[0];
|
|
87382
|
+
Object.keys(node2).forEach((subdimensionValue, index2, arr) => {
|
|
87383
|
+
const newDimensionValues = { ...dimensionValues };
|
|
87384
|
+
newDimensionValues[subdimension] = subdimensionValue;
|
|
87385
|
+
result.push(...this._discretizeNode(node2[subdimensionValue], newDimensionValues, remainingDimensions.slice(1), periods));
|
|
87386
|
+
});
|
|
87387
|
+
} else {
|
|
87388
|
+
Object.keys(node2).forEach((metric) => {
|
|
87389
|
+
result.push(...this._discretizeLeaf(node2[metric], periods, metric, dimensionValues));
|
|
87390
|
+
});
|
|
87391
|
+
}
|
|
87392
|
+
return result;
|
|
87393
|
+
}
|
|
87394
|
+
static _discretizeLeaf(leaf, periods, metric, dimensionValues) {
|
|
87395
|
+
const result = [];
|
|
87396
|
+
Object.keys(leaf).forEach((unit) => {
|
|
87397
|
+
const metaDimensions = {};
|
|
87398
|
+
Object.keys(dimensionValues).forEach((k2) => {
|
|
87399
|
+
metaDimensions[k2] = {
|
|
87400
|
+
path: leaf[unit][0].dimensions[k2],
|
|
87401
|
+
icon: leaf[unit][0].dimensions.icon,
|
|
87402
|
+
label: leaf[unit][0].dimensions.label,
|
|
87403
|
+
description: leaf[unit][0].dimensions.description
|
|
87404
|
+
};
|
|
87405
|
+
});
|
|
87406
|
+
result.push({
|
|
87407
|
+
unit,
|
|
87408
|
+
metric,
|
|
87409
|
+
dimensions: metaDimensions,
|
|
87410
|
+
series: this._discretizeSeries(leaf[unit], periods)
|
|
87411
|
+
});
|
|
87412
|
+
});
|
|
87413
|
+
return result;
|
|
87414
|
+
}
|
|
87415
|
+
static _discretizeSeries(series, periods) {
|
|
87416
|
+
const result = {};
|
|
87417
|
+
for (const s2 of series) {
|
|
87418
|
+
let oldSum = this._getValue(s2, periods[0].start);
|
|
87419
|
+
for (const p2 of periods) {
|
|
87420
|
+
const newSum = this._getValue(s2, p2.end);
|
|
87421
|
+
const id = `${p2.start.toISO()}-${p2.period}`;
|
|
87422
|
+
if (result[id]) {
|
|
87423
|
+
result[id].inc += newSum - oldSum;
|
|
87424
|
+
result[id].sum += newSum;
|
|
87425
|
+
} else {
|
|
87426
|
+
result[id] = {
|
|
87427
|
+
inc: newSum - oldSum,
|
|
87428
|
+
sum: newSum
|
|
87429
|
+
};
|
|
87430
|
+
}
|
|
87431
|
+
oldSum = newSum;
|
|
87432
|
+
}
|
|
87433
|
+
}
|
|
87434
|
+
return result;
|
|
87435
|
+
}
|
|
87436
|
+
static _getValue(series, when) {
|
|
87437
|
+
switch (series.fn) {
|
|
87438
|
+
case "Single":
|
|
87439
|
+
return this._getSingleValue(series, when);
|
|
87440
|
+
case "DssVest":
|
|
87441
|
+
return this._getVestValue(series, when);
|
|
87442
|
+
default:
|
|
87443
|
+
return 0;
|
|
87444
|
+
}
|
|
87445
|
+
}
|
|
87446
|
+
static _getSingleValue(series, when) {
|
|
87447
|
+
return when >= series.start ? series.value : 0;
|
|
87448
|
+
}
|
|
87449
|
+
static _getVestValue(series, when) {
|
|
87450
|
+
var _a2;
|
|
87451
|
+
const now2 = when;
|
|
87452
|
+
const start = series.start;
|
|
87453
|
+
const end = series.end;
|
|
87454
|
+
const cliff = ((_a2 = series.params) == null ? void 0 : _a2.cliff) ? DateTime.fromISO(series.params.cliff) : null;
|
|
87455
|
+
if (now2 < start || cliff && now2 < cliff) {
|
|
87456
|
+
return 0;
|
|
87457
|
+
} else if (end && now2 >= end) {
|
|
87458
|
+
return series.value;
|
|
87459
|
+
}
|
|
87460
|
+
const a2 = Interval.fromDateTimes(start, now2);
|
|
87461
|
+
const b2 = Interval.fromDateTimes(start, end || now2);
|
|
87462
|
+
return a2.length() / b2.length() * series.value;
|
|
87463
|
+
}
|
|
87464
|
+
static _buildIndex(series, dimensions) {
|
|
87465
|
+
const result = {};
|
|
87466
|
+
const map = {};
|
|
87467
|
+
const dimName = dimensions[0] || "";
|
|
87468
|
+
for (const s2 of series) {
|
|
87469
|
+
const dimValue = s2.dimensions[dimName];
|
|
87470
|
+
if (void 0 === map[dimValue]) {
|
|
87471
|
+
map[dimValue] = [];
|
|
87472
|
+
}
|
|
87473
|
+
map[dimValue].push(s2);
|
|
87474
|
+
}
|
|
87475
|
+
if (dimensions.length > 1) {
|
|
87476
|
+
const newDimensions = dimensions.slice(1);
|
|
87477
|
+
Object.keys(map).forEach((k2) => {
|
|
87478
|
+
result[k2] = this._buildIndex(map[k2], newDimensions);
|
|
87479
|
+
});
|
|
87480
|
+
} else {
|
|
87481
|
+
Object.keys(map).forEach((k2) => {
|
|
87482
|
+
result[k2] = this._buildMetricsIndex(map[k2]);
|
|
87483
|
+
});
|
|
87484
|
+
}
|
|
87485
|
+
return result;
|
|
87486
|
+
}
|
|
87487
|
+
static _buildMetricsIndex(series) {
|
|
87488
|
+
const result = {};
|
|
87489
|
+
const map = {};
|
|
87490
|
+
for (const s2 of series) {
|
|
87491
|
+
const metric = s2.metric;
|
|
87492
|
+
if (void 0 === map[metric]) {
|
|
87493
|
+
map[metric] = [];
|
|
87494
|
+
}
|
|
87495
|
+
map[metric].push(s2);
|
|
87496
|
+
}
|
|
87497
|
+
Object.keys(map).forEach((k2) => result[k2] = this._buildUnitIndex(map[k2]));
|
|
87498
|
+
return result;
|
|
87499
|
+
}
|
|
87500
|
+
static _buildUnitIndex(series) {
|
|
87501
|
+
const result = {};
|
|
87502
|
+
for (const s2 of series) {
|
|
87503
|
+
const unit = s2.unit || "__NULL__";
|
|
87504
|
+
if (void 0 === result[unit]) {
|
|
87505
|
+
result[unit] = [];
|
|
87506
|
+
}
|
|
87507
|
+
result[unit].push(s2);
|
|
87508
|
+
}
|
|
87509
|
+
return result;
|
|
87510
|
+
}
|
|
87511
|
+
}
|
|
87512
|
+
class AnalyticsQueryEngine {
|
|
87513
|
+
constructor(_analyticsStore, profiler) {
|
|
87514
|
+
__publicField(this, "_analyticsStore");
|
|
87515
|
+
__publicField(this, "_profiler");
|
|
87516
|
+
this._analyticsStore = _analyticsStore;
|
|
87517
|
+
this._profiler = profiler ?? new PassthroughAnalyticsProfiler();
|
|
87518
|
+
}
|
|
87519
|
+
async executeCompound(query) {
|
|
87520
|
+
let result;
|
|
87521
|
+
const inputsQuery = {
|
|
87522
|
+
start: query.start,
|
|
87523
|
+
end: query.end,
|
|
87524
|
+
granularity: query.granularity,
|
|
87525
|
+
lod: query.lod,
|
|
87526
|
+
select: query.select,
|
|
87527
|
+
metrics: query.expression.inputs.metrics,
|
|
87528
|
+
currency: query.expression.inputs.currency
|
|
87529
|
+
};
|
|
87530
|
+
const operandQuery = {
|
|
87531
|
+
start: query.start,
|
|
87532
|
+
end: query.end,
|
|
87533
|
+
granularity: query.granularity,
|
|
87534
|
+
lod: { priceData: 1 },
|
|
87535
|
+
select: { priceData: [AnalyticsPath.fromString("atlas")] },
|
|
87536
|
+
metrics: [query.expression.operand.metric],
|
|
87537
|
+
currency: query.expression.operand.currency
|
|
87538
|
+
};
|
|
87539
|
+
const inputExecute = await this.execute(inputsQuery);
|
|
87540
|
+
const operandExecute = await this.execute(operandQuery);
|
|
87541
|
+
if ([CompoundOperator.VectorAdd, CompoundOperator.VectorSubtract].includes(query.expression.operator)) {
|
|
87542
|
+
result = await this._profiler.record("ApplyVectorOperator", async () => await this._applyVectorOperator(inputExecute, operandExecute, query.expression.operator, query.expression.resultCurrency));
|
|
87543
|
+
} else {
|
|
87544
|
+
result = await this._profiler.record("ApplyScalarOperator", async () => await this._applyScalarOperator(inputExecute, operandExecute, query.expression.operator, query.expression.operand.useSum, query.expression.resultCurrency));
|
|
87545
|
+
}
|
|
87546
|
+
return result;
|
|
87547
|
+
}
|
|
87548
|
+
async execute(query) {
|
|
87549
|
+
const seriesResults = await this._executeSeriesQuery(query);
|
|
87550
|
+
const normalizedSeriesResults = this._profiler.recordSync("ApplyLODs", () => this._applyLods(seriesResults, query.lod));
|
|
87551
|
+
const dimensions = Object.keys(query.select);
|
|
87552
|
+
const discretizedResult = this._profiler.recordSync("Discretize", () => normalizedSeriesResults.length < 1 ? [] : AnalyticsDiscretizer.discretize(normalizedSeriesResults, dimensions, query.start, query.end, query.granularity));
|
|
87553
|
+
return discretizedResult;
|
|
87554
|
+
}
|
|
87555
|
+
async executeMultiCurrency(query, mcc) {
|
|
87556
|
+
const baseQuery = {
|
|
87557
|
+
...query,
|
|
87558
|
+
currency: mcc.targetCurrency
|
|
87559
|
+
};
|
|
87560
|
+
let result = await this.execute(baseQuery);
|
|
87561
|
+
for (const conversion of mcc.conversions) {
|
|
87562
|
+
const nextQuery = {
|
|
87563
|
+
start: query.start,
|
|
87564
|
+
end: query.end,
|
|
87565
|
+
granularity: query.granularity,
|
|
87566
|
+
lod: query.lod,
|
|
87567
|
+
select: query.select,
|
|
87568
|
+
expression: {
|
|
87569
|
+
inputs: {
|
|
87570
|
+
metrics: baseQuery.metrics,
|
|
87571
|
+
currency: conversion.currency
|
|
87572
|
+
},
|
|
87573
|
+
operator: CompoundOperator.ScalarMultiply,
|
|
87574
|
+
operand: {
|
|
87575
|
+
metric: conversion.metric,
|
|
87576
|
+
currency: mcc.targetCurrency,
|
|
87577
|
+
useSum: true
|
|
87578
|
+
},
|
|
87579
|
+
resultCurrency: mcc.targetCurrency
|
|
87580
|
+
}
|
|
87581
|
+
};
|
|
87582
|
+
const executedCompound = await this.executeCompound(nextQuery);
|
|
87583
|
+
result = await this._applyVectorOperator(result, executedCompound, CompoundOperator.VectorAdd, mcc.targetCurrency);
|
|
87584
|
+
}
|
|
87585
|
+
return result;
|
|
87586
|
+
}
|
|
87587
|
+
async _applyVectorOperator(inputsA, inputsB, operator, resultCurrency) {
|
|
87588
|
+
if ([CompoundOperator.ScalarMultiply, CompoundOperator.ScalarDivide].includes(operator)) {
|
|
87589
|
+
throw new Error("Invalid operator for vector operation");
|
|
87590
|
+
}
|
|
87591
|
+
return inputsB;
|
|
87592
|
+
}
|
|
87593
|
+
async _applyScalarOperator(inputs, operand, operator, useOperandSum, resultCurrency) {
|
|
87594
|
+
if ([CompoundOperator.VectorAdd, CompoundOperator.VectorSubtract].includes(operator)) {
|
|
87595
|
+
throw new Error("Invalid operator for scalar operation");
|
|
87596
|
+
}
|
|
87597
|
+
const result = [];
|
|
87598
|
+
const operandMap = {};
|
|
87599
|
+
const key = useOperandSum ? "sum" : "value";
|
|
87600
|
+
for (const operandPeriod of operand) {
|
|
87601
|
+
if (operandPeriod.rows.length > 0) {
|
|
87602
|
+
operandMap[operandPeriod.period] = operandPeriod.rows[0][key];
|
|
87603
|
+
}
|
|
87604
|
+
}
|
|
87605
|
+
for (const inputPeriod of inputs) {
|
|
87606
|
+
const outputPeriod = {
|
|
87607
|
+
period: inputPeriod.period,
|
|
87608
|
+
start: inputPeriod.start,
|
|
87609
|
+
end: inputPeriod.end,
|
|
87610
|
+
rows: inputPeriod.rows.map((row) => {
|
|
87611
|
+
const newRow = {
|
|
87612
|
+
dimensions: row.dimensions,
|
|
87613
|
+
metric: row.metric,
|
|
87614
|
+
unit: resultCurrency.toString(),
|
|
87615
|
+
value: this._calculateOutputValue(row.value, operator, operandMap[inputPeriod.period]),
|
|
87616
|
+
sum: -1
|
|
87617
|
+
};
|
|
87618
|
+
return newRow;
|
|
87619
|
+
})
|
|
87620
|
+
};
|
|
87621
|
+
result.push(outputPeriod);
|
|
87622
|
+
}
|
|
87623
|
+
return result;
|
|
87624
|
+
}
|
|
87625
|
+
_calculateOutputValue(input, operator, operand) {
|
|
87626
|
+
switch (operator) {
|
|
87627
|
+
case CompoundOperator.VectorAdd:
|
|
87628
|
+
return input + operand;
|
|
87629
|
+
case CompoundOperator.VectorSubtract:
|
|
87630
|
+
return input - operand;
|
|
87631
|
+
case CompoundOperator.ScalarMultiply:
|
|
87632
|
+
return input * operand;
|
|
87633
|
+
case CompoundOperator.ScalarDivide:
|
|
87634
|
+
return input / operand;
|
|
87635
|
+
}
|
|
87636
|
+
}
|
|
87637
|
+
async _executeSeriesQuery(query) {
|
|
87638
|
+
const seriesQuery = {
|
|
87639
|
+
start: query.start,
|
|
87640
|
+
end: query.end,
|
|
87641
|
+
currency: query.currency,
|
|
87642
|
+
select: query.select,
|
|
87643
|
+
metrics: query.metrics
|
|
87644
|
+
};
|
|
87645
|
+
return await this._analyticsStore.getMatchingSeries(seriesQuery);
|
|
87646
|
+
}
|
|
87647
|
+
_applyLods(series, lods) {
|
|
87648
|
+
return series.map((result) => ({
|
|
87649
|
+
...result,
|
|
87650
|
+
dimensions: this._applyDimensionsLods(result.dimensions, lods)
|
|
87651
|
+
}));
|
|
87652
|
+
}
|
|
87653
|
+
_applyDimensionsLods(dimensionMap, lods) {
|
|
87654
|
+
const result = {};
|
|
87655
|
+
for (const [dimension, lod] of Object.entries(lods)) {
|
|
87656
|
+
if (lod !== null && dimensionMap[dimension]) {
|
|
87657
|
+
result[dimension] = dimensionMap[dimension]["path"].applyLod(lod).toString();
|
|
87658
|
+
result["icon"] = dimensionMap[dimension]["icon"].toString();
|
|
87659
|
+
result["label"] = dimensionMap[dimension]["label"].toString();
|
|
87660
|
+
result["description"] = dimensionMap[dimension]["description"].toString();
|
|
87661
|
+
}
|
|
87662
|
+
}
|
|
87663
|
+
return result;
|
|
87664
|
+
}
|
|
87665
|
+
async getDimensions() {
|
|
87666
|
+
return await this._analyticsStore.getDimensions();
|
|
87667
|
+
}
|
|
87668
|
+
}
|
|
87669
|
+
const AnalyticsContext = createContext(null);
|
|
87670
|
+
const defaultQueryClient = new QueryClient();
|
|
87671
|
+
function AnalyticsProvider({ children, store, queryClient = defaultQueryClient }) {
|
|
87672
|
+
const engine = new AnalyticsQueryEngine(store);
|
|
87673
|
+
const content = jsx$1(AnalyticsContext.Provider, { value: { store, engine }, children });
|
|
87674
|
+
if (queryClient === false) {
|
|
87675
|
+
return content;
|
|
87676
|
+
}
|
|
87677
|
+
return jsx$1(QueryClientProvider, { client: queryClient, children: content });
|
|
87678
|
+
}
|
|
87679
|
+
function useAnalyticsStore() {
|
|
87680
|
+
const context = useContext(AnalyticsContext);
|
|
87681
|
+
if (!(context == null ? void 0 : context.store)) {
|
|
87682
|
+
throw new Error("No analytics store available. Use within an AnalyticsProvider.");
|
|
87683
|
+
}
|
|
87684
|
+
return context.store;
|
|
87685
|
+
}
|
|
87686
|
+
function useAnalyticsEngine() {
|
|
87687
|
+
const context = useContext(AnalyticsContext);
|
|
87688
|
+
if (!(context == null ? void 0 : context.engine)) {
|
|
87689
|
+
throw new Error("No analytics engine available. Use within an AnalyticsProvider.");
|
|
87690
|
+
}
|
|
87691
|
+
return context.engine;
|
|
87692
|
+
}
|
|
87075
87693
|
function diffDocumentStates(doc1, doc2) {
|
|
87076
87694
|
const changes = [];
|
|
87077
87695
|
const globalChanges = diffStateObjects(doc1, doc2, "state.global", "global");
|
|
@@ -87338,9 +87956,9 @@ class ProcessorManager {
|
|
|
87338
87956
|
}
|
|
87339
87957
|
async function createAnalyticsStore() {
|
|
87340
87958
|
const { BrowserAnalyticsStore } = await __vitePreload(async () => {
|
|
87341
|
-
const { BrowserAnalyticsStore: BrowserAnalyticsStore2 } = await import("./browser-
|
|
87959
|
+
const { BrowserAnalyticsStore: BrowserAnalyticsStore2 } = await import("./browser-CzAjKVis.js");
|
|
87342
87960
|
return { BrowserAnalyticsStore: BrowserAnalyticsStore2 };
|
|
87343
|
-
}, true ? __vite__mapDeps([7,2,1,3
|
|
87961
|
+
}, true ? __vite__mapDeps([7,2,1,3]) : void 0);
|
|
87344
87962
|
const store = new BrowserAnalyticsStore({
|
|
87345
87963
|
databaseName: `${connectConfig.routerBasename}:analytics`
|
|
87346
87964
|
});
|
|
@@ -87384,7 +88002,7 @@ atomStore.sub(reactorAtom, () => {
|
|
|
87384
88002
|
return atomStore.get(processorManagerAtom);
|
|
87385
88003
|
});
|
|
87386
88004
|
const Router = React__default.lazy(async () => {
|
|
87387
|
-
const createRouterComponent = await __vitePreload(() => import("./router-
|
|
88005
|
+
const createRouterComponent = await __vitePreload(() => import("./router-LLmzUc4B.js").then((n2) => n2.r), true ? __vite__mapDeps([8,1,2,3]) : void 0);
|
|
87388
88006
|
const router = await createRouterComponent.default();
|
|
87389
88007
|
return { default: router };
|
|
87390
88008
|
});
|
|
@@ -87396,7 +88014,7 @@ const Preloader = () => {
|
|
|
87396
88014
|
return null;
|
|
87397
88015
|
};
|
|
87398
88016
|
const ReactorAnalyticsProvider = lazy(
|
|
87399
|
-
() => __vitePreload(() => import("./reactor-analytics-
|
|
88017
|
+
() => __vitePreload(() => import("./reactor-analytics-BUR_Njds.js"), true ? __vite__mapDeps([9,1,2,3]) : void 0)
|
|
87400
88018
|
);
|
|
87401
88019
|
const App = () => /* @__PURE__ */ jsx$1(React__default.StrictMode, { children: /* @__PURE__ */ jsx$1(Suspense, { fallback: /* @__PURE__ */ jsx$1(Fragment, {}), children: /* @__PURE__ */ jsxs(Provider, { store: atomStore, children: [
|
|
87402
88020
|
/* @__PURE__ */ jsx$1(Preloader, {}),
|
|
@@ -87449,114 +88067,114 @@ export {
|
|
|
87449
88067
|
ModalManager as Z,
|
|
87450
88068
|
isElectron as _,
|
|
87451
88069
|
PopoverTrigger as a,
|
|
87452
|
-
|
|
88070
|
+
isHex as a$,
|
|
87453
88071
|
Outlet as a0,
|
|
87454
88072
|
useGetAppNameForEditorId as a1,
|
|
87455
88073
|
createMemoryRouter as a2,
|
|
87456
|
-
|
|
87457
|
-
|
|
87458
|
-
|
|
87459
|
-
|
|
87460
|
-
|
|
87461
|
-
|
|
87462
|
-
|
|
87463
|
-
|
|
87464
|
-
|
|
87465
|
-
|
|
87466
|
-
|
|
87467
|
-
|
|
87468
|
-
|
|
87469
|
-
|
|
87470
|
-
|
|
87471
|
-
|
|
87472
|
-
|
|
87473
|
-
|
|
87474
|
-
|
|
87475
|
-
|
|
87476
|
-
|
|
87477
|
-
|
|
87478
|
-
|
|
87479
|
-
|
|
87480
|
-
|
|
87481
|
-
|
|
87482
|
-
|
|
87483
|
-
|
|
87484
|
-
|
|
87485
|
-
|
|
87486
|
-
|
|
87487
|
-
|
|
87488
|
-
|
|
87489
|
-
|
|
87490
|
-
|
|
87491
|
-
|
|
87492
|
-
|
|
87493
|
-
|
|
87494
|
-
|
|
87495
|
-
|
|
87496
|
-
|
|
87497
|
-
|
|
87498
|
-
|
|
87499
|
-
|
|
87500
|
-
|
|
87501
|
-
|
|
87502
|
-
|
|
87503
|
-
|
|
87504
|
-
|
|
87505
|
-
|
|
87506
|
-
|
|
87507
|
-
|
|
87508
|
-
|
|
87509
|
-
|
|
87510
|
-
|
|
87511
|
-
|
|
87512
|
-
|
|
87513
|
-
|
|
87514
|
-
|
|
87515
|
-
|
|
88074
|
+
useUnwrappedAnalyticsStore as a3,
|
|
88075
|
+
AnalyticsProvider as a4,
|
|
88076
|
+
rawKeyInHexfromUncompressed as a5,
|
|
88077
|
+
compressedKeyInHexfromRaw as a6,
|
|
88078
|
+
encodeDIDfromHexString as a7,
|
|
88079
|
+
RENOWN_URL as a8,
|
|
88080
|
+
getEnsInfo as a9,
|
|
88081
|
+
setAuthorName as aA,
|
|
88082
|
+
setAuthorWebsite as aB,
|
|
88083
|
+
setStateSchema as aC,
|
|
88084
|
+
setInitialState as aD,
|
|
88085
|
+
addModule as aE,
|
|
88086
|
+
setModuleName as aF,
|
|
88087
|
+
deleteModule as aG,
|
|
88088
|
+
addOperation as aH,
|
|
88089
|
+
setOperationName as aI,
|
|
88090
|
+
setOperationSchema as aJ,
|
|
88091
|
+
setOperationDescription as aK,
|
|
88092
|
+
deleteOperation as aL,
|
|
88093
|
+
addOperationError as aM,
|
|
88094
|
+
deleteOperationError as aN,
|
|
88095
|
+
setOperationErrorName as aO,
|
|
88096
|
+
DateTime as aP,
|
|
88097
|
+
AnalyticsPath as aQ,
|
|
88098
|
+
PassthroughAnalyticsProfiler as aR,
|
|
88099
|
+
BaseError$3 as aS,
|
|
88100
|
+
getUrl as aT,
|
|
88101
|
+
stringify$1 as aU,
|
|
88102
|
+
decodeErrorResult as aV,
|
|
88103
|
+
isAddressEqual as aW,
|
|
88104
|
+
call as aX,
|
|
88105
|
+
concat$3 as aY,
|
|
88106
|
+
encodeAbiParameters as aZ,
|
|
88107
|
+
HttpRequestError as a_,
|
|
88108
|
+
getHMRModule as aa,
|
|
88109
|
+
addExternalPackage as ab,
|
|
88110
|
+
removeExternalPackage as ac,
|
|
88111
|
+
subscribeExternalPackages as ad,
|
|
88112
|
+
RENOWN_NETWORK_ID as ae,
|
|
88113
|
+
RENOWN_CHAIN_ID as af,
|
|
88114
|
+
getChain as ag,
|
|
88115
|
+
clsx as ah,
|
|
88116
|
+
get as ai,
|
|
88117
|
+
set as aj,
|
|
88118
|
+
appendErrors as ak,
|
|
88119
|
+
useFormContext as al,
|
|
88120
|
+
Primitive as am,
|
|
88121
|
+
cva as an,
|
|
88122
|
+
FormProvider as ao,
|
|
88123
|
+
Controller as ap,
|
|
88124
|
+
Slot as aq,
|
|
88125
|
+
useForm as ar,
|
|
88126
|
+
Root2 as as,
|
|
88127
|
+
List as at,
|
|
88128
|
+
Trigger as au,
|
|
88129
|
+
Content$1 as av,
|
|
88130
|
+
setModelName as aw,
|
|
88131
|
+
setModelId as ax,
|
|
88132
|
+
setModelDescription as ay,
|
|
88133
|
+
setModelExtension as az,
|
|
87516
88134
|
PopoverContent as b,
|
|
87517
|
-
|
|
87518
|
-
|
|
87519
|
-
|
|
87520
|
-
|
|
87521
|
-
|
|
87522
|
-
|
|
87523
|
-
|
|
87524
|
-
|
|
87525
|
-
|
|
87526
|
-
|
|
87527
|
-
|
|
87528
|
-
|
|
87529
|
-
|
|
88135
|
+
mergeClassNameProps as b0,
|
|
88136
|
+
MISSING as b1,
|
|
88137
|
+
SYNCING as b2,
|
|
88138
|
+
INITIAL_SYNC as b3,
|
|
88139
|
+
ConnectDropdownMenu as b4,
|
|
88140
|
+
useOnClickOutside as b5,
|
|
88141
|
+
useEventListener as b6,
|
|
88142
|
+
useCopyToClipboard as b7,
|
|
88143
|
+
Select as b8,
|
|
88144
|
+
Provider$1 as b9,
|
|
88145
|
+
AnalyticsGranularity as bA,
|
|
88146
|
+
useGetEditor as bB,
|
|
88147
|
+
isSameDocument as bC,
|
|
87530
88148
|
useFilteredDocumentModels as bD,
|
|
87531
88149
|
useDriveEditor as bE,
|
|
87532
88150
|
useDocumentDriveById as bF,
|
|
87533
88151
|
app as bG,
|
|
87534
|
-
|
|
87535
|
-
|
|
87536
|
-
|
|
87537
|
-
|
|
87538
|
-
|
|
87539
|
-
|
|
87540
|
-
|
|
87541
|
-
|
|
87542
|
-
|
|
87543
|
-
|
|
87544
|
-
|
|
87545
|
-
|
|
87546
|
-
|
|
87547
|
-
|
|
87548
|
-
|
|
87549
|
-
|
|
87550
|
-
|
|
87551
|
-
|
|
87552
|
-
|
|
87553
|
-
|
|
87554
|
-
|
|
87555
|
-
|
|
87556
|
-
|
|
87557
|
-
|
|
87558
|
-
|
|
87559
|
-
|
|
88152
|
+
Root3 as ba,
|
|
88153
|
+
Trigger$1 as bb,
|
|
88154
|
+
Portal as bc,
|
|
88155
|
+
Content2 as bd,
|
|
88156
|
+
validateInitialState as be,
|
|
88157
|
+
validateStateSchemaName as bf,
|
|
88158
|
+
validateModules as bg,
|
|
88159
|
+
useDocumentDrives as bh,
|
|
88160
|
+
useDriveContext as bi,
|
|
88161
|
+
FILE as bj,
|
|
88162
|
+
useConnectDid as bk,
|
|
88163
|
+
useConnectCrypto as bl,
|
|
88164
|
+
useAtomValue as bm,
|
|
88165
|
+
themeAtom as bn,
|
|
88166
|
+
useUser as bo,
|
|
88167
|
+
useUserPermissions as bp,
|
|
88168
|
+
exportFile as bq,
|
|
88169
|
+
useGetDocumentModelModule as br,
|
|
88170
|
+
addActionContext as bs,
|
|
88171
|
+
signOperation as bt,
|
|
88172
|
+
useHotkeys as bu,
|
|
88173
|
+
DriveLayout as bv,
|
|
88174
|
+
DriveContextProvider as bw,
|
|
88175
|
+
SearchBar as bx,
|
|
88176
|
+
useAnalyticsEngine as by,
|
|
88177
|
+
useAnalyticsStore as bz,
|
|
87560
88178
|
getEnsName as c,
|
|
87561
88179
|
BaseError$1 as d,
|
|
87562
88180
|
resolveStaleTime as e,
|
|
@@ -87582,4 +88200,4 @@ export {
|
|
|
87582
88200
|
useRoutesImpl as y,
|
|
87583
88201
|
mapRouteProperties as z
|
|
87584
88202
|
};
|
|
87585
|
-
//# sourceMappingURL=app-
|
|
88203
|
+
//# sourceMappingURL=app-BdUxze73.js.map
|