feat(medusa): Module Resolution API (#2597)

This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2022-11-20 22:01:46 +01:00
1 parent e09f6e8a1e
commit d7997ef256
20 files changed
+209 -21

No files matched your search

+11
View File
@@ -21,4 +21,15 @@ export function trackFeatureFlag(flag) {
telemeter.trackFeatureFlag(flag)
}
export function trackInstallation(installation, type) {
switch (type) {
case `plugin`:
telemeter.trackPlugin(installation)
break
case `module`:
telemeter.trackModule(installation)
break
}
}
export { default as Telemeter } from "./telemeter"
@@ -26,6 +26,8 @@ class Telemeter {
this.queueCount_ = this.store_.getQueueCount()
this.featureFlags_ = new Set()
this.modules_ = new Set()
this.plugins_ = []
}
getMachineId() {
@@ -133,6 +135,8 @@ class Telemeter {
medusa_version: this.getMedusaVersion(),
cli_version: this.getCliVersion(),
feature_flags: Array.from(this.featureFlags_),
modules: Array.from(this.modules_),
plugins: this.plugins_,
}
this.store_.addEvent(event)
@@ -161,6 +165,18 @@ class Telemeter {
this.featureFlags_.add(flag)
}
}
trackModule(module) {
if (module) {
this.modules_.add(module)
}
}
trackPlugin(plugin) {
if (plugin) {
this.plugins_.push(plugin)
}
}
}
export default Telemeter