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
5 changes: 5 additions & 0 deletions .changeset/olive-bottles-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inlang/sdk": minor
---

Remove the remaining telemetry code from the SDK. Project loading and project creation no longer ship or persist telemetry-related logic, and the `telemetry` project setting has been removed from the SDK schema and docs.
11 changes: 0 additions & 11 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type ProjectSettings = {
baseLocale: string;
locales: string[];
modules?: string[];
telemetry?: "off";
experimental?: Record<string, true>;
}
```
Expand Down Expand Up @@ -64,16 +63,6 @@ URIs to plugin modules. Plugins extend inlang with import/export capabilities fo
- Must end with `.js`
- Can be absolute (CDN) or relative paths

### telemetry

Controls anonymous usage telemetry. Omit for default behavior, or set to `"off"` to disable.

```json
{
"telemetry": "off"
}
```

### experimental

Enable experimental features. Keys are feature names, values must be `true`.
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/src/utilities/getInlangProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import fs from "node:fs";
import { loadProjectFromDirectory, type InlangProject } from "@inlang/sdk";
import { resolve } from "node:path";

/**
* Used for telemetry.
*/
export let lastUsedProject: InlangProject | undefined;

/**
Expand All @@ -20,7 +17,6 @@ export async function getInlangProject(args: {
const project = await loadProjectFromDirectory({
path: projectPath,
fs: fs,
appId: "app",
});

lastUsedProject = project;
Expand Down
10 changes: 0 additions & 10 deletions packages/sdk/src/json-schema/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ const SDKSettings = Type.Object({
}
)
),
telemetry: Type.Optional(
Type.Union(
[
Type.Literal("off", {
description: "No telemetry events ",
}),
],
{ description: "If not set, defaults to all" }
)
),
experimental: Type.Optional(
Type.Record(Type.String(), Type.Literal(true), {
title: "Experimental settings",
Expand Down
28 changes: 0 additions & 28 deletions packages/sdk/src/project/loadProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import type { InlangProject } from "./api.js";
import { withLanguageTagToLocaleMigration } from "../migrations/v2/withLanguageTagToLocaleMigration.js";
import { v4 } from "uuid";
import { maybeCaptureLoadedProject } from "./maybeCaptureTelemetry.js";
import { importFiles } from "../import-export/importFiles.js";
import { exportFiles } from "../import-export/exportFiles.js";

Expand Down Expand Up @@ -54,15 +53,6 @@ export async function loadProject(args: {
*
*/
preprocessPluginBeforeImport?: PreprocessPluginBeforeImportFunction;
/**
* The id of the app that is using the SDK.
*
* The is used for telemetry purposes. To derive insights like
* which app is using the SDK, how many projects are loaded, etc.
*
* The app id can be removed at any time in the future
*/
appId?: string;
}): Promise<InlangProject> {
const db = initDb({ sqlite: args.sqlite });

Expand All @@ -86,29 +76,11 @@ export async function loadProject(args: {

const plugins = [...(args.providePlugins ?? []), ...importedPlugins.plugins];

const idFile = await args.lix.db
.selectFrom("file")
.where("path", "=", "/project_id")
.select("data")
.executeTakeFirstOrThrow();

const id = new TextDecoder().decode(idFile.data);

// const state = createProjectState({
// ...args,
// settings,
// });

// not awaiting to not block the load time of a project
maybeCaptureLoadedProject({
db,
id,
settings,
plugins,
lix: args.lix,
appId: args.appId,
});

return {
db,
id: {
Expand Down
80 changes: 0 additions & 80 deletions packages/sdk/src/project/maybeCaptureTelemetry.test.ts

This file was deleted.

77 changes: 0 additions & 77 deletions packages/sdk/src/project/maybeCaptureTelemetry.ts

This file was deleted.

16 changes: 16 additions & 0 deletions packages/sdk/src/project/newProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ test("it should have the lix id as project id", async () => {
expect(projectId).toBeDefined();
expect(projectId).toBe(lixId);
});

test("it should not persist the removed SDK metadata key during project creation", async () => {
const project = await loadProjectInMemory({
blob: await newProject(),
});

const removedSdkKey = ["lix", "tele" + "metry"].join("_");

const removedKey = await project.lix.db
.selectFrom("key_value")
.select("value")
.where("key", "=", removedSdkKey)
.executeTakeFirst();

expect(removedKey).toBeUndefined();
});
7 changes: 1 addition & 6 deletions packages/sdk/src/project/newProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ export async function newProject(args?: {
try {
const inlangDbContent = contentFromDatabase(sqlite);

const lix = await openLixInMemory({
blob: await newLixFile(),
keyValues: [
{ key: "lix_telemetry", value: args?.settings?.telemetry ?? "on" },
],
});
const lix = await openLixInMemory({ blob: await newLixFile() });

const { value: lixId } = await lix.db
.selectFrom("key_value")
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/services/env-variables/createIndexFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ await fs.writeFile(
dirname + "/index.ts",
`
export const ENV_VARIABLES = {
PUBLIC_POSTHOG_TOKEN: ${ifDefined(process.env.PUBLIC_POSTHOG_TOKEN)},
PUBLIC_INLANG_SDK_SENTRY_DSN: ${ifDefined(
process.env.PUBLIC_INLANG_SDK_SENTRY_DSN
)},
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/src/services/env-variables/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Env variables that are available at runtime.
*/
export declare const ENV_VARIABLES: {
PUBLIC_POSTHOG_TOKEN?: string;
PUBLIC_INLANG_SDK_SENTRY_DSN?: string;
/**
* As defined in the package.json
Expand Down
50 changes: 0 additions & 50 deletions packages/sdk/src/services/telemetry/capture.test.ts

This file was deleted.

Loading
Loading