@powerhousedao/common 6.0.0-dev.2 → 6.0.0-dev.200
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/chunk-ZRW5x4aP.js +27 -0
- package/dist/drive-analytics.d.ts +52 -1
- package/dist/drive-analytics.d.ts.map +1 -1
- package/dist/drive-analytics.js +70 -1
- package/dist/drive-analytics.js.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -4
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +57 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +17 -67
- package/dist/drive-analytics/index.d.ts +0 -4
- package/dist/drive-analytics/index.d.ts.map +0 -1
- package/dist/drive-analytics/index.js +0 -4
- package/dist/drive-analytics/index.js.map +0 -1
- package/dist/drive-analytics/processor/document-processor.d.ts +0 -11
- package/dist/drive-analytics/processor/document-processor.d.ts.map +0 -1
- package/dist/drive-analytics/processor/document-processor.js +0 -67
- package/dist/drive-analytics/processor/document-processor.js.map +0 -1
- package/dist/drive-analytics/processor/drive-processor.d.ts +0 -12
- package/dist/drive-analytics/processor/drive-processor.d.ts.map +0 -1
- package/dist/drive-analytics/processor/drive-processor.js +0 -107
- package/dist/drive-analytics/processor/drive-processor.js.map +0 -1
- package/dist/drive-analytics/processor/index.d.ts +0 -10
- package/dist/drive-analytics/processor/index.d.ts.map +0 -1
- package/dist/drive-analytics/processor/index.js +0 -28
- package/dist/drive-analytics/processor/index.js.map +0 -1
- package/dist/drive-analytics/processor/types.d.ts +0 -3
- package/dist/drive-analytics/processor/types.d.ts.map +0 -1
- package/dist/drive-analytics/processor/types.js +0 -2
- package/dist/drive-analytics/processor/types.js.map +0 -1
- package/dist/drive-analytics/useDocumentAnalytics.d.ts +0 -24
- package/dist/drive-analytics/useDocumentAnalytics.d.ts.map +0 -1
- package/dist/drive-analytics/useDocumentAnalytics.js +0 -61
- package/dist/drive-analytics/useDocumentAnalytics.js.map +0 -1
- package/dist/drive-analytics/useDriveAnalytics.d.ts +0 -21
- package/dist/drive-analytics/useDriveAnalytics.d.ts.map +0 -1
- package/dist/drive-analytics/useDriveAnalytics.js +0 -36
- package/dist/drive-analytics/useDriveAnalytics.js.map +0 -1
- package/dist/editors/generic-drive-explorer/components/create-document.d.ts +0 -2
- package/dist/editors/generic-drive-explorer/components/create-document.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/components/create-document.js +0 -19
- package/dist/editors/generic-drive-explorer/components/create-document.js.map +0 -1
- package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts +0 -2
- package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/components/file-content-view.js +0 -76
- package/dist/editors/generic-drive-explorer/components/file-content-view.js.map +0 -1
- package/dist/editors/generic-drive-explorer/components/folder-view.d.ts +0 -5
- package/dist/editors/generic-drive-explorer/components/folder-view.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/components/folder-view.js +0 -19
- package/dist/editors/generic-drive-explorer/components/folder-view.js.map +0 -1
- package/dist/editors/generic-drive-explorer/components/index.d.ts +0 -6
- package/dist/editors/generic-drive-explorer/components/index.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/components/index.js +0 -6
- package/dist/editors/generic-drive-explorer/components/index.js.map +0 -1
- package/dist/editors/generic-drive-explorer/components/layout.d.ts +0 -12
- package/dist/editors/generic-drive-explorer/components/layout.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/components/layout.js +0 -21
- package/dist/editors/generic-drive-explorer/components/layout.js.map +0 -1
- package/dist/editors/generic-drive-explorer/components/search-bar.d.ts +0 -2
- package/dist/editors/generic-drive-explorer/components/search-bar.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/components/search-bar.js +0 -38
- package/dist/editors/generic-drive-explorer/components/search-bar.js.map +0 -1
- package/dist/editors/generic-drive-explorer/config.d.ts +0 -3
- package/dist/editors/generic-drive-explorer/config.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/config.js +0 -5
- package/dist/editors/generic-drive-explorer/config.js.map +0 -1
- package/dist/editors/generic-drive-explorer/editor.d.ts +0 -3
- package/dist/editors/generic-drive-explorer/editor.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/editor.js +0 -16
- package/dist/editors/generic-drive-explorer/editor.js.map +0 -1
- package/dist/editors/generic-drive-explorer/generic-drive-explorer.stories.d.ts +0 -6
- package/dist/editors/generic-drive-explorer/generic-drive-explorer.stories.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/generic-drive-explorer.stories.js +0 -26
- package/dist/editors/generic-drive-explorer/generic-drive-explorer.stories.js.map +0 -1
- package/dist/editors/generic-drive-explorer/index.d.ts +0 -3
- package/dist/editors/generic-drive-explorer/index.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/index.js +0 -3
- package/dist/editors/generic-drive-explorer/index.js.map +0 -1
- package/dist/editors/generic-drive-explorer/module.d.ts +0 -3
- package/dist/editors/generic-drive-explorer/module.d.ts.map +0 -1
- package/dist/editors/generic-drive-explorer/module.js +0 -10
- package/dist/editors/generic-drive-explorer/module.js.map +0 -1
- package/dist/editors/index.d.ts +0 -3
- package/dist/editors/index.d.ts.map +0 -1
- package/dist/editors/index.js +0 -4
- package/dist/editors/index.js.map +0 -1
- package/dist/editors/styles.css +0 -450
- package/dist/editors/utils/cn.d.ts +0 -3
- package/dist/editors/utils/cn.d.ts.map +0 -1
- package/dist/editors/utils/cn.js +0 -6
- package/dist/editors/utils/cn.js.map +0 -1
- package/dist/editors/utils/index.d.ts +0 -3
- package/dist/editors/utils/index.d.ts.map +0 -1
- package/dist/editors/utils/index.js +0 -3
- package/dist/editors/utils/index.js.map +0 -1
- package/dist/editors/utils/types.d.ts +0 -8
- package/dist/editors/utils/types.d.ts.map +0 -1
- package/dist/editors/utils/types.js +0 -2
- package/dist/editors/utils/types.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/vetra-gql.d.ts +0 -8
- package/dist/utils/vetra-gql.d.ts.map +0 -1
- package/dist/utils/vetra-gql.js +0 -67
- package/dist/utils/vetra-gql.js.map +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __exportAll = (all, no_symbols) => {
|
|
7
|
+
let target = {};
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
return target;
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
17
|
+
key = keys[i];
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: ((k) => from[k]).bind(null, key),
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
26
|
+
//#endregion
|
|
27
|
+
export { __reExport as n, __exportAll as t };
|
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _powerhousedao_analytics_engine_core0 from "@powerhousedao/analytics-engine-core";
|
|
2
|
+
import { AnalyticsGranularity, GroupedPeriodResults } from "@powerhousedao/analytics-engine-core";
|
|
3
|
+
import * as _powerhousedao_reactor_browser_analytics0 from "@powerhousedao/reactor-browser/analytics";
|
|
4
|
+
import { UseAnalyticsQueryResult } from "@powerhousedao/reactor-browser/analytics";
|
|
5
|
+
import { ActionType, NodeTarget } from "@powerhousedao/shared/processors/drive-analytics/types";
|
|
6
|
+
export * from "@powerhousedao/shared/processors/drive-analytics/index";
|
|
7
|
+
|
|
8
|
+
//#region drive-analytics/useDocumentAnalytics.d.ts
|
|
9
|
+
type UseDocumentAnalyticsOptions = {
|
|
10
|
+
from?: string;
|
|
11
|
+
to?: string;
|
|
12
|
+
granularity?: AnalyticsGranularity;
|
|
13
|
+
levelOfDetail?: {
|
|
14
|
+
drive?: number;
|
|
15
|
+
operation?: number;
|
|
16
|
+
target?: number;
|
|
17
|
+
};
|
|
18
|
+
filters?: {
|
|
19
|
+
driveId?: string[];
|
|
20
|
+
documentId?: string[];
|
|
21
|
+
operation?: string[];
|
|
22
|
+
target?: NodeTarget[];
|
|
23
|
+
branch?: string[];
|
|
24
|
+
scope?: string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
declare const useDocumentAnalytics: (options: UseDocumentAnalyticsOptions) => UseAnalyticsQueryResult<GroupedPeriodResults>;
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region drive-analytics/useDriveAnalytics.d.ts
|
|
30
|
+
type UseDriveAnalyticsOptions = {
|
|
31
|
+
from?: string;
|
|
32
|
+
to?: string;
|
|
33
|
+
granularity?: AnalyticsGranularity;
|
|
34
|
+
levelOfDetail?: {
|
|
35
|
+
drive?: number;
|
|
36
|
+
operation?: number;
|
|
37
|
+
target?: number;
|
|
38
|
+
actionType?: number;
|
|
39
|
+
};
|
|
40
|
+
filters?: {
|
|
41
|
+
driveId?: string[];
|
|
42
|
+
operation?: string[];
|
|
43
|
+
target?: NodeTarget[];
|
|
44
|
+
actionType?: ActionType[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
declare const useDriveAnalytics: (options: UseDriveAnalyticsOptions) => _powerhousedao_reactor_browser_analytics0.UseAnalyticsQueryResult<_powerhousedao_analytics_engine_core0.GroupedPeriodResults>;
|
|
48
|
+
declare namespace drive_analytics_d_exports {
|
|
49
|
+
export { UseDocumentAnalyticsOptions, UseDriveAnalyticsOptions, useDocumentAnalytics, useDriveAnalytics };
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { UseDocumentAnalyticsOptions, UseDriveAnalyticsOptions, useDocumentAnalytics, useDriveAnalytics };
|
|
2
53
|
//# sourceMappingURL=drive-analytics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive-analytics.d.ts","
|
|
1
|
+
{"version":3,"file":"drive-analytics.d.ts","names":[],"sources":["../drive-analytics/useDocumentAnalytics.ts","../drive-analytics/useDriveAnalytics.ts","../drive-analytics.ts"],"mappings":";;;;;;;;KAaY,2BAAA;EACV,IAAA;EACA,EAAA;EACA,WAAA,GAAc,oBAAA;EACd,aAAA;IACE,KAAA;IACA,SAAA;IACA,MAAA;EAAA;EAEF,OAAA;IACE,OAAA;IACA,UAAA;IACA,SAAA;IACA,MAAA,GAAS,UAAA;IACT,MAAA;IACA,KAAA;EAAA;AAAA;AAAA,cAIS,oBAAA,GACX,OAAA,EAAS,2BAAA,KACR,uBAAA,CAAwB,oBAAA;;;KCtBf,wBAAA;EACV,IAAA;EACA,EAAA;EACA,WAAA,GAAc,oBAAA;EACd,aAAA;IACE,KAAA;IACA,SAAA;IACA,MAAA;IACA,UAAA;EAAA;EAEF,OAAA;IACE,OAAA;IACA,SAAA;IACA,MAAA,GAAS,UAAA;IACT,UAAA,GAAa,UAAA;EAAA;AAAA;AAAA,cAIJ,iBAAA,GAAqB,OAAA,EAAS,wBAAA,KAAwB,yCAAA,CAAA,uBAAA,CAAA,qCAAA,CAAA,oBAAA;AAAA"}
|
package/dist/drive-analytics.js
CHANGED
|
@@ -1,2 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
import "./chunk-ZRW5x4aP.js";
|
|
2
|
+
import { AnalyticsGranularity, AnalyticsPath } from "@powerhousedao/analytics-engine-core";
|
|
3
|
+
import { useAnalyticsQuery } from "@powerhousedao/reactor-browser/analytics";
|
|
4
|
+
import { DateTime } from "luxon";
|
|
5
|
+
export * from "@powerhousedao/shared/processors/drive-analytics/index";
|
|
6
|
+
//#region drive-analytics/useDocumentAnalytics.ts
|
|
7
|
+
const useDocumentAnalytics = (options) => {
|
|
8
|
+
const start = options.from ? DateTime.fromISO(options.from) : DateTime.now().startOf("day");
|
|
9
|
+
const end = options.to ? DateTime.fromISO(options.to) : DateTime.now().endOf("day");
|
|
10
|
+
const granularity = options.granularity ?? AnalyticsGranularity.Daily;
|
|
11
|
+
const lod = options.levelOfDetail ?? { drive: 1 };
|
|
12
|
+
const selectDrives = options.filters?.driveId?.map((driveId) => AnalyticsPath.fromString(`ph/doc/drive/${driveId}`));
|
|
13
|
+
const operations = options.filters?.operation?.map((operation) => AnalyticsPath.fromString(`ph/doc/operation/${operation}`));
|
|
14
|
+
const targets = options.filters?.target?.map((target) => AnalyticsPath.fromString(`ph/doc/target/${target}`));
|
|
15
|
+
const select = {
|
|
16
|
+
drive: selectDrives ?? [AnalyticsPath.fromString("ph/doc/drive")],
|
|
17
|
+
...operations && { operation: operations },
|
|
18
|
+
...targets && { target: targets }
|
|
19
|
+
};
|
|
20
|
+
let sources;
|
|
21
|
+
if (options.filters?.driveId || options.filters?.documentId) {
|
|
22
|
+
sources = [];
|
|
23
|
+
if (options.filters?.driveId && options.filters?.documentId) for (const driveId of options.filters.driveId) for (const documentId of options.filters.documentId) {
|
|
24
|
+
const branch = options.filters.branch?.[0] ?? "*";
|
|
25
|
+
const scope = options.filters.scope?.[0] ?? "*";
|
|
26
|
+
sources.push(AnalyticsPath.fromString(`ph/doc/${driveId}/${documentId}/${branch}/${scope}`));
|
|
27
|
+
}
|
|
28
|
+
else if (options.filters?.driveId) for (const driveId of options.filters.driveId) {
|
|
29
|
+
const branch = options.filters.branch?.[0] ?? "*";
|
|
30
|
+
const scope = options.filters.scope?.[0] ?? "*";
|
|
31
|
+
sources.push(AnalyticsPath.fromString(`ph/doc/${driveId}/*/${branch}/${scope}`));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return useAnalyticsQuery({
|
|
35
|
+
start,
|
|
36
|
+
end,
|
|
37
|
+
metrics: ["DocumentOperations"],
|
|
38
|
+
granularity,
|
|
39
|
+
lod,
|
|
40
|
+
select
|
|
41
|
+
}, sources ? { sources } : void 0);
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region drive-analytics/useDriveAnalytics.ts
|
|
45
|
+
const useDriveAnalytics = (options) => {
|
|
46
|
+
const start = options.from ? DateTime.fromISO(options.from) : DateTime.now().startOf("day");
|
|
47
|
+
const end = options.to ? DateTime.fromISO(options.to) : DateTime.now().endOf("day");
|
|
48
|
+
const granularity = options.granularity ?? AnalyticsGranularity.Daily;
|
|
49
|
+
const lod = options.levelOfDetail ?? { drive: 1 };
|
|
50
|
+
const selectDrives = options.filters?.driveId?.map((driveId) => AnalyticsPath.fromString(`ph/drive/${driveId}`));
|
|
51
|
+
const operations = options.filters?.operation?.map((operation) => AnalyticsPath.fromString(`ph/drive/operation/${operation}`));
|
|
52
|
+
const targets = options.filters?.target?.map((target) => AnalyticsPath.fromString(`ph/drive/target/${target}`));
|
|
53
|
+
const actionTypes = options.filters?.actionType?.map((actionType) => AnalyticsPath.fromString(`ph/drive/actionType/${actionType}`));
|
|
54
|
+
return useAnalyticsQuery({
|
|
55
|
+
start,
|
|
56
|
+
end,
|
|
57
|
+
metrics: ["DriveOperations"],
|
|
58
|
+
granularity,
|
|
59
|
+
lod,
|
|
60
|
+
select: {
|
|
61
|
+
drive: selectDrives ?? [AnalyticsPath.fromString("ph/drive")],
|
|
62
|
+
...operations && { operation: operations },
|
|
63
|
+
...targets && { target: targets },
|
|
64
|
+
...actionTypes && { actionType: actionTypes }
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { useDocumentAnalytics, useDriveAnalytics };
|
|
70
|
+
|
|
2
71
|
//# sourceMappingURL=drive-analytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive-analytics.js","
|
|
1
|
+
{"version":3,"file":"drive-analytics.js","names":[],"sources":["../drive-analytics/useDocumentAnalytics.ts","../drive-analytics/useDriveAnalytics.ts","../drive-analytics.ts"],"sourcesContent":["import type {\n AnalyticsQuery,\n GroupedPeriodResults,\n} from \"@powerhousedao/analytics-engine-core\";\nimport {\n AnalyticsGranularity,\n AnalyticsPath,\n} from \"@powerhousedao/analytics-engine-core\";\nimport type { UseAnalyticsQueryResult } from \"@powerhousedao/reactor-browser/analytics\";\nimport { useAnalyticsQuery } from \"@powerhousedao/reactor-browser/analytics\";\nimport type { NodeTarget } from \"@powerhousedao/shared/processors/drive-analytics/types\";\nimport { DateTime } from \"luxon\";\n\nexport type UseDocumentAnalyticsOptions = {\n from?: string;\n to?: string;\n granularity?: AnalyticsGranularity;\n levelOfDetail?: {\n drive?: number;\n operation?: number;\n target?: number;\n };\n filters?: {\n driveId?: string[];\n documentId?: string[];\n operation?: string[];\n target?: NodeTarget[];\n branch?: string[];\n scope?: string[];\n };\n};\n\nexport const useDocumentAnalytics = (\n options: UseDocumentAnalyticsOptions,\n): UseAnalyticsQueryResult<GroupedPeriodResults> => {\n const start = options.from\n ? DateTime.fromISO(options.from)\n : DateTime.now().startOf(\"day\");\n\n const end = options.to\n ? DateTime.fromISO(options.to)\n : DateTime.now().endOf(\"day\");\n\n const granularity = options.granularity ?? AnalyticsGranularity.Daily;\n\n const lod = options.levelOfDetail ?? {\n drive: 1,\n };\n\n // Build drive dimension filters\n const selectDrives = options.filters?.driveId?.map((driveId) =>\n AnalyticsPath.fromString(`ph/doc/drive/${driveId}`),\n );\n\n // Build operation dimension filters\n const operations = options.filters?.operation?.map((operation) =>\n AnalyticsPath.fromString(`ph/doc/operation/${operation}`),\n );\n\n // Build target dimension filters\n const targets = options.filters?.target?.map((target) =>\n AnalyticsPath.fromString(`ph/doc/target/${target}`),\n );\n\n const select = {\n drive: selectDrives ?? [AnalyticsPath.fromString(\"ph/doc/drive\")],\n ...(operations && { operation: operations }),\n ...(targets && { target: targets }),\n };\n\n // Build sources filter based on driveId and documentId\n let sources: AnalyticsPath[] | undefined;\n if (options.filters?.driveId || options.filters?.documentId) {\n sources = [];\n\n if (options.filters?.driveId && options.filters?.documentId) {\n // Specific drive and document combinations\n for (const driveId of options.filters.driveId) {\n for (const documentId of options.filters.documentId) {\n const branch = options.filters.branch?.[0] ?? \"*\";\n const scope = options.filters.scope?.[0] ?? \"*\";\n sources.push(\n AnalyticsPath.fromString(\n `ph/doc/${driveId}/${documentId}/${branch}/${scope}`,\n ),\n );\n }\n }\n } else if (options.filters?.driveId) {\n // All documents in specific drives\n for (const driveId of options.filters.driveId) {\n const branch = options.filters.branch?.[0] ?? \"*\";\n const scope = options.filters.scope?.[0] ?? \"*\";\n sources.push(\n AnalyticsPath.fromString(`ph/doc/${driveId}/*/${branch}/${scope}`),\n );\n }\n }\n }\n\n const config: AnalyticsQuery = {\n start,\n end,\n metrics: [\"DocumentOperations\"],\n granularity,\n lod,\n select,\n };\n\n const queryOptions = sources ? { sources } : undefined;\n\n const result = useAnalyticsQuery(config, queryOptions);\n\n return result;\n};\n","import type { AnalyticsQuery } from \"@powerhousedao/analytics-engine-core\";\nimport {\n AnalyticsGranularity,\n AnalyticsPath,\n} from \"@powerhousedao/analytics-engine-core\";\nimport { useAnalyticsQuery } from \"@powerhousedao/reactor-browser/analytics\";\nimport type {\n ActionType,\n NodeTarget,\n} from \"@powerhousedao/shared/processors/drive-analytics/types\";\nimport { DateTime } from \"luxon\";\n\nexport type UseDriveAnalyticsOptions = {\n from?: string;\n to?: string;\n granularity?: AnalyticsGranularity;\n levelOfDetail?: {\n drive?: number;\n operation?: number;\n target?: number;\n actionType?: number;\n };\n filters?: {\n driveId?: string[];\n operation?: string[];\n target?: NodeTarget[];\n actionType?: ActionType[];\n };\n};\n\nexport const useDriveAnalytics = (options: UseDriveAnalyticsOptions) => {\n const start = options.from\n ? DateTime.fromISO(options.from)\n : DateTime.now().startOf(\"day\");\n\n const end = options.to\n ? DateTime.fromISO(options.to)\n : DateTime.now().endOf(\"day\");\n\n const granularity = options.granularity ?? AnalyticsGranularity.Daily;\n\n const lod = options.levelOfDetail ?? {\n drive: 1,\n };\n\n const selectDrives = options.filters?.driveId?.map((driveId) =>\n AnalyticsPath.fromString(`ph/drive/${driveId}`),\n );\n\n const operations = options.filters?.operation?.map((operation) =>\n AnalyticsPath.fromString(`ph/drive/operation/${operation}`),\n );\n\n const targets = options.filters?.target?.map((target) =>\n AnalyticsPath.fromString(`ph/drive/target/${target}`),\n );\n\n const actionTypes = options.filters?.actionType?.map((actionType) =>\n AnalyticsPath.fromString(`ph/drive/actionType/${actionType}`),\n );\n\n const select = {\n drive: selectDrives ?? [AnalyticsPath.fromString(\"ph/drive\")],\n ...(operations && { operation: operations }),\n ...(targets && { target: targets }),\n ...(actionTypes && { actionType: actionTypes }),\n };\n\n const config: AnalyticsQuery = {\n start,\n end,\n metrics: [\"DriveOperations\"],\n granularity,\n lod,\n select,\n };\n\n const result = useAnalyticsQuery(config);\n\n return result;\n};\n","export * from \"./drive-analytics/index.js\";\n"],"mappings":";;;;;;AAgCA,MAAa,wBACX,YACkD;CAClD,MAAM,QAAQ,QAAQ,OAClB,SAAS,QAAQ,QAAQ,KAAK,GAC9B,SAAS,KAAK,CAAC,QAAQ,MAAM;CAEjC,MAAM,MAAM,QAAQ,KAChB,SAAS,QAAQ,QAAQ,GAAG,GAC5B,SAAS,KAAK,CAAC,MAAM,MAAM;CAE/B,MAAM,cAAc,QAAQ,eAAe,qBAAqB;CAEhE,MAAM,MAAM,QAAQ,iBAAiB,EACnC,OAAO,GACR;CAGD,MAAM,eAAe,QAAQ,SAAS,SAAS,KAAK,YAClD,cAAc,WAAW,gBAAgB,UAAU,CACpD;CAGD,MAAM,aAAa,QAAQ,SAAS,WAAW,KAAK,cAClD,cAAc,WAAW,oBAAoB,YAAY,CAC1D;CAGD,MAAM,UAAU,QAAQ,SAAS,QAAQ,KAAK,WAC5C,cAAc,WAAW,iBAAiB,SAAS,CACpD;CAED,MAAM,SAAS;EACb,OAAO,gBAAgB,CAAC,cAAc,WAAW,eAAe,CAAC;EACjE,GAAI,cAAc,EAAE,WAAW,YAAY;EAC3C,GAAI,WAAW,EAAE,QAAQ,SAAS;EACnC;CAGD,IAAI;AACJ,KAAI,QAAQ,SAAS,WAAW,QAAQ,SAAS,YAAY;AAC3D,YAAU,EAAE;AAEZ,MAAI,QAAQ,SAAS,WAAW,QAAQ,SAAS,WAE/C,MAAK,MAAM,WAAW,QAAQ,QAAQ,QACpC,MAAK,MAAM,cAAc,QAAQ,QAAQ,YAAY;GACnD,MAAM,SAAS,QAAQ,QAAQ,SAAS,MAAM;GAC9C,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,MAAM;AAC5C,WAAQ,KACN,cAAc,WACZ,UAAU,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,QAC9C,CACF;;WAGI,QAAQ,SAAS,QAE1B,MAAK,MAAM,WAAW,QAAQ,QAAQ,SAAS;GAC7C,MAAM,SAAS,QAAQ,QAAQ,SAAS,MAAM;GAC9C,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,MAAM;AAC5C,WAAQ,KACN,cAAc,WAAW,UAAU,QAAQ,KAAK,OAAO,GAAG,QAAQ,CACnE;;;AAkBP,QAFe,kBAXgB;EAC7B;EACA;EACA,SAAS,CAAC,qBAAqB;EAC/B;EACA;EACA;EACD,EAEoB,UAAU,EAAE,SAAS,GAAG,KAAA,EAES;;;;ACjFxD,MAAa,qBAAqB,YAAsC;CACtE,MAAM,QAAQ,QAAQ,OAClB,SAAS,QAAQ,QAAQ,KAAK,GAC9B,SAAS,KAAK,CAAC,QAAQ,MAAM;CAEjC,MAAM,MAAM,QAAQ,KAChB,SAAS,QAAQ,QAAQ,GAAG,GAC5B,SAAS,KAAK,CAAC,MAAM,MAAM;CAE/B,MAAM,cAAc,QAAQ,eAAe,qBAAqB;CAEhE,MAAM,MAAM,QAAQ,iBAAiB,EACnC,OAAO,GACR;CAED,MAAM,eAAe,QAAQ,SAAS,SAAS,KAAK,YAClD,cAAc,WAAW,YAAY,UAAU,CAChD;CAED,MAAM,aAAa,QAAQ,SAAS,WAAW,KAAK,cAClD,cAAc,WAAW,sBAAsB,YAAY,CAC5D;CAED,MAAM,UAAU,QAAQ,SAAS,QAAQ,KAAK,WAC5C,cAAc,WAAW,mBAAmB,SAAS,CACtD;CAED,MAAM,cAAc,QAAQ,SAAS,YAAY,KAAK,eACpD,cAAc,WAAW,uBAAuB,aAAa,CAC9D;AAoBD,QAFe,kBATgB;EAC7B;EACA;EACA,SAAS,CAAC,kBAAkB;EAC5B;EACA;EACA,QAba;GACb,OAAO,gBAAgB,CAAC,cAAc,WAAW,WAAW,CAAC;GAC7D,GAAI,cAAc,EAAE,WAAW,YAAY;GAC3C,GAAI,WAAW,EAAE,QAAQ,SAAS;GAClC,GAAI,eAAe,EAAE,YAAY,aAAa;GAC/C;EASA,CAEuC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { VetraDocumentInfo, createVetraDocument, getVetraDocuments, setPackageGithubUrl } from "./utils/index.js";
|
|
2
|
+
import { ProcessorApp } from "@powerhousedao/shared/processors";
|
|
3
|
+
export { type ProcessorApp, VetraDocumentInfo, createVetraDocument, getVetraDocuments, setPackageGithubUrl };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export * from "./utils/index.js";
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { createVetraDocument, getVetraDocuments, setPackageGithubUrl } from "./utils/index.js";
|
|
2
|
+
export { createVetraDocument, getVetraDocuments, setPackageGithubUrl };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
//#region utils/vetra-gql.d.ts
|
|
2
|
+
interface VetraDocumentInfo {
|
|
3
|
+
id: string;
|
|
4
|
+
githubUrl: string;
|
|
5
|
+
}
|
|
6
|
+
declare function getVetraDocuments(graphqlEndpoint: string, driveId: string): Promise<VetraDocumentInfo[]>;
|
|
7
|
+
declare function setPackageGithubUrl(graphqlEndpoint: string, driveId: string, documentId: string, url: string): Promise<number>;
|
|
8
|
+
declare function createVetraDocument(graphqlEndpoint: string, driveId: string, name?: string): Promise<string>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { VetraDocumentInfo, createVetraDocument, getVetraDocuments, setPackageGithubUrl };
|
|
2
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../utils/vetra-gql.ts"],"mappings":";UAeiB,iBAAA;EACf,EAAA;EACA,SAAA;AAAA;AAAA,iBAWoB,iBAAA,CACpB,eAAA,UACA,OAAA,WACC,OAAA,CAAQ,iBAAA;AAAA,iBA4BW,mBAAA,CACpB,eAAA,UACA,OAAA,UACA,UAAA,UACA,GAAA,WACC,OAAA;AAAA,iBA8BmB,mBAAA,CACpB,eAAA,UACA,OAAA,UACA,IAAA,YACC,OAAA"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
import { GraphQLClient, gql } from "graphql-request";
|
|
2
|
+
//#region utils/vetra-gql.ts
|
|
3
|
+
async function getVetraDocuments(graphqlEndpoint, driveId) {
|
|
4
|
+
const client = new GraphQLClient(graphqlEndpoint, { fetch });
|
|
5
|
+
const query = gql`
|
|
6
|
+
query GetDocuments($driveId: String!) {
|
|
7
|
+
VetraPackage {
|
|
8
|
+
getDocuments(driveId: $driveId) {
|
|
9
|
+
id
|
|
10
|
+
state {
|
|
11
|
+
githubUrl
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
return (await client.request(query, { driveId })).VetraPackage.getDocuments.map((doc) => ({
|
|
18
|
+
id: doc.id,
|
|
19
|
+
githubUrl: doc.state.githubUrl
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
async function setPackageGithubUrl(graphqlEndpoint, driveId, documentId, url) {
|
|
23
|
+
const client = new GraphQLClient(graphqlEndpoint, { fetch });
|
|
24
|
+
const mutation = gql`
|
|
25
|
+
mutation SetPackageGithubUrl(
|
|
26
|
+
$driveId: String
|
|
27
|
+
$docId: PHID
|
|
28
|
+
$input: VetraPackage_SetPackageGithubUrlInput!
|
|
29
|
+
) {
|
|
30
|
+
VetraPackage_setPackageGithubUrl(
|
|
31
|
+
driveId: $driveId
|
|
32
|
+
docId: $docId
|
|
33
|
+
input: $input
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
return (await client.request(mutation, {
|
|
38
|
+
driveId,
|
|
39
|
+
docId: documentId,
|
|
40
|
+
input: { url }
|
|
41
|
+
})).VetraPackage_setPackageGithubUrl;
|
|
42
|
+
}
|
|
43
|
+
async function createVetraDocument(graphqlEndpoint, driveId, name = "vetra-package") {
|
|
44
|
+
const client = new GraphQLClient(graphqlEndpoint, { fetch });
|
|
45
|
+
const mutation = gql`
|
|
46
|
+
mutation CreateDocument($driveId: String, $name: String) {
|
|
47
|
+
VetraPackage_createDocument(driveId: $driveId, name: $name)
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
return (await client.request(mutation, {
|
|
51
|
+
driveId,
|
|
52
|
+
name
|
|
53
|
+
})).VetraPackage_createDocument;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { createVetraDocument, getVetraDocuments, setPackageGithubUrl };
|
|
57
|
+
|
|
2
58
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../utils/vetra-gql.ts"],"sourcesContent":["import { GraphQLClient, gql } from \"graphql-request\";\n\ninterface VetraDocument {\n id: string;\n state: {\n githubUrl: string;\n };\n}\n\ninterface GetDocumentsResponse {\n VetraPackage: {\n getDocuments: VetraDocument[];\n };\n}\n\nexport interface VetraDocumentInfo {\n id: string;\n githubUrl: string;\n}\n\ninterface SetPackageGithubUrlResponse {\n VetraPackage_setPackageGithubUrl: number;\n}\n\ninterface CreateDocumentResponse {\n VetraPackage_createDocument: string;\n}\n\nexport async function getVetraDocuments(\n graphqlEndpoint: string,\n driveId: string,\n): Promise<VetraDocumentInfo[]> {\n const client = new GraphQLClient(graphqlEndpoint, {\n fetch,\n });\n\n const query = gql`\n query GetDocuments($driveId: String!) {\n VetraPackage {\n getDocuments(driveId: $driveId) {\n id\n state {\n githubUrl\n }\n }\n }\n }\n `;\n\n const response = await client.request<GetDocumentsResponse>(query, {\n driveId,\n });\n\n return response.VetraPackage.getDocuments.map((doc) => ({\n id: doc.id,\n githubUrl: doc.state.githubUrl,\n }));\n}\n\nexport async function setPackageGithubUrl(\n graphqlEndpoint: string,\n driveId: string,\n documentId: string,\n url: string,\n): Promise<number> {\n const client = new GraphQLClient(graphqlEndpoint, {\n fetch,\n });\n\n const mutation = gql`\n mutation SetPackageGithubUrl(\n $driveId: String\n $docId: PHID\n $input: VetraPackage_SetPackageGithubUrlInput!\n ) {\n VetraPackage_setPackageGithubUrl(\n driveId: $driveId\n docId: $docId\n input: $input\n )\n }\n `;\n\n const response = await client.request<SetPackageGithubUrlResponse>(mutation, {\n driveId,\n docId: documentId,\n input: {\n url,\n },\n });\n\n return response.VetraPackage_setPackageGithubUrl;\n}\n\nexport async function createVetraDocument(\n graphqlEndpoint: string,\n driveId: string,\n name = \"vetra-package\",\n): Promise<string> {\n const client = new GraphQLClient(graphqlEndpoint, {\n fetch,\n });\n\n const mutation = gql`\n mutation CreateDocument($driveId: String, $name: String) {\n VetraPackage_createDocument(driveId: $driveId, name: $name)\n }\n `;\n\n const response = await client.request<CreateDocumentResponse>(mutation, {\n driveId,\n name,\n });\n\n return response.VetraPackage_createDocument;\n}\n"],"mappings":";;AA4BA,eAAsB,kBACpB,iBACA,SAC8B;CAC9B,MAAM,SAAS,IAAI,cAAc,iBAAiB,EAChD,OACD,CAAC;CAEF,MAAM,QAAQ,GAAG;;;;;;;;;;;;AAiBjB,SAJiB,MAAM,OAAO,QAA8B,OAAO,EACjE,SACD,CAAC,EAEc,aAAa,aAAa,KAAK,SAAS;EACtD,IAAI,IAAI;EACR,WAAW,IAAI,MAAM;EACtB,EAAE;;AAGL,eAAsB,oBACpB,iBACA,SACA,YACA,KACiB;CACjB,MAAM,SAAS,IAAI,cAAc,iBAAiB,EAChD,OACD,CAAC;CAEF,MAAM,WAAW,GAAG;;;;;;;;;;;;;AAsBpB,SARiB,MAAM,OAAO,QAAqC,UAAU;EAC3E;EACA,OAAO;EACP,OAAO,EACL,KACD;EACF,CAAC,EAEc;;AAGlB,eAAsB,oBACpB,iBACA,SACA,OAAO,iBACU;CACjB,MAAM,SAAS,IAAI,cAAc,iBAAiB,EAChD,OACD,CAAC;CAEF,MAAM,WAAW,GAAG;;;;;AAWpB,SALiB,MAAM,OAAO,QAAgC,UAAU;EACtE;EACA;EACD,CAAC,EAEc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/common",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.200",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -12,24 +12,16 @@
|
|
|
12
12
|
},
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
},
|
|
18
|
-
"./generic-drive-explorer": {
|
|
19
|
-
"import": "./dist/editors/generic-drive-explorer/module.js",
|
|
20
|
-
"types": "./dist/editors/generic-drive-explorer/module.d.ts"
|
|
21
|
-
},
|
|
22
|
-
"./generic-drive-explorer/editor-component": {
|
|
23
|
-
"import": "./dist/editors/generic-drive-explorer/editor.js",
|
|
24
|
-
"types": "./dist/editors/generic-drive-explorer/editor.d.ts"
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
25
17
|
},
|
|
26
18
|
"./utils": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
19
|
+
"types": "./dist/utils/index.d.ts",
|
|
20
|
+
"import": "./dist/utils/index.js"
|
|
29
21
|
},
|
|
30
22
|
"./analytics": {
|
|
31
|
-
"types": "./dist/
|
|
32
|
-
"
|
|
23
|
+
"types": "./dist/drive-analytics.d.ts",
|
|
24
|
+
"import": "./dist/drive-analytics.js"
|
|
33
25
|
}
|
|
34
26
|
},
|
|
35
27
|
"sideEffects": false,
|
|
@@ -39,63 +31,21 @@
|
|
|
39
31
|
"react-dom": ">=19.0.0"
|
|
40
32
|
},
|
|
41
33
|
"dependencies": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"react-i18next": "^13.5.0",
|
|
48
|
-
"@powerhousedao/builder-tools": "6.0.0-dev.2",
|
|
49
|
-
"document-drive": "6.0.0-dev.2",
|
|
50
|
-
"document-model": "6.0.0-dev.2",
|
|
51
|
-
"@powerhousedao/design-system": "6.0.0-dev.2"
|
|
34
|
+
"graphql-request": "7.4.0",
|
|
35
|
+
"luxon": "3.7.2",
|
|
36
|
+
"@powerhousedao/shared": "6.0.0-dev.200",
|
|
37
|
+
"@powerhousedao/reactor-browser": "6.0.0-dev.200",
|
|
38
|
+
"@powerhousedao/analytics-engine-core": "6.0.0-dev.200"
|
|
52
39
|
},
|
|
53
40
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"@storybook/addon-interactions": "^8.6.7",
|
|
58
|
-
"@storybook/addon-links": "^8.6.7",
|
|
59
|
-
"@storybook/addon-themes": "^8.6.7",
|
|
60
|
-
"@storybook/blocks": "^8.6.7",
|
|
61
|
-
"@storybook/components": "^8.6.7",
|
|
62
|
-
"@storybook/manager-api": "^8.6.7",
|
|
63
|
-
"@storybook/preview-api": "^8.6.7",
|
|
64
|
-
"@storybook/react": "^8.6.7",
|
|
65
|
-
"@storybook/react-vite": "^8.6.7",
|
|
66
|
-
"@storybook/test": "^8.6.7",
|
|
67
|
-
"@storybook/types": "^8.6.7",
|
|
68
|
-
"@tailwindcss/cli": "^4.1.14",
|
|
69
|
-
"@tailwindcss/vite": "^4.1.14",
|
|
70
|
-
"@types/node": "^24.6.1",
|
|
71
|
-
"@types/react": "^19.2.0",
|
|
72
|
-
"@types/wicg-file-system-access": "^2020.9.6",
|
|
73
|
-
"autoprefixer": "^10.4.20",
|
|
74
|
-
"clsx": "^2.1.1",
|
|
75
|
-
"package-manager-detector": "^0.2.8",
|
|
76
|
-
"postcss": "^8.5.1",
|
|
77
|
-
"react": "^19.2.0",
|
|
78
|
-
"react-dom": "^19.2.0",
|
|
79
|
-
"storybook": "^8.6.14",
|
|
80
|
-
"storybook-addon-pseudo-states": "^4.0.4",
|
|
81
|
-
"storybook-mock-date-decorator": "^2.0.6",
|
|
82
|
-
"tailwind-merge": "^3.0.2",
|
|
83
|
-
"tailwindcss": "^4.1.14",
|
|
84
|
-
"tsx": "^4.20.3",
|
|
85
|
-
"uuid": "^11.0.5",
|
|
86
|
-
"vite": "^7.1.9",
|
|
87
|
-
"vite-plugin-node-polyfills": "^0.24.0",
|
|
88
|
-
"vitest": "^3.2.4",
|
|
89
|
-
"zod": "^4.3.5",
|
|
90
|
-
"@powerhousedao/config": "6.0.0-dev.2",
|
|
91
|
-
"@powerhousedao/reactor-browser": "6.0.0-dev.2",
|
|
92
|
-
"document-model": "6.0.0-dev.2"
|
|
41
|
+
"@types/node": "25.2.3",
|
|
42
|
+
"@types/luxon": "3.7.1",
|
|
43
|
+
"tsdown": "0.21.1"
|
|
93
44
|
},
|
|
94
45
|
"scripts": {
|
|
46
|
+
"build": "tsdown",
|
|
95
47
|
"tsc": "tsc",
|
|
96
48
|
"lint": "eslint",
|
|
97
|
-
"dev": "ph-cli dev --config-file ./powerhouse.config.json"
|
|
98
|
-
"build:css": "pnpm exec tailwindcss -i ./editors/styles.css -o ./dist/editors/styles.css",
|
|
99
|
-
"storybook": "storybook dev -p 6006"
|
|
49
|
+
"dev": "ph-cli dev --config-file ./powerhouse.config.json"
|
|
100
50
|
}
|
|
101
51
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../drive-analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../drive-analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IAnalyticsStore } from "@powerhousedao/analytics-engine-core";
|
|
2
|
-
import type { InternalTransmitterUpdate, IProcessor } from "document-drive";
|
|
3
|
-
export declare class DocumentAnalyticsProcessor implements IProcessor {
|
|
4
|
-
private readonly analyticsStore;
|
|
5
|
-
private readonly logger;
|
|
6
|
-
constructor(analyticsStore: IAnalyticsStore, logger?: import("document-drive").ILogger);
|
|
7
|
-
onStrands(strands: InternalTransmitterUpdate[]): Promise<void>;
|
|
8
|
-
onDisconnect(): Promise<void>;
|
|
9
|
-
private clearSource;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=document-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-processor.d.ts","sourceRoot":"","sources":["../../../drive-analytics/processor/document-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAK5E,qBAAa,0BAA2B,YAAW,UAAU;IAEzD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,eAAe,EAC/B,MAAM,mCAAmD;IAKtE,SAAS,CAAC,OAAO,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkE9D,YAAY;YAEJ,WAAW;CAO1B"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { AnalyticsPath } from "@powerhousedao/analytics-engine-core";
|
|
2
|
-
import { childLogger } from "document-drive";
|
|
3
|
-
import { DateTime } from "luxon";
|
|
4
|
-
export class DocumentAnalyticsProcessor {
|
|
5
|
-
analyticsStore;
|
|
6
|
-
logger;
|
|
7
|
-
constructor(analyticsStore, logger = childLogger(["processor", "document-analytics"])) {
|
|
8
|
-
this.analyticsStore = analyticsStore;
|
|
9
|
-
this.logger = logger;
|
|
10
|
-
//
|
|
11
|
-
}
|
|
12
|
-
async onStrands(strands) {
|
|
13
|
-
if (strands.length === 0) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
for (const strand of strands) {
|
|
17
|
-
// skip empty strands
|
|
18
|
-
if (strand.operations.length === 0) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
const firstOp = strand.operations[0];
|
|
22
|
-
const source = AnalyticsPath.fromString(`ph/doc/${strand.driveId}/${strand.documentId}/${strand.branch}/${strand.scope}`);
|
|
23
|
-
if (firstOp.index === 0) {
|
|
24
|
-
await this.clearSource(source);
|
|
25
|
-
}
|
|
26
|
-
const { driveId, documentId, branch, scope } = strand;
|
|
27
|
-
const target = driveId === documentId ? "DRIVE" : "NODE";
|
|
28
|
-
const CHUNK_SIZE = 50;
|
|
29
|
-
for (let i = 0; i < strand.operations.length; i += CHUNK_SIZE) {
|
|
30
|
-
const chunk = strand.operations.slice(i, i + CHUNK_SIZE);
|
|
31
|
-
const buffer = [];
|
|
32
|
-
for (const operation of chunk) {
|
|
33
|
-
const revision = operation.index;
|
|
34
|
-
const seriesInput = {
|
|
35
|
-
source,
|
|
36
|
-
metric: "DocumentOperations",
|
|
37
|
-
start: DateTime.fromISO(operation.timestampUtcMs),
|
|
38
|
-
value: 1,
|
|
39
|
-
dimensions: {
|
|
40
|
-
drive: AnalyticsPath.fromString(`ph/doc/drive/${driveId}/${branch}/${scope}/${revision}`),
|
|
41
|
-
operation: AnalyticsPath.fromString(`ph/doc/operation/${operation.action.type}/${operation.index}`),
|
|
42
|
-
target: AnalyticsPath.fromString(`ph/doc/target/${driveId}/${target}/${documentId}`),
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
buffer.push(seriesInput);
|
|
46
|
-
while (buffer.length >= CHUNK_SIZE) {
|
|
47
|
-
const batch = buffer.splice(0, CHUNK_SIZE);
|
|
48
|
-
await this.analyticsStore.addSeriesValues(batch);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (buffer.length > 0) {
|
|
52
|
-
await this.analyticsStore.addSeriesValues(buffer);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async onDisconnect() { }
|
|
58
|
-
async clearSource(source) {
|
|
59
|
-
try {
|
|
60
|
-
await this.analyticsStore.clearSeriesBySource(source, true);
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
this.logger.error("Failed to clear source", e);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=document-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-processor.js","sourceRoot":"","sources":["../../../drive-analytics/processor/document-processor.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IAnalyticsStore } from "@powerhousedao/analytics-engine-core";
|
|
2
|
-
import type { InternalTransmitterUpdate, IProcessor } from "document-drive";
|
|
3
|
-
export declare class DriveAnalyticsProcessor implements IProcessor {
|
|
4
|
-
private readonly analyticsStore;
|
|
5
|
-
private readonly logger;
|
|
6
|
-
constructor(analyticsStore: IAnalyticsStore, logger?: import("document-drive").ILogger);
|
|
7
|
-
onStrands(strands: InternalTransmitterUpdate[]): Promise<void>;
|
|
8
|
-
onDisconnect(): Promise<void>;
|
|
9
|
-
private getActionType;
|
|
10
|
-
private clearSource;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=drive-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drive-processor.d.ts","sourceRoot":"","sources":["../../../drive-analytics/processor/drive-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAqB5E,qBAAa,uBAAwB,YAAW,UAAU;IAEtD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,eAAe,EAC/B,MAAM,mCAAgD;IAKnE,SAAS,CAAC,OAAO,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoF9D,YAAY;IAElB,OAAO,CAAC,aAAa;YAgBP,WAAW;CAO1B"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { AnalyticsPath } from "@powerhousedao/analytics-engine-core";
|
|
2
|
-
import { childLogger } from "document-drive";
|
|
3
|
-
import { DateTime } from "luxon";
|
|
4
|
-
const CREATE_NODE_ACTIONS = ["ADD_FILE", "ADD_FOLDER"];
|
|
5
|
-
const DUPLICATE_NODE_ACTIONS = ["COPY_NODE"];
|
|
6
|
-
const UPDATE_NODE_ACTIONS = ["UPDATE_FILE", "UPDATE_NODE"];
|
|
7
|
-
const MOVE_NODE_ACTIONS = ["MOVE_NODE"];
|
|
8
|
-
const REMOVE_NODE_ACTIONS = ["DELETE_NODE"];
|
|
9
|
-
const NODE_ACTIONS = [
|
|
10
|
-
...CREATE_NODE_ACTIONS,
|
|
11
|
-
...DUPLICATE_NODE_ACTIONS,
|
|
12
|
-
...UPDATE_NODE_ACTIONS,
|
|
13
|
-
...MOVE_NODE_ACTIONS,
|
|
14
|
-
...REMOVE_NODE_ACTIONS,
|
|
15
|
-
];
|
|
16
|
-
export class DriveAnalyticsProcessor {
|
|
17
|
-
analyticsStore;
|
|
18
|
-
logger;
|
|
19
|
-
constructor(analyticsStore, logger = childLogger(["processor", "drive-analytics"])) {
|
|
20
|
-
this.analyticsStore = analyticsStore;
|
|
21
|
-
this.logger = logger;
|
|
22
|
-
//
|
|
23
|
-
}
|
|
24
|
-
async onStrands(strands) {
|
|
25
|
-
if (strands.length === 0) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
for (const strand of strands) {
|
|
29
|
-
// skip empty strands
|
|
30
|
-
if (strand.operations.length === 0) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const firstOp = strand.operations[0];
|
|
34
|
-
const source = AnalyticsPath.fromString(`ph/drive/${strand.documentId}/${strand.branch}/${strand.scope}`);
|
|
35
|
-
if (firstOp.index === 0) {
|
|
36
|
-
await this.clearSource(source);
|
|
37
|
-
}
|
|
38
|
-
const { documentId: driveId, branch, scope } = strand;
|
|
39
|
-
const CHUNK_SIZE = 50;
|
|
40
|
-
for (let i = 0; i < strand.operations.length; i += CHUNK_SIZE) {
|
|
41
|
-
const chunk = strand.operations.slice(i, i + CHUNK_SIZE);
|
|
42
|
-
const buffer = [];
|
|
43
|
-
for (const operation of chunk) {
|
|
44
|
-
const revision = operation.index;
|
|
45
|
-
const actionType = this.getActionType(operation.action.type);
|
|
46
|
-
const target = NODE_ACTIONS.includes(operation.action.type)
|
|
47
|
-
? "NODE"
|
|
48
|
-
: "DRIVE";
|
|
49
|
-
let targetId = driveId;
|
|
50
|
-
if (target === "NODE") {
|
|
51
|
-
const operationInput = operation.action.input;
|
|
52
|
-
targetId =
|
|
53
|
-
operationInput.id ||
|
|
54
|
-
operationInput.targetId ||
|
|
55
|
-
operationInput.srcFolder ||
|
|
56
|
-
driveId;
|
|
57
|
-
}
|
|
58
|
-
const seriesInput = {
|
|
59
|
-
source,
|
|
60
|
-
metric: "DriveOperations",
|
|
61
|
-
start: DateTime.fromISO(operation.timestampUtcMs),
|
|
62
|
-
value: 1,
|
|
63
|
-
dimensions: {
|
|
64
|
-
drive: AnalyticsPath.fromString(`ph/drive/${driveId}/${branch}/${scope}/${revision}`),
|
|
65
|
-
operation: AnalyticsPath.fromString(`ph/drive/operation/${operation.action.type}/${operation.index}`),
|
|
66
|
-
target: AnalyticsPath.fromString(`ph/drive/target/${target}/${targetId}`),
|
|
67
|
-
actionType: AnalyticsPath.fromString(`ph/drive/actionType/${actionType}/${targetId}`),
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
buffer.push(seriesInput);
|
|
71
|
-
while (buffer.length >= CHUNK_SIZE) {
|
|
72
|
-
const batch = buffer.splice(0, CHUNK_SIZE);
|
|
73
|
-
await this.analyticsStore.addSeriesValues(batch);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (buffer.length > 0) {
|
|
77
|
-
await this.analyticsStore.addSeriesValues(buffer);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async onDisconnect() { }
|
|
83
|
-
getActionType(action) {
|
|
84
|
-
if (CREATE_NODE_ACTIONS.includes(action)) {
|
|
85
|
-
return "CREATED";
|
|
86
|
-
}
|
|
87
|
-
if (DUPLICATE_NODE_ACTIONS.includes(action)) {
|
|
88
|
-
return "DUPLICATED";
|
|
89
|
-
}
|
|
90
|
-
if (REMOVE_NODE_ACTIONS.includes(action)) {
|
|
91
|
-
return "REMOVED";
|
|
92
|
-
}
|
|
93
|
-
if (MOVE_NODE_ACTIONS.includes(action)) {
|
|
94
|
-
return "MOVED";
|
|
95
|
-
}
|
|
96
|
-
return "UPDATED";
|
|
97
|
-
}
|
|
98
|
-
async clearSource(source) {
|
|
99
|
-
try {
|
|
100
|
-
await this.analyticsStore.clearSeriesBySource(source, true);
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
this.logger.error("Failed to clear source", e);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=drive-processor.js.map
|