airbyte-faros-destination 0.19.56-rc6 → 0.19.56
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/lib/converters/azure-tfvc/changesets.d.ts +0 -1
- package/lib/converters/azure-tfvc/changesets.js +10 -71
- package/lib/converters/azure-tfvc/changesets.js.map +1 -1
- package/lib/converters/cursor/agent_edits.d.ts +8 -0
- package/lib/converters/cursor/agent_edits.js +59 -0
- package/lib/converters/cursor/agent_edits.js.map +1 -0
- package/lib/converters/cursor/ask_mode_adoption.d.ts +8 -0
- package/lib/converters/cursor/ask_mode_adoption.js +47 -0
- package/lib/converters/cursor/ask_mode_adoption.js.map +1 -0
- package/lib/converters/cursor/client_versions.d.ts +8 -0
- package/lib/converters/cursor/client_versions.js +42 -0
- package/lib/converters/cursor/client_versions.js.map +1 -0
- package/lib/converters/cursor/commands_adoption.d.ts +8 -0
- package/lib/converters/cursor/commands_adoption.js +47 -0
- package/lib/converters/cursor/commands_adoption.js.map +1 -0
- package/lib/converters/cursor/common.d.ts +20 -2
- package/lib/converters/cursor/common.js +25 -4
- package/lib/converters/cursor/common.js.map +1 -1
- package/lib/converters/cursor/daily_active_users.d.ts +8 -0
- package/lib/converters/cursor/daily_active_users.js +67 -0
- package/lib/converters/cursor/daily_active_users.js.map +1 -0
- package/lib/converters/cursor/daily_usage.js +1 -1
- package/lib/converters/cursor/daily_usage.js.map +1 -1
- package/lib/converters/cursor/mcp_adoption.d.ts +8 -0
- package/lib/converters/cursor/mcp_adoption.js +47 -0
- package/lib/converters/cursor/mcp_adoption.js.map +1 -0
- package/lib/converters/cursor/model_usage.d.ts +8 -0
- package/lib/converters/cursor/model_usage.js +51 -0
- package/lib/converters/cursor/model_usage.js.map +1 -0
- package/lib/converters/cursor/plans_adoption.d.ts +8 -0
- package/lib/converters/cursor/plans_adoption.js +47 -0
- package/lib/converters/cursor/plans_adoption.js.map +1 -0
- package/lib/converters/cursor/tab_usage.d.ts +8 -0
- package/lib/converters/cursor/tab_usage.js +59 -0
- package/lib/converters/cursor/tab_usage.js.map +1 -0
- package/lib/converters/cursor/top_file_extensions.d.ts +8 -0
- package/lib/converters/cursor/top_file_extensions.js +57 -0
- package/lib/converters/cursor/top_file_extensions.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -4,7 +4,6 @@ import { AzureTfvcConverter } from './common';
|
|
|
4
4
|
export declare class Changesets extends AzureTfvcConverter {
|
|
5
5
|
private readonly branchCollector;
|
|
6
6
|
private readonly fileCollector;
|
|
7
|
-
private readonly mergeChainTracker;
|
|
8
7
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
9
8
|
id(record: AirbyteRecord): number;
|
|
10
9
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
@@ -5,69 +5,11 @@ const azure_devops_1 = require("faros-airbyte-common/azure-devops");
|
|
|
5
5
|
const faros_js_client_1 = require("faros-js-client");
|
|
6
6
|
const vcs_1 = require("../common/vcs");
|
|
7
7
|
const common_1 = require("./common");
|
|
8
|
-
/**
|
|
9
|
-
* Tracks merge chains to compute transitive branch associations.
|
|
10
|
-
* When a changeset is merged from branch A to B, all changesets on A
|
|
11
|
-
* are transitively associated with B.
|
|
12
|
-
*/
|
|
13
|
-
class MergeChainTracker {
|
|
14
|
-
constructor() {
|
|
15
|
-
// Maps changeset ID to the branch it was originally committed to
|
|
16
|
-
this.changesetBranch = new Map();
|
|
17
|
-
// Maps branch path to all changesets on that branch (including transitive)
|
|
18
|
-
this.branchChangesets = new Map();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Track a changeset and return only NEW associations for this branch.
|
|
22
|
-
*/
|
|
23
|
-
trackAndGetNewChangesets(changesetId, branch, mergedChangesetIds) {
|
|
24
|
-
this.changesetBranch.set(changesetId, branch);
|
|
25
|
-
const branchChangesets = this.getOrCreateBranchSet(branch);
|
|
26
|
-
const newAssociations = new Set();
|
|
27
|
-
this.addIfNew(changesetId, branchChangesets, newAssociations);
|
|
28
|
-
this.processMergedChangesets(mergedChangesetIds, branchChangesets, newAssociations);
|
|
29
|
-
return newAssociations;
|
|
30
|
-
}
|
|
31
|
-
getOrCreateBranchSet(branch) {
|
|
32
|
-
if (!this.branchChangesets.has(branch)) {
|
|
33
|
-
this.branchChangesets.set(branch, new Set());
|
|
34
|
-
}
|
|
35
|
-
return this.branchChangesets.get(branch);
|
|
36
|
-
}
|
|
37
|
-
addIfNew(id, branchChangesets, newAssociations) {
|
|
38
|
-
if (!branchChangesets.has(id)) {
|
|
39
|
-
newAssociations.add(id);
|
|
40
|
-
branchChangesets.add(id);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
processMergedChangesets(mergedChangesetIds, branchChangesets, newAssociations) {
|
|
44
|
-
for (const mergedId of mergedChangesetIds) {
|
|
45
|
-
const mergedIdStr = String(mergedId);
|
|
46
|
-
const sourceChangesets = this.getSourceBranchChangesets(mergedIdStr);
|
|
47
|
-
if (sourceChangesets) {
|
|
48
|
-
for (const cs of sourceChangesets) {
|
|
49
|
-
this.addIfNew(cs, branchChangesets, newAssociations);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.addIfNew(mergedIdStr, branchChangesets, newAssociations);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
getSourceBranchChangesets(mergedIdStr) {
|
|
58
|
-
const sourceBranch = this.changesetBranch.get(mergedIdStr);
|
|
59
|
-
if (sourceBranch && this.branchChangesets.has(sourceBranch)) {
|
|
60
|
-
return this.branchChangesets.get(sourceBranch);
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
8
|
class Changesets extends common_1.AzureTfvcConverter {
|
|
66
9
|
constructor() {
|
|
67
10
|
super(...arguments);
|
|
68
11
|
this.branchCollector = new vcs_1.BranchCollector();
|
|
69
12
|
this.fileCollector = new vcs_1.FileCollector();
|
|
70
|
-
this.mergeChainTracker = new MergeChainTracker();
|
|
71
13
|
this.destinationModels = [
|
|
72
14
|
'tms_TaskCommitAssociation',
|
|
73
15
|
'vcs_Branch',
|
|
@@ -151,9 +93,7 @@ class Changesets extends common_1.AzureTfvcConverter {
|
|
|
151
93
|
},
|
|
152
94
|
});
|
|
153
95
|
}
|
|
154
|
-
|
|
155
|
-
mergedIds.push(id);
|
|
156
|
-
}
|
|
96
|
+
mergedIds.push(...this.getMergedChangesetIds(change));
|
|
157
97
|
}
|
|
158
98
|
return { commitFiles, mergedChangesetIds: new Set(mergedIds) };
|
|
159
99
|
}
|
|
@@ -167,10 +107,7 @@ class Changesets extends common_1.AzureTfvcConverter {
|
|
|
167
107
|
const from = mergeSource.versionFrom;
|
|
168
108
|
const to = (_b = mergeSource.versionTo) !== null && _b !== void 0 ? _b : from;
|
|
169
109
|
if (from && to) {
|
|
170
|
-
|
|
171
|
-
for (let i = from; i <= to; i++) {
|
|
172
|
-
ids.push(i);
|
|
173
|
-
}
|
|
110
|
+
ids.push(...Array.from({ length: to - from + 1 }, (_, i) => from + i));
|
|
174
111
|
}
|
|
175
112
|
}
|
|
176
113
|
return ids;
|
|
@@ -180,15 +117,17 @@ class Changesets extends common_1.AzureTfvcConverter {
|
|
|
180
117
|
if (!branch) {
|
|
181
118
|
return [];
|
|
182
119
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
120
|
+
const records = [
|
|
121
|
+
{
|
|
122
|
+
model: 'vcs_BranchCommitAssociation',
|
|
123
|
+
record: { commit, branch, committedAt },
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
for (const mergedId of mergedChangesetIds) {
|
|
188
127
|
records.push({
|
|
189
128
|
model: 'vcs_BranchCommitAssociation',
|
|
190
129
|
record: {
|
|
191
|
-
commit: { sha:
|
|
130
|
+
commit: { sha: String(mergedId), repository },
|
|
192
131
|
branch,
|
|
193
132
|
committedAt,
|
|
194
133
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/converters/azure-tfvc/changesets.ts"],"names":[],"mappings":";;;AACA,oEAA+E;AAE/E,qDAAsC;AAEtC,uCAOuB;AAEvB,qCAAoE;AAOpE
|
|
1
|
+
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/converters/azure-tfvc/changesets.ts"],"names":[],"mappings":";;;AACA,oEAA+E;AAE/E,qDAAsC;AAEtC,uCAOuB;AAEvB,qCAAoE;AAOpE,MAAa,UAAW,SAAQ,2BAAkB;IAAlD;;QACmB,oBAAe,GAAG,IAAI,qBAAe,EAAE,CAAC;QACxC,kBAAa,GAAG,IAAI,mBAAa,EAAE,CAAC;QAE5C,sBAAiB,GAAoC;YAC5D,2BAA2B;YAC3B,YAAY;YACZ,6BAA6B;YAC7B,YAAY;YACZ,gBAAgB;YAChB,UAAU;SACX,CAAC;IA8LJ,CAAC;IA5LC,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,WAAW,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAiB,CAAC;QAElD,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YAC3B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YACxE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,aAAO,EACxB,SAAS,CAAC,YAAY,EACtB,MAAA,SAAS,CAAC,OAAO,0CAAE,IAAI,EACvB,IAAI,CAAC,MAAM,CACZ,CAAC;QACF,IAAI,CAAC,UAAU,EA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AG,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAC;oBAC3C,MAAM;oBACN,WAAW;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,sBAAsB,CAC5B,MAAiB,EACjB,SAAiC;QAEjC,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,KAAK,MAAM,QAAQ,IAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE,CAAC;YACvC,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;gBAChB,OAAO,CAAC,IAAI,CAAC;oBACX,KAAK,EAAE,2BAA2B;oBAClC,MAAM,EAAE;wBACN,MAAM;wBACN,IAAI,EAAE,EAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAC;qBAC5D;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,GAAkB;QAElB,OAAO;YACL,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE;YACzC,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;SACrC,CAAC;IACJ,CAAC;CACF;AAzMD,gCAyMC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { CursorConverter } from './common';
|
|
4
|
+
export declare class AgentEdits extends CursorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): string;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentEdits = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const vcs_1 = require("../common/vcs");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
const AgentEditsFieldToMetricType = {
|
|
10
|
+
total_accepted_diffs: vcs_1.AssistantMetric.SuggestionsAccepted,
|
|
11
|
+
total_rejected_diffs: vcs_1.AssistantMetric.SuggestionsDiscarded,
|
|
12
|
+
total_green_lines_suggested: vcs_1.AssistantMetric.LinesSuggestedToAdd,
|
|
13
|
+
total_green_lines_accepted: vcs_1.AssistantMetric.AILinesAdded,
|
|
14
|
+
total_red_lines_suggested: vcs_1.AssistantMetric.LinesSuggestedToRemove,
|
|
15
|
+
total_red_lines_accepted: vcs_1.AssistantMetric.AILinesRemoved,
|
|
16
|
+
};
|
|
17
|
+
class AgentEdits extends common_1.CursorConverter {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.destinationModels = [
|
|
21
|
+
'vcs_AssistantMetric',
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
id(record) {
|
|
25
|
+
const item = record.record.data;
|
|
26
|
+
return item.event_date;
|
|
27
|
+
}
|
|
28
|
+
async convert(record, ctx) {
|
|
29
|
+
const item = record.record.data;
|
|
30
|
+
if (!item.email) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const day = faros_js_client_1.Utils.toDate(item.event_date);
|
|
34
|
+
const organization = {
|
|
35
|
+
uid: this.streamName.source,
|
|
36
|
+
source: this.streamName.source,
|
|
37
|
+
};
|
|
38
|
+
const res = [];
|
|
39
|
+
for (const [field, metricType] of Object.entries(AgentEditsFieldToMetricType)) {
|
|
40
|
+
const value = item[field];
|
|
41
|
+
if ((0, lodash_1.isNil)(value) || value <= 0) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
res.push(...this.getAssistantMetric({
|
|
45
|
+
startedAt: day,
|
|
46
|
+
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
47
|
+
assistantMetricType: metricType,
|
|
48
|
+
assistantMetricTypeDetail: common_1.CursorStream.AgentEdits,
|
|
49
|
+
value,
|
|
50
|
+
organization,
|
|
51
|
+
userEmail: item.email,
|
|
52
|
+
feature: common_1.Feature.Agent,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
return res;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.AgentEdits = AgentEdits;
|
|
59
|
+
//# sourceMappingURL=agent_edits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent_edits.js","sourceRoot":"","sources":["../../../src/converters/cursor/agent_edits.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AACtC,mCAA6B;AAE7B,uCAA8C;AAE9C,qCAAgE;AAEhE,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAM,2BAA2B,GAE7B;IACF,oBAAoB,EAAE,qBAAe,CAAC,mBAAmB;IACzD,oBAAoB,EAAE,qBAAe,CAAC,oBAAoB;IAC1D,2BAA2B,EAAE,qBAAe,CAAC,mBAAmB;IAChE,0BAA0B,EAAE,qBAAe,CAAC,YAAY;IACxD,yBAAyB,EAAE,qBAAe,CAAC,sBAAsB;IACjE,wBAAwB,EAAE,qBAAe,CAAC,cAAc;CACzD,CAAC;AAEF,MAAa,UAAW,SAAQ,wBAAe;IAA/C;;QACW,sBAAiB,GAAoC;YAC5D,qBAAqB;SACtB,CAAC;IAgDJ,CAAC;IA9CC,EAAE,CAAC,MAAqB;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAsB,CAAC;QAClD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,KA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, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { CursorConverter } from './common';
|
|
4
|
+
export declare class AskModeAdoption extends CursorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): string;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AskModeAdoption = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const vcs_1 = require("../common/vcs");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
class AskModeAdoption extends common_1.CursorConverter {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.destinationModels = [
|
|
13
|
+
'vcs_AssistantMetric',
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
id(record) {
|
|
17
|
+
const item = record.record.data;
|
|
18
|
+
return `${item.event_date}__${item.model}`;
|
|
19
|
+
}
|
|
20
|
+
async convert(record, ctx) {
|
|
21
|
+
const item = record.record.data;
|
|
22
|
+
if (!item.email) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
if ((0, lodash_1.isNil)(item.usage) || item.usage <= 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const day = faros_js_client_1.Utils.toDate(item.event_date);
|
|
29
|
+
const organization = {
|
|
30
|
+
uid: this.streamName.source,
|
|
31
|
+
source: this.streamName.source,
|
|
32
|
+
};
|
|
33
|
+
return this.getAssistantMetric({
|
|
34
|
+
startedAt: day,
|
|
35
|
+
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
36
|
+
assistantMetricType: vcs_1.AssistantMetric.Usages,
|
|
37
|
+
assistantMetricTypeDetail: common_1.CursorStream.AskModeAdoption,
|
|
38
|
+
value: item.usage,
|
|
39
|
+
organization,
|
|
40
|
+
userEmail: item.email,
|
|
41
|
+
feature: common_1.Feature.Ask,
|
|
42
|
+
model: item.model,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AskModeAdoption = AskModeAdoption;
|
|
47
|
+
//# sourceMappingURL=ask_mode_adoption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask_mode_adoption.js","sourceRoot":"","sources":["../../../src/converters/cursor/ask_mode_adoption.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AACtC,mCAA6B;AAE7B,uCAA8C;AAE9C,qCAAgE;AAEhE,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAa,eAAgB,SAAQ,wBAAe;IAApD;;QACW,sBAAiB,GAAoC;YAC5D,qBAAqB;SACtB,CAAC;IAuCJ,CAAC;IArCC,EAAE,CAAC,MAAqB;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAA2B,CAAC;QACvD,OAAO,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAA2B,CAAC;QAEvD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,IAAA,cAAK,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,GAAG,GAAG,uBAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG;YACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;YAC3B,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;SAC/B,CAAC;QAEF,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,SAAS,EAAE,GAAG;YACd,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;YAC7C,mBAAmB,EAAE,qBAAe,CAAC,MAAM;YAC3C,yBAAyB,EAAE,qBAAY,CAAC,eAAe;YACvD,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY;YACZ,SAAS,EAAE,IAAI,CAAC,KAAK;YACrB,OAAO,EAAE,gBAAO,CAAC,GAAG;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,0CA0CC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { CursorConverter } from './common';
|
|
4
|
+
export declare class ClientVersions extends CursorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): string;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientVersions = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const vcs_1 = require("../common/vcs");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
8
|
+
class ClientVersions extends common_1.CursorConverter {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.destinationModels = [
|
|
12
|
+
'vcs_AssistantMetric',
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
id(record) {
|
|
16
|
+
const item = record.record.data;
|
|
17
|
+
return `${item.event_date}__${item.client_version}`;
|
|
18
|
+
}
|
|
19
|
+
async convert(record, ctx) {
|
|
20
|
+
const item = record.record.data;
|
|
21
|
+
if (!item.email || !item.client_version) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
const day = faros_js_client_1.Utils.toDate(item.event_date);
|
|
25
|
+
const organization = {
|
|
26
|
+
uid: this.streamName.source,
|
|
27
|
+
source: this.streamName.source,
|
|
28
|
+
};
|
|
29
|
+
return this.getAssistantMetric({
|
|
30
|
+
startedAt: day,
|
|
31
|
+
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
32
|
+
assistantMetricType: vcs_1.AssistantMetric.Engagement,
|
|
33
|
+
assistantMetricTypeDetail: common_1.CursorStream.ClientVersions,
|
|
34
|
+
value: true,
|
|
35
|
+
organization,
|
|
36
|
+
userEmail: item.email,
|
|
37
|
+
editor: item.client_version,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ClientVersions = ClientVersions;
|
|
42
|
+
//# sourceMappingURL=client_versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_versions.js","sourceRoot":"","sources":["../../../src/converters/cursor/client_versions.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AAEtC,uCAA8C;AAE9C,qCAAuD;AAEvD,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAa,cAAe,SAAQ,wBAAe;IAAnD;;QACW,sBAAiB,GAAoC;YAC5D,qBAAqB;SACtB,CAAC;IAkCJ,CAAC;IAhCC,EAAE,CAAC,MAAqB;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAA0B,CAAC;QACtD,OAAO,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAA0B,CAAC;QAEtD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,GAAG,GAAG,uBAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG;YACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;YAC3B,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;SAC/B,CAAC;QAEF,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,SAAS,EAAE,GAAG;YACd,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;YAC7C,mBAAmB,EAAE,qBAAe,CAAC,UAAU;YAC/C,yBAAyB,EAAE,qBAAY,CAAC,cAAc;YACtD,KAAK,EAAE,IAAI;YACX,YAAY;YACZ,SAAS,EAAE,IAAI,CAAC,KAAK;YACrB,MAAM,EAAE,IAAI,CAAC,cAAc;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AArCD,wCAqCC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { CursorConverter } from './common';
|
|
4
|
+
export declare class CommandsAdoption extends CursorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): string;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandsAdoption = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const vcs_1 = require("../common/vcs");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
|
+
class CommandsAdoption extends common_1.CursorConverter {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.destinationModels = [
|
|
13
|
+
'vcs_AssistantMetric',
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
id(record) {
|
|
17
|
+
const item = record.record.data;
|
|
18
|
+
return `${item.event_date}__${item.command_name}`;
|
|
19
|
+
}
|
|
20
|
+
async convert(record, ctx) {
|
|
21
|
+
const item = record.record.data;
|
|
22
|
+
if (!item.email) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
if ((0, lodash_1.isNil)(item.usage) || item.usage <= 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const day = faros_js_client_1.Utils.toDate(item.event_date);
|
|
29
|
+
const organization = {
|
|
30
|
+
uid: this.streamName.source,
|
|
31
|
+
source: this.streamName.source,
|
|
32
|
+
};
|
|
33
|
+
const feature = `Command:${item.command_name}`;
|
|
34
|
+
return this.getAssistantMetric({
|
|
35
|
+
startedAt: day,
|
|
36
|
+
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
37
|
+
assistantMetricType: vcs_1.AssistantMetric.Usages,
|
|
38
|
+
assistantMetricTypeDetail: common_1.CursorStream.CommandsAdoption,
|
|
39
|
+
value: item.usage,
|
|
40
|
+
organization,
|
|
41
|
+
userEmail: item.email,
|
|
42
|
+
feature,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.CommandsAdoption = CommandsAdoption;
|
|
47
|
+
//# sourceMappingURL=commands_adoption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands_adoption.js","sourceRoot":"","sources":["../../../src/converters/cursor/commands_adoption.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AACtC,mCAA6B;AAE7B,uCAA8C;AAE9C,qCAAuD;AAEvD,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAa,gBAAiB,SAAQ,wBAAe;IAArD;;QACW,sBAAiB,GAAoC;YAC5D,qBAAqB;SACtB,CAAC;IAwCJ,CAAC;IAtCC,EAAE,CAAC,MAAqB;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAA4B,CAAC;QACxD,OAAO,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAA4B,CAAC;QAExD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,IAAA,cAAK,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,GAAG,GAAG,uBAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG;YACnB,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;YAC3B,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;SAC/B,CAAC;QAEF,MAAM,OAAO,GAAG,WAAW,IAAI,CAAC,YAAY,EAAE,CAAC;QAE/C,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,SAAS,EAAE,GAAG;YACd,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;YAC7C,mBAAmB,EAAE,qBAAe,CAAC,MAAM;YAC3C,yBAAyB,EAAE,qBAAY,CAAC,gBAAgB;YACxD,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY;YACZ,SAAS,EAAE,IAAI,CAAC,KAAK;YACrB,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF;AA3CD,4CA2CC"}
|
|
@@ -9,13 +9,15 @@ export interface AssistantMetricConfig {
|
|
|
9
9
|
startedAt: Date;
|
|
10
10
|
endedAt: Date;
|
|
11
11
|
assistantMetricType: string;
|
|
12
|
+
assistantMetricTypeDetail?: string;
|
|
12
13
|
value: number | string | boolean;
|
|
13
14
|
organization: OrgKey;
|
|
14
15
|
userEmail: string;
|
|
15
|
-
customMetricName?: keyof DailyUsageItem;
|
|
16
16
|
model?: string;
|
|
17
17
|
feature?: string;
|
|
18
18
|
repository?: RepoKey;
|
|
19
|
+
editor?: string;
|
|
20
|
+
language?: string;
|
|
19
21
|
}
|
|
20
22
|
export declare enum Feature {
|
|
21
23
|
Tab = "Tab",
|
|
@@ -23,7 +25,23 @@ export declare enum Feature {
|
|
|
23
25
|
Chat = "Chat",
|
|
24
26
|
Agent = "Agent",
|
|
25
27
|
CmdK = "Cmd+K",
|
|
26
|
-
BugBot = "BugBot"
|
|
28
|
+
BugBot = "BugBot",
|
|
29
|
+
CLI = "CLI",
|
|
30
|
+
CloudAgent = "CloudAgent",
|
|
31
|
+
Ask = "Ask",
|
|
32
|
+
Plan = "Plan"
|
|
33
|
+
}
|
|
34
|
+
export declare enum CursorStream {
|
|
35
|
+
AgentEdits = "agent_edits",
|
|
36
|
+
TabUsage = "tab_usage",
|
|
37
|
+
DailyActiveUsers = "daily_active_users",
|
|
38
|
+
ModelUsage = "model_usage",
|
|
39
|
+
ClientVersions = "client_versions",
|
|
40
|
+
McpAdoption = "mcp_adoption",
|
|
41
|
+
CommandsAdoption = "commands_adoption",
|
|
42
|
+
PlansAdoption = "plans_adoption",
|
|
43
|
+
AskModeAdoption = "ask_mode_adoption",
|
|
44
|
+
TopFileExtensions = "top_file_extensions"
|
|
27
45
|
}
|
|
28
46
|
export declare abstract class CursorConverter extends Converter {
|
|
29
47
|
source: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CursorConverter = exports.Feature = void 0;
|
|
3
|
+
exports.CursorConverter = exports.CursorStream = exports.Feature = void 0;
|
|
4
4
|
const common_1 = require("faros-airbyte-common/common");
|
|
5
5
|
const lodash_1 = require("lodash");
|
|
6
6
|
const vcs_1 = require("../common/vcs");
|
|
@@ -13,7 +13,24 @@ var Feature;
|
|
|
13
13
|
Feature["Agent"] = "Agent";
|
|
14
14
|
Feature["CmdK"] = "Cmd+K";
|
|
15
15
|
Feature["BugBot"] = "BugBot";
|
|
16
|
+
Feature["CLI"] = "CLI";
|
|
17
|
+
Feature["CloudAgent"] = "CloudAgent";
|
|
18
|
+
Feature["Ask"] = "Ask";
|
|
19
|
+
Feature["Plan"] = "Plan";
|
|
16
20
|
})(Feature || (exports.Feature = Feature = {}));
|
|
21
|
+
var CursorStream;
|
|
22
|
+
(function (CursorStream) {
|
|
23
|
+
CursorStream["AgentEdits"] = "agent_edits";
|
|
24
|
+
CursorStream["TabUsage"] = "tab_usage";
|
|
25
|
+
CursorStream["DailyActiveUsers"] = "daily_active_users";
|
|
26
|
+
CursorStream["ModelUsage"] = "model_usage";
|
|
27
|
+
CursorStream["ClientVersions"] = "client_versions";
|
|
28
|
+
CursorStream["McpAdoption"] = "mcp_adoption";
|
|
29
|
+
CursorStream["CommandsAdoption"] = "commands_adoption";
|
|
30
|
+
CursorStream["PlansAdoption"] = "plans_adoption";
|
|
31
|
+
CursorStream["AskModeAdoption"] = "ask_mode_adoption";
|
|
32
|
+
CursorStream["TopFileExtensions"] = "top_file_extensions";
|
|
33
|
+
})(CursorStream || (exports.CursorStream = CursorStream = {}));
|
|
17
34
|
class CursorConverter extends converter_1.Converter {
|
|
18
35
|
constructor() {
|
|
19
36
|
super(...arguments);
|
|
@@ -28,7 +45,7 @@ class CursorConverter extends converter_1.Converter {
|
|
|
28
45
|
return (_c = (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _a === void 0 ? void 0 : _a.source_specific_configs) === null || _b === void 0 ? void 0 : _b.cursor) !== null && _c !== void 0 ? _c : {};
|
|
29
46
|
}
|
|
30
47
|
getAssistantMetric(config) {
|
|
31
|
-
const { startedAt, endedAt, assistantMetricType, value, organization, userEmail,
|
|
48
|
+
const { startedAt, endedAt, assistantMetricType, assistantMetricTypeDetail, value, organization, userEmail, model, feature, repository, editor, language, } = config;
|
|
32
49
|
return [
|
|
33
50
|
{
|
|
34
51
|
model: 'vcs_AssistantMetric',
|
|
@@ -42,13 +59,15 @@ class CursorConverter extends converter_1.Converter {
|
|
|
42
59
|
startedAt.toISOString(),
|
|
43
60
|
organization.uid,
|
|
44
61
|
userEmail,
|
|
45
|
-
|
|
62
|
+
assistantMetricTypeDetail,
|
|
46
63
|
],
|
|
47
64
|
// newer fields (optional) to be included in the digest
|
|
48
65
|
...[
|
|
49
66
|
{ key: 'model', value: model },
|
|
50
67
|
{ key: 'feature', value: feature },
|
|
51
68
|
{ key: 'repository', value: repository === null || repository === void 0 ? void 0 : repository.uid },
|
|
69
|
+
{ key: 'editor', value: editor },
|
|
70
|
+
{ key: 'language', value: language },
|
|
52
71
|
]
|
|
53
72
|
.filter((v) => !(0, lodash_1.isNil)(v.value))
|
|
54
73
|
.map((v) => `${v.key}:${v.value}`))
|
|
@@ -58,7 +77,7 @@ class CursorConverter extends converter_1.Converter {
|
|
|
58
77
|
endedAt,
|
|
59
78
|
type: {
|
|
60
79
|
category: assistantMetricType,
|
|
61
|
-
...(
|
|
80
|
+
...(assistantMetricTypeDetail && { detail: assistantMetricTypeDetail }),
|
|
62
81
|
},
|
|
63
82
|
valueType: getValueType(value),
|
|
64
83
|
value: String(value),
|
|
@@ -71,6 +90,8 @@ class CursorConverter extends converter_1.Converter {
|
|
|
71
90
|
...(model && { model }),
|
|
72
91
|
...(feature && { feature }),
|
|
73
92
|
...(repository && { repository }),
|
|
93
|
+
...(editor && { editor }),
|
|
94
|
+
...(language && { language }),
|
|
74
95
|
},
|
|
75
96
|
},
|
|
76
97
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/cursor/common.ts"],"names":[],"mappings":";;;AACA,wDAAmD;AAEnD,mCAA6B;AAE7B,uCAA8E;AAC9E,4CAAyE;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/cursor/common.ts"],"names":[],"mappings":";;;AACA,wDAAmD;AAEnD,mCAA6B;AAE7B,uCAA8E;AAC9E,4CAAyE;AAqBzE,IAAY,OAWX;AAXD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,gCAAqB,CAAA;IACrB,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,yBAAc,CAAA;IACd,4BAAiB,CAAA;IACjB,sBAAW,CAAA;IACX,oCAAyB,CAAA;IACzB,sBAAW,CAAA;IACX,wBAAa,CAAA;AACf,CAAC,EAXW,OAAO,uBAAP,OAAO,QAWlB;AAED,IAAY,YAWX;AAXD,WAAY,YAAY;IACtB,0CAA0B,CAAA;IAC1B,sCAAsB,CAAA;IACtB,uDAAuC,CAAA;IACvC,0CAA0B,CAAA;IAC1B,kDAAkC,CAAA;IAClC,4CAA4B,CAAA;IAC5B,sDAAsC,CAAA;IACtC,gDAAgC,CAAA;IAChC,qDAAqC,CAAA;IACrC,yDAAyC,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K,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { CursorConverter } from './common';
|
|
4
|
+
export declare class DailyActiveUsers extends CursorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): string;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DailyActiveUsers = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const vcs_1 = require("../common/vcs");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
8
|
+
const DauFieldToFeature = {
|
|
9
|
+
cli_dau: common_1.Feature.CLI,
|
|
10
|
+
cloud_agent_dau: common_1.Feature.CloudAgent,
|
|
11
|
+
bugbot_dau: common_1.Feature.BugBot,
|
|
12
|
+
};
|
|
13
|
+
class DailyActiveUsers extends common_1.CursorConverter {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.destinationModels = [
|
|
17
|
+
'vcs_AssistantMetric',
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
id(record) {
|
|
21
|
+
const item = record.record.data;
|
|
22
|
+
return item.date;
|
|
23
|
+
}
|
|
24
|
+
async convert(record, ctx) {
|
|
25
|
+
const item = record.record.data;
|
|
26
|
+
if (!item.email) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const day = faros_js_client_1.Utils.toDate(item.date);
|
|
30
|
+
const organization = {
|
|
31
|
+
uid: this.streamName.source,
|
|
32
|
+
source: this.streamName.source,
|
|
33
|
+
};
|
|
34
|
+
const res = [];
|
|
35
|
+
// Write Engagement for overall DAU if > 0
|
|
36
|
+
if (item.dau > 0) {
|
|
37
|
+
res.push(...this.getAssistantMetric({
|
|
38
|
+
startedAt: day,
|
|
39
|
+
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
40
|
+
assistantMetricType: vcs_1.AssistantMetric.Engagement,
|
|
41
|
+
assistantMetricTypeDetail: common_1.CursorStream.DailyActiveUsers,
|
|
42
|
+
value: true,
|
|
43
|
+
organization,
|
|
44
|
+
userEmail: item.email,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
// Write Engagement for each feature-specific DAU if > 0
|
|
48
|
+
for (const [field, feature] of Object.entries(DauFieldToFeature)) {
|
|
49
|
+
const value = item[field];
|
|
50
|
+
if (value > 0) {
|
|
51
|
+
res.push(...this.getAssistantMetric({
|
|
52
|
+
startedAt: day,
|
|
53
|
+
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
54
|
+
assistantMetricType: vcs_1.AssistantMetric.Engagement,
|
|
55
|
+
assistantMetricTypeDetail: common_1.CursorStream.DailyActiveUsers,
|
|
56
|
+
value: true,
|
|
57
|
+
organization,
|
|
58
|
+
userEmail: item.email,
|
|
59
|
+
feature,
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return res;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.DailyActiveUsers = DailyActiveUsers;
|
|
67
|
+
//# sourceMappingURL=daily_active_users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daily_active_users.js","sourceRoot":"","sources":["../../../src/converters/cursor/daily_active_users.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;A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C,yBAAyB,EAAE,qBAAY,CAAC,gBAAgB;gBACxD,KAAK,EAAE,IAAI;gBACX,YAAY;gBACZ,SAAS,EAAE,IAAI,CAAC,KAAK;aACtB,CAAC,CACH,CAAC;QACJ,CAAC;QAED,wDAAwD;QACxD,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACjE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAmC,CAAW,CAAC;YAClE,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,GAAG,CAAC,IAAI,CACN,GAAG,IAAI,CAAC,kBAAkB,CAAC;oBACzB,SAAS,EAAE,GAAG;oBACd,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;oBAC7C,mBAAmB,EAAE,qBAAe,CAAC,UAAU;oBAC/C,yBAAyB,EAAE,qBAAY,CAAC,gBAAgB;oBACxD,KAAK,EAAE,IAAI;oBACX,YAAY;oBACZ,SAAS,EAAE,IAAI,CAAC,KAAK;oBACrB,OAAO;iBACR,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAhED,4CAgEC"}
|
|
@@ -69,10 +69,10 @@ class DailyUsage extends common_1.CursorConverter {
|
|
|
69
69
|
startedAt: day,
|
|
70
70
|
endedAt: faros_js_client_1.Utils.toDate(day.getTime() + DAY_MS),
|
|
71
71
|
assistantMetricType: vcs_1.AssistantMetric.Custom,
|
|
72
|
+
assistantMetricTypeDetail: field,
|
|
72
73
|
value,
|
|
73
74
|
organization,
|
|
74
75
|
userEmail: dailyUsageItem.email,
|
|
75
|
-
customMetricName: field,
|
|
76
76
|
}));
|
|
77
77
|
}
|
|
78
78
|
for (const [field, feature] of Object.entries(DailyUsageItemToFeature)) {
|