Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install node
npm --prefix ./glean install
npm --prefix ./glean run build
npm --prefix ./glean run build:qt
- run:
name: Verify no Javascript errors found in Qt
command: bin/qt-js-check.sh
Expand Down
9 changes: 9 additions & 0 deletions bin/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ ${CHANGELOG}
EOL
fi

## Constants ###

FILE=glean/src/core/constants.ts

run $SED -i.bak -E \
-e "s/export const GLEAN_VERSION = \"[0-9a-z.-]+\";/export const GLEAN_VERSION = \"${NEW_VERSION}\";/" \
"${WORKSPACE_ROOT}/${FILE}"
run rm "${WORKSPACE_ROOT}/${FILE}.bak"

echo "Everything prepared for v${NEW_VERSION}"
echo
echo "Changed files:"
Expand Down
26 changes: 18 additions & 8 deletions glean/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,34 @@
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for Javascript environments.",
"exports": {
"./package.json": "./package.json",
"./qt": "./dist/qt.js",
"./webext": "./dist/webext.js"
"./webext": "./dist/webext/index/webext.js",
"./webext/private/metrics/*": "./dist/webext/core/metrics/types/*.js",
"./webext/private/ping": "./dist/webext/core/pings/index.js"
},
"typesVersions": {
"*": {
"webext/*": [
"./dist/webext/types/*"
]
}
},
"files": [
"README.md",
"package.json",
"dist/**/*.js"
"dist/**/*"
],
"scripts": {
"test": "npm run test:core && npm run test:platform",
"test:core": "ts-mocha \"tests/core/**/*.spec.ts\" --paths -p ./tsconfig.json --recursive",
"test:platform": "npm run build:test-webext && ts-mocha \"tests/platform/**/*.spec.ts\" --paths -p ./tsconfig.json --recursive --timeout 0",
"test:core": "ts-mocha \"tests/core/**/*.spec.ts\" --recursive",
"test:platform": "npm run build:test-webext && ts-mocha \"tests/platform/**/*.spec.ts\" --recursive --timeout 0",
"build:test-webext": "cd tests/platform/utils/webext/sample/ && npm install && npm run build:xpi",
"lint": "eslint . --ext .ts,.js,.json --max-warnings=0",
"fix": "eslint . --ext .ts,.js,.json --fix",
"build": "webpack --config webpack.config.js --mode production",
"dev": "webpack --watch --config webpack.config.js --mode development --devtool inline-source-map",
"prepublishOnly": "cp ../README.md ./README.md && npm run build",
"build:webext:lib": "tsc -p ./tsconfig/webext/index.json",
"build:webext:types": "tsc -p ./tsconfig/webext/types.json",
"build:webext": "npm run build:webext:lib && npm run build:webext:types",
"build:qt": "webpack --config webpack.config.qt.js --mode production",
"prepublishOnly": "cp ../README.md ./README.md && npm run build:webext",
"postpublish": "rm ./README.md"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions glean/src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { DEFAULT_TELEMETRY_ENDPOINT } from "core/constants";
import { validateURL } from "core/utils";
import { DEFAULT_TELEMETRY_ENDPOINT } from "./constants";
import { validateURL } from "./utils";

/**
* Lists Glean's debug options.
Expand Down
4 changes: 1 addition & 3 deletions glean/src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { version } from "../../package.json";

export const GLEAN_SCHEMA_VERSION = 1;

// The version for the current build of Glean.js
//
// PACKAGE_VERSION is defined as a global by webpack,
// we need a default here for testing when the app is not build with webpack.
export const GLEAN_VERSION = version;
export const GLEAN_VERSION = "0.1.1";

// The name of a "ping" that will include Glean ping_info metrics,
// such as ping sequence numbers.
Expand Down
2 changes: 1 addition & 1 deletion glean/src/core/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { generateUUIDv4 } from "core/utils";
import { generateUUIDv4 } from "./utils";

// The possible states a dispatcher instance can be in.
export const enum DispatcherState {
Expand Down
32 changes: 16 additions & 16 deletions glean/src/core/glean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { CLIENT_INFO_STORAGE, KNOWN_CLIENT_ID } from "core/constants";
import { Configuration, ConfigurationInterface } from "core/config";
import MetricsDatabase from "core/metrics/database";
import PingsDatabase from "core/pings/database";
import PingUploader from "core/upload";
import { isUndefined, sanitizeApplicationId } from "core/utils";
import { CoreMetrics } from "core/internal_metrics";
import { Lifetime } from "core/metrics";
import EventsDatabase from "core/metrics/events_database";
import UUIDMetricType from "core/metrics/types/uuid";
import DatetimeMetricType, { DatetimeMetric } from "core/metrics/types/datetime";
import Dispatcher from "core/dispatcher";
import CorePings from "core/internal_pings";

import Platform from "platform/index";
import TestPlatform from "platform/test";
import { CLIENT_INFO_STORAGE, KNOWN_CLIENT_ID } from "./constants";
import { Configuration, ConfigurationInterface } from "./config";
import MetricsDatabase from "./metrics/database";
import PingsDatabase from "./pings/database";
import PingUploader from "./upload";
import { isUndefined, sanitizeApplicationId } from "./utils";
import { CoreMetrics } from "./internal_metrics";
import { Lifetime } from "./metrics";
import EventsDatabase from "./metrics/events_database";
import UUIDMetricType from "./metrics/types/uuid";
import DatetimeMetricType, { DatetimeMetric } from "./metrics/types/datetime";
import Dispatcher from "./dispatcher";
import CorePings from "./internal_pings";

import Platform from "../platform/index";
import TestPlatform from "../platform/test";

class Glean {
// The Glean singleton.
Expand Down
18 changes: 9 additions & 9 deletions glean/src/core/internal_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { KNOWN_CLIENT_ID, CLIENT_INFO_STORAGE } from "core/constants";
import UUIDMetricType from "core/metrics/types/uuid";
import DatetimeMetricType from "core/metrics/types/datetime";
import StringMetricType from "core/metrics/types/string";
import { createMetric } from "core/metrics/utils";
import TimeUnit from "core/metrics/time_unit";
import { Lifetime } from "core/metrics";
import { generateUUIDv4 } from "core/utils";
import Glean from "core/glean";
import { KNOWN_CLIENT_ID, CLIENT_INFO_STORAGE } from "./constants";
import UUIDMetricType from "./metrics/types/uuid";
import DatetimeMetricType from "./metrics/types/datetime";
import StringMetricType from "./metrics/types/string";
import { createMetric } from "./metrics/utils";
import TimeUnit from "./metrics/time_unit";
import { Lifetime } from "./metrics";
import { generateUUIDv4 } from "./utils";
import Glean from "./glean";

/**
* Glean internal metrics.
Expand Down
4 changes: 2 additions & 2 deletions glean/src/core/internal_pings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { DELETION_REQUEST_PING_NAME } from "core/constants";
import PingType from "core/pings";
import { DELETION_REQUEST_PING_NAME } from "./constants";
import PingType from "./pings";

/**
* Glean-provided pings, all enabled by default.
Expand Down
10 changes: 5 additions & 5 deletions glean/src/core/metrics/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// * License, v. 2.0. If a copy of the MPL was not distributed with this
// * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Store from "core/storage";
import { MetricType, Lifetime, Metric } from "core/metrics";
import { createMetric, validateMetricInternalRepresentation } from "core/metrics/utils";
import { isObject, isUndefined, JSONValue } from "core/utils";
import Glean from "core/glean";
import Store from "../storage";
import { MetricType, Lifetime, Metric } from "./";
import { createMetric, validateMetricInternalRepresentation } from "./utils";
import { isObject, isUndefined, JSONValue } from "../utils";
import Glean from "../glean";

export interface Metrics {
[aMetricType: string]: {
Expand Down
8 changes: 4 additions & 4 deletions glean/src/core/metrics/events_database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// * License, v. 2.0. If a copy of the MPL was not distributed with this
// * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Store from "core/storage";
import { isUndefined, JSONArray, JSONObject, JSONValue } from "core/utils";
import EventMetricType from "core/metrics/types/event";
import Glean from "core/glean";
import Store from "../storage";
import { isUndefined, JSONArray, JSONObject, JSONValue } from "../utils";
import EventMetricType from "./types/event";
import Glean from "../glean";

export interface Metrics {
[aMetricType: string]: {
Expand Down
4 changes: 2 additions & 2 deletions glean/src/core/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { JSONValue } from "core/utils";
import Glean from "core/glean";
import { JSONValue } from "../utils";
import Glean from "../glean";

/**
* The Metric class describes the shared behaviour amongst concrete metrics.
Expand Down
6 changes: 3 additions & 3 deletions glean/src/core/metrics/types/boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { Metric, MetricType, CommonMetricData } from "core/metrics";
import { isBoolean } from "core/utils";
import Glean from "core/glean";
import { Metric, MetricType, CommonMetricData } from "../";
import { isBoolean } from "../../utils";
import Glean from "../../glean";

export class BooleanMetric extends Metric<boolean, boolean> {
constructor(v: unknown) {
Expand Down
6 changes: 3 additions & 3 deletions glean/src/core/metrics/types/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { Metric, MetricType, CommonMetricData } from "core/metrics";
import { isNumber, isUndefined, JSONValue } from "core/utils";
import Glean from "core/glean";
import { Metric, MetricType, CommonMetricData } from "../";
import { isNumber, isUndefined, JSONValue } from "../../utils";
import Glean from "../../glean";

export class CounterMetric extends Metric<number, number> {
constructor(v: unknown) {
Expand Down
8 changes: 4 additions & 4 deletions glean/src/core/metrics/types/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { Metric, MetricType, CommonMetricData } from "core/metrics";
import TimeUnit from "core/metrics/time_unit";
import Glean from "core/glean";
import { isNumber, isObject, isString } from "core/utils";
import { Metric, MetricType, CommonMetricData } from "../";
import TimeUnit from "../../metrics/time_unit";
import Glean from "../../glean";
import { isNumber, isObject, isString } from "../../utils";

/**
* Builds the formatted timezone offset string frim a given timezone.
Expand Down
8 changes: 4 additions & 4 deletions glean/src/core/metrics/types/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { MetricType, CommonMetricData } from "core/metrics";
import Glean from "core/glean";
import { ExtraMap, RecordedEvent } from "core/metrics/events_database";
import { isUndefined } from "core/utils";
import { MetricType, CommonMetricData } from "../";
import Glean from "../../glean";
import { ExtraMap, RecordedEvent } from "../events_database";
import { isUndefined } from "../../utils";

const MAX_LENGTH_EXTRA_KEY_VALUE = 100;

Expand Down
6 changes: 3 additions & 3 deletions glean/src/core/metrics/types/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { Metric, MetricType, CommonMetricData } from "core/metrics";
import { isString } from "core/utils";
import Glean from "core/glean";
import { Metric, MetricType, CommonMetricData } from "../";
import { isString } from "../../utils";
import Glean from "../../glean";

export const MAX_LENGTH_VALUE = 100;

Expand Down
8 changes: 4 additions & 4 deletions glean/src/core/metrics/types/uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import { validate as UUIDvalidate } from "uuid";

import { KNOWN_CLIENT_ID } from "core/constants";
import { Metric, MetricType, CommonMetricData } from "core/metrics";
import { isString, generateUUIDv4 } from "core/utils";
import Glean from "core/glean";
import { KNOWN_CLIENT_ID } from "../../constants";
import { Metric, MetricType, CommonMetricData } from "../";
import { isString, generateUUIDv4 } from "../../utils";
import Glean from "../../glean";

export class UUIDMetric extends Metric<string, string> {
constructor(v: unknown) {
Expand Down
14 changes: 7 additions & 7 deletions glean/src/core/metrics/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { Metric } from "core/metrics";
import { JSONValue } from "core/utils";
import { Metric } from "./index";
import { JSONValue } from "../utils";

import { BooleanMetric } from "core/metrics/types/boolean";
import { CounterMetric } from "core/metrics/types/counter";
import { DatetimeMetric } from "core/metrics/types/datetime";
import { StringMetric } from "core/metrics/types/string";
import { UUIDMetric } from "core/metrics/types/uuid";
import { BooleanMetric } from "./types/boolean";
import { CounterMetric } from "./types/counter";
import { DatetimeMetric } from "./types/datetime";
import { StringMetric } from "./types/string";
import { UUIDMetric } from "./types/uuid";

/**
* A map containing all supported internal metrics and its constructors.
Expand Down
8 changes: 4 additions & 4 deletions glean/src/core/pings/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Store from "core/storage";
import { Metrics as MetricsPayload } from "core/metrics/database";
import { isObject, isJSONValue, JSONObject, isString, JSONArray } from "core/utils";
import Glean from "core/glean";
import Store from "../storage";
import { Metrics as MetricsPayload } from "../metrics/database";
import { isObject, isJSONValue, JSONObject, isString, JSONArray } from "../utils";
import Glean from "../glean";

export interface PingInfo extends JSONObject {
seq: number,
Expand Down
8 changes: 4 additions & 4 deletions glean/src/core/pings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { DELETION_REQUEST_PING_NAME } from "core/constants";
import { generateUUIDv4 } from "core/utils";
import collectAndStorePing from "core/pings/maker";
import Glean from "core/glean";
import { DELETION_REQUEST_PING_NAME } from "../constants";
import { generateUUIDv4 } from "../utils";
import collectAndStorePing from "../pings/maker";
import Glean from "../glean";

/**
* The common set of data for creating a new ping.
Expand Down
16 changes: 8 additions & 8 deletions glean/src/core/pings/maker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { GLEAN_SCHEMA_VERSION, GLEAN_VERSION, PING_INFO_STORAGE, CLIENT_INFO_STORAGE } from "core/constants";
import CounterMetricType, { CounterMetric } from "core/metrics/types/counter";
import DatetimeMetricType, { DatetimeMetric } from "core/metrics/types/datetime";
import { Lifetime } from "core/metrics";
import TimeUnit from "core/metrics/time_unit";
import { ClientInfo, PingInfo, PingPayload } from "core/pings/database";
import PingType from "core/pings";
import Glean from "core/glean";
import { GLEAN_SCHEMA_VERSION, GLEAN_VERSION, PING_INFO_STORAGE, CLIENT_INFO_STORAGE } from "../constants";
import CounterMetricType, { CounterMetric } from "../metrics/types/counter";
import DatetimeMetricType, { DatetimeMetric } from "../metrics/types/datetime";
import { Lifetime } from "../metrics";
import TimeUnit from "../metrics/time_unit";
import { ClientInfo, PingInfo, PingPayload } from "../pings/database";
import PingType from "../pings";
import Glean from "../glean";

// The moment the current Glean.js session started.
const GLEAN_START_TIME = new Date();
Expand Down
2 changes: 1 addition & 1 deletion glean/src/core/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { JSONObject, JSONValue } from "core/utils";
import { JSONObject, JSONValue } from "../utils";

/**
* The storage index in the ordered list of keys to navigate on the store
Expand Down
Loading