Skip to content

Commit

Permalink
SIGH. Javascript. You can't deserialize json into a map.
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc committed Jun 3, 2024
1 parent 6de5fcc commit 0cf5bc8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
9 changes: 6 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/check-in.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type CheckIn = {
status: StatusSummary | null;
options: Map<string, Feature>;
options: { [k: string]: Feature };
};

export type StatusSummary = {
Expand Down
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export abstract class DetSysAction {
private events: DiagnosticEvent[];
private identity: correlation.AnonymizedCorrelationHashes;
private idsHost: IdsHost;
private features: Map<string, Feature>;
private features: { [k: string]: Feature };
private featureEventMetadata: Map<string, string | boolean>;

private determineExecutionPhase(): ExecutionPhase {
Expand All @@ -180,7 +180,7 @@ export abstract class DetSysAction {
this.nixStoreTrust = "unknown";
this.strictMode = getBool("_internal-strict-mode");

this.features = new Map();
this.features = {};
this.featureEventMetadata = new Map();
this.events = [];
this.client = got.extend({
Expand Down Expand Up @@ -442,7 +442,7 @@ export abstract class DetSysAction {
}

this.features = checkin.options;
for (const [key, feature] of this.features.entries()) {
for (const [key, feature] of Object.entries(this.features)) {
this.featureEventMetadata.set(key, feature.variant);
}

Expand Down Expand Up @@ -485,7 +485,11 @@ export abstract class DetSysAction {
}

getFeature(name: string): Feature | undefined {
const result = this.features.get(name);
if (!this.features.hasOwnProperty(name)) {
return undefined;
}

const result = this.features[name];
if (result === undefined) {
return undefined;
}
Expand Down

0 comments on commit 0cf5bc8

Please sign in to comment.