@inlang/sdk 2.1.2 → 2.2.0

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.
Files changed (146) hide show
  1. package/dist/database/initDb.js +1 -4
  2. package/dist/database/initDb.js.map +1 -1
  3. package/dist/database/initDbAndSchema.test.js +1 -4
  4. package/dist/database/initDbAndSchema.test.js.map +1 -1
  5. package/dist/database/jsonbPlugin.js +1 -4
  6. package/dist/database/jsonbPlugin.js.map +1 -1
  7. package/dist/database/jsonbPlugin.test.js +1 -4
  8. package/dist/database/jsonbPlugin.test.js.map +1 -1
  9. package/dist/database/schema.js +1 -4
  10. package/dist/database/schema.js.map +1 -1
  11. package/dist/helper.js +1 -4
  12. package/dist/helper.js.map +1 -1
  13. package/dist/human-id/human-id.js +1 -4
  14. package/dist/human-id/human-id.js.map +1 -1
  15. package/dist/human-id/words.js +1 -4
  16. package/dist/human-id/words.js.map +1 -1
  17. package/dist/human-id/words.test.js +1 -4
  18. package/dist/human-id/words.test.js.map +1 -1
  19. package/dist/import-export/exportFiles.js +1 -4
  20. package/dist/import-export/exportFiles.js.map +1 -1
  21. package/dist/import-export/importFiles.js +1 -4
  22. package/dist/import-export/importFiles.js.map +1 -1
  23. package/dist/import-export/importFiles.test.js +1 -4
  24. package/dist/import-export/importFiles.test.js.map +1 -1
  25. package/dist/import-export/roundtrip.test.js +1 -4
  26. package/dist/import-export/roundtrip.test.js.map +1 -1
  27. package/dist/import-export/upsertBundleNestedMatchByProperties.js +1 -4
  28. package/dist/import-export/upsertBundleNestedMatchByProperties.js.map +1 -1
  29. package/dist/index.js +1 -4
  30. package/dist/index.js.map +1 -1
  31. package/dist/json-schema/old-v1-message/fromMessageV1.js +1 -4
  32. package/dist/json-schema/old-v1-message/fromMessageV1.js.map +1 -1
  33. package/dist/json-schema/old-v1-message/fromMessageV1.test.js +1 -4
  34. package/dist/json-schema/old-v1-message/fromMessageV1.test.js.map +1 -1
  35. package/dist/json-schema/old-v1-message/schemaV1.js +1 -4
  36. package/dist/json-schema/old-v1-message/schemaV1.js.map +1 -1
  37. package/dist/json-schema/old-v1-message/toMessageV1.js +1 -4
  38. package/dist/json-schema/old-v1-message/toMessageV1.js.map +1 -1
  39. package/dist/json-schema/old-v1-message/toMessageV1.test.js +1 -4
  40. package/dist/json-schema/old-v1-message/toMessageV1.test.js.map +1 -1
  41. package/dist/json-schema/pattern.js +1 -4
  42. package/dist/json-schema/pattern.js.map +1 -1
  43. package/dist/json-schema/settings.js +1 -4
  44. package/dist/json-schema/settings.js.map +1 -1
  45. package/dist/json-schema/settings.test-d.js +1 -4
  46. package/dist/json-schema/settings.test-d.js.map +1 -1
  47. package/dist/json-schema/settings.test.js +1 -4
  48. package/dist/json-schema/settings.test.js.map +1 -1
  49. package/dist/lix/index.js +1 -4
  50. package/dist/lix/index.js.map +1 -1
  51. package/dist/lix-plugin/applyChanges.js +1 -4
  52. package/dist/lix-plugin/applyChanges.js.map +1 -1
  53. package/dist/lix-plugin/applyChanges.test.js +1 -4
  54. package/dist/lix-plugin/applyChanges.test.js.map +1 -1
  55. package/dist/lix-plugin/detectConflicts.js +1 -4
  56. package/dist/lix-plugin/detectConflicts.js.map +1 -1
  57. package/dist/lix-plugin/detectConflicts.test.js +1 -4
  58. package/dist/lix-plugin/detectConflicts.test.js.map +1 -1
  59. package/dist/lix-plugin/inlangLixPluginV1.js +1 -4
  60. package/dist/lix-plugin/inlangLixPluginV1.js.map +1 -1
  61. package/dist/lix-plugin/inlangLixPluginV1.test.js +1 -4
  62. package/dist/lix-plugin/inlangLixPluginV1.test.js.map +1 -1
  63. package/dist/lix-plugin/merge.test.js +1 -4
  64. package/dist/lix-plugin/merge.test.js.map +1 -1
  65. package/dist/lix-plugin/resolveConflictBySelecting.test.js +1 -4
  66. package/dist/lix-plugin/resolveConflictBySelecting.test.js.map +1 -1
  67. package/dist/migrations/v2/createMessageV1.js +1 -4
  68. package/dist/migrations/v2/createMessageV1.js.map +1 -1
  69. package/dist/migrations/v2/withLanguageTagToLocaleMigration.js +1 -4
  70. package/dist/migrations/v2/withLanguageTagToLocaleMigration.js.map +1 -1
  71. package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js +1 -4
  72. package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js.map +1 -1
  73. package/dist/plugin/cache.js +1 -4
  74. package/dist/plugin/cache.js.map +1 -1
  75. package/dist/plugin/cache.test.js +1 -4
  76. package/dist/plugin/cache.test.js.map +1 -1
  77. package/dist/plugin/errors.js +1 -4
  78. package/dist/plugin/errors.js.map +1 -1
  79. package/dist/plugin/importPlugins.js +1 -4
  80. package/dist/plugin/importPlugins.js.map +1 -1
  81. package/dist/plugin/importPlugins.test.js +1 -4
  82. package/dist/plugin/importPlugins.test.js.map +1 -1
  83. package/dist/plugin/meta/ideExtension.js +1 -4
  84. package/dist/plugin/meta/ideExtension.js.map +1 -1
  85. package/dist/plugin/schema.js +1 -4
  86. package/dist/plugin/schema.js.map +1 -1
  87. package/dist/project/api.js +1 -4
  88. package/dist/project/api.js.map +1 -1
  89. package/dist/project/loadProject.d.ts.map +1 -1
  90. package/dist/project/loadProject.js +1 -6
  91. package/dist/project/loadProject.js.map +1 -1
  92. package/dist/project/loadProject.test.js +1 -4
  93. package/dist/project/loadProject.test.js.map +1 -1
  94. package/dist/project/loadProjectFromDirectory.js +1 -4
  95. package/dist/project/loadProjectFromDirectory.js.map +1 -1
  96. package/dist/project/loadProjectFromDirectory.test.js +1 -4
  97. package/dist/project/loadProjectFromDirectory.test.js.map +1 -1
  98. package/dist/project/loadProjectInMemory.js +1 -4
  99. package/dist/project/loadProjectInMemory.js.map +1 -1
  100. package/dist/project/loadProjectInMemory.test.js +1 -4
  101. package/dist/project/loadProjectInMemory.test.js.map +1 -1
  102. package/dist/project/maybeCaptureTelemetry.d.ts.map +1 -1
  103. package/dist/project/maybeCaptureTelemetry.js +1 -6
  104. package/dist/project/maybeCaptureTelemetry.js.map +1 -1
  105. package/dist/project/maybeCaptureTelemetry.test.js +1 -4
  106. package/dist/project/maybeCaptureTelemetry.test.js.map +1 -1
  107. package/dist/project/newProject.d.ts.map +1 -1
  108. package/dist/project/newProject.js +1 -6
  109. package/dist/project/newProject.js.map +1 -1
  110. package/dist/project/newProject.test.js +1 -4
  111. package/dist/project/newProject.test.js.map +1 -1
  112. package/dist/project/saveProjectToDirectory.js +1 -4
  113. package/dist/project/saveProjectToDirectory.js.map +1 -1
  114. package/dist/project/saveProjectToDirectory.test.js +1 -4
  115. package/dist/project/saveProjectToDirectory.test.js.map +1 -1
  116. package/dist/query-utilities/index.js +1 -4
  117. package/dist/query-utilities/index.js.map +1 -1
  118. package/dist/query-utilities/insertBundleNested.js +1 -4
  119. package/dist/query-utilities/insertBundleNested.js.map +1 -1
  120. package/dist/query-utilities/selectBundleNested.js +1 -4
  121. package/dist/query-utilities/selectBundleNested.js.map +1 -1
  122. package/dist/query-utilities/updateBundleNested.js +1 -4
  123. package/dist/query-utilities/updateBundleNested.js.map +1 -1
  124. package/dist/query-utilities/upsertBundleNested.js +1 -4
  125. package/dist/query-utilities/upsertBundleNested.js.map +1 -1
  126. package/dist/services/env-variables/index.js +2 -5
  127. package/dist/services/env-variables/index.js.map +1 -1
  128. package/dist/services/telemetry/capture.d.ts.map +1 -1
  129. package/dist/services/telemetry/capture.js +5 -9
  130. package/dist/services/telemetry/capture.js.map +1 -1
  131. package/dist/services/telemetry/capture.test.js +1 -4
  132. package/dist/services/telemetry/capture.test.js.map +1 -1
  133. package/dist/utilities/detectJsonFormatting.js +1 -4
  134. package/dist/utilities/detectJsonFormatting.js.map +1 -1
  135. package/dist/utilities/detectJsonFormatting.test.js +1 -4
  136. package/dist/utilities/detectJsonFormatting.test.js.map +1 -1
  137. package/package.json +5 -9
  138. package/src/project/loadProject.ts +0 -3
  139. package/src/project/maybeCaptureTelemetry.ts +0 -2
  140. package/src/project/newProject.ts +0 -2
  141. package/src/services/telemetry/capture.ts +4 -5
  142. package/dist/services/error-reporting/index.d.ts +0 -15
  143. package/dist/services/error-reporting/index.d.ts.map +0 -1
  144. package/dist/services/error-reporting/index.js +0 -30
  145. package/dist/services/error-reporting/index.js.map +0 -1
  146. package/src/services/error-reporting/index.ts +0 -28
@@ -1 +1 @@
1
- {"version":3,"file":"capture.js","sources":["services/telemetry/capture.ts"],"sourceRoot":"/","sourcesContent":["// import { ENV_VARIABLES } from \"../env-variables/index.js\";\n\nimport type { ProjectSettings } from \"../../json-schema/settings.js\";\nimport { ENV_VARIABLES } from \"../env-variables/index.js\";\nimport { captureError } from \"../error-reporting/index.js\";\n\n/**\n * List of telemetry events for typesafety.\n *\n * - prefix with `SDK` to avoid collisions with other apps\n * - use past tense to indicate that the event is completed\n */\ntype TelemetryEvent = \"SDK loaded project\";\n\n/**\n * Capture an event.\n *\n * - manually calling the PostHog API because the SDKs were not platform angostic (and generally bloated)\n */\nexport const capture = async (\n\tevent: TelemetryEvent,\n\targs: {\n\t\tprojectId: string;\n\t\taccountId: string;\n\t\t/**\n\t\t * Please use snake_case for property names.\n\t\t */\n\t\tproperties: Record<string, any>;\n\t\tsettings: Pick<ProjectSettings, \"telemetry\">;\n\t}\n) => {\n\tif (args.settings.telemetry === \"off\") {\n\t\treturn;\n\t} else if (ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN === undefined) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait fetch(\"https://eu.posthog.com/capture/\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tapi_key: ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN,\n\t\t\t\tevent,\n\t\t\t\tdistinct_id: args.accountId,\n\t\t\t\tproperties: {\n\t\t\t\t\t$groups: { project: args.projectId },\n\t\t\t\t\t...args.properties,\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t\tawait identifyProject({\n\t\t\tprojectId: args.projectId,\n\t\t\taccountId: args.accountId,\n\t\t\t// using the id for now as a name but can be changed in the future\n\t\t\t// we need at least one property to make a project visible in the dashboar\n\t\t\tproperties: { name: args.projectId },\n\t\t});\n\t} catch (e) {\n\t\tcaptureError(e);\n\t}\n};\n\n/**\n * Identifying a project is needed.\n *\n * Otherwise, the project will not be visible in the PostHog dashboard.\n */\nconst identifyProject = async (args: {\n\tprojectId: string;\n\taccountId: string;\n\t/**\n\t * Please use snake_case for property names.\n\t */\n\tproperties: Record<string, any>;\n}) => {\n\t// do not send events if the token is not set\n\t// (assuming this eases testing)\n\tif (ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN === undefined) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait fetch(\"https://eu.posthog.com/capture/\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tapi_key: ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN,\n\t\t\t\tevent: \"$groupidentify\",\n\t\t\t\tdistinct_id: args.accountId,\n\t\t\t\tproperties: {\n\t\t\t\t\t$group_type: \"project\",\n\t\t\t\t\t$group_key: args.projectId,\n\t\t\t\t\t$group_set: {\n\t\t\t\t\t\t...args.properties,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t} catch (e) {\n\t\tcaptureError(e);\n\t}\n};\n"],"names":[],"mappings":"AAAA,6DAA6D;;;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAU3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC3B,KAAqB,EACrB,IAQC,EACA,EAAE;IACH,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;QACvC,OAAO;IACR,CAAC;SAAM,IAAI,aAAa,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QAC7D,OAAO;IACR,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,KAAK,CAAC,iCAAiC,EAAE;YAC9C,MAAM,EAAE,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C,CAAC,CAAC,CAAC;IACjB,CAAC;AACF,CAAC,CAAC","debug_id":"4a83d392-5cb6-5c43-9098-5708dd6509bb"}
1
+ {"version":3,"file":"capture.js","sourceRoot":"/","sources":["services/telemetry/capture.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC3B,KAAqB,EACrB,IAQC,EACA,EAAE;IACH,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;QACvC,OAAO;IACR,CAAC;SAAM,IAAI,aAAa,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QAC7D,OAAO;IACR,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,KAAK,CAAC,iCAAiC,EAAE;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,OAAO,EAAE,aAAa,CAAC,oBAAoB;gBAC3C,KAAK;gBACL,WAAW,EAAE,IAAI,CAAC,SAAS;gBAC3B,UAAU,EAAE;oBACX,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE;oBACpC,GAAG,IAAI,CAAC,UAAU;iBAClB;aACD,CAAC;SACF,CAAC,CAAC;QACH,MAAM,eAAe,CAAC;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,kEAAkE;YAClE,0EAA0E;YAC1E,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;SACpC,CAAC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACR,aAAa;IACd,CAAC;AACF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,eAAe,GAAG,KAAK,EAAE,IAO9B,EAAE,EAAE;IACJ,6CAA6C;IAC7C,gCAAgC;IAChC,IAAI,aAAa,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO;IACR,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,KAAK,CAAC,iCAAiC,EAAE;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,OAAO,EAAE,aAAa,CAAC,oBAAoB;gBAC3C,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EAAE,IAAI,CAAC,SAAS;gBAC3B,UAAU,EAAE;oBACX,WAAW,EAAE,SAAS;oBACtB,UAAU,EAAE,IAAI,CAAC,SAAS;oBAC1B,UAAU,EAAE;wBACX,GAAG,IAAI,CAAC,UAAU;qBAClB;iBACD;aACD,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACR,aAAa;IACd,CAAC;AACF,CAAC,CAAC","sourcesContent":["// import { ENV_VARIABLES } from \"../env-variables/index.js\";\n\nimport type { ProjectSettings } from \"../../json-schema/settings.js\";\nimport { ENV_VARIABLES } from \"../env-variables/index.js\";\n\n/**\n * List of telemetry events for typesafety.\n *\n * - prefix with `SDK` to avoid collisions with other apps\n * - use past tense to indicate that the event is completed\n */\ntype TelemetryEvent = \"SDK loaded project\";\n\n/**\n * Capture an event.\n *\n * - manually calling the PostHog API because the SDKs were not platform angostic (and generally bloated)\n */\nexport const capture = async (\n\tevent: TelemetryEvent,\n\targs: {\n\t\tprojectId: string;\n\t\taccountId: string;\n\t\t/**\n\t\t * Please use snake_case for property names.\n\t\t */\n\t\tproperties: Record<string, any>;\n\t\tsettings: Pick<ProjectSettings, \"telemetry\">;\n\t}\n) => {\n\tif (args.settings.telemetry === \"off\") {\n\t\treturn;\n\t} else if (ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN === undefined) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait fetch(\"https://eu.posthog.com/capture/\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tapi_key: ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN,\n\t\t\t\tevent,\n\t\t\t\tdistinct_id: args.accountId,\n\t\t\t\tproperties: {\n\t\t\t\t\t$groups: { project: args.projectId },\n\t\t\t\t\t...args.properties,\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t\tawait identifyProject({\n\t\t\tprojectId: args.projectId,\n\t\t\taccountId: args.accountId,\n\t\t\t// using the id for now as a name but can be changed in the future\n\t\t\t// we need at least one property to make a project visible in the dashboar\n\t\t\tproperties: { name: args.projectId },\n\t\t});\n\t} catch {\n\t\t// do nothing\n\t}\n};\n\n/**\n * Identifying a project is needed.\n *\n * Otherwise, the project will not be visible in the PostHog dashboard.\n */\nconst identifyProject = async (args: {\n\tprojectId: string;\n\taccountId: string;\n\t/**\n\t * Please use snake_case for property names.\n\t */\n\tproperties: Record<string, any>;\n}) => {\n\t// do not send events if the token is not set\n\t// (assuming this eases testing)\n\tif (ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN === undefined) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait fetch(\"https://eu.posthog.com/capture/\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tapi_key: ENV_VARIABLES.PUBLIC_POSTHOG_TOKEN,\n\t\t\t\tevent: \"$groupidentify\",\n\t\t\t\tdistinct_id: args.accountId,\n\t\t\t\tproperties: {\n\t\t\t\t\t$group_type: \"project\",\n\t\t\t\t\t$group_key: args.projectId,\n\t\t\t\t\t$group_set: {\n\t\t\t\t\t\t...args.properties,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t});\n\t} catch {\n\t\t// do nothing\n\t}\n};\n"]}
@@ -1,5 +1,3 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="31b14236-b29d-51f6-a0ad-e9b7dd806439")}catch(e){}}();
3
1
  import { expect, test, vi } from "vitest";
4
2
  import { capture } from "./capture.js";
5
3
  test("it should not capture if telemetry is off", async () => {
@@ -42,5 +40,4 @@ test("it should not capture if telemetry is NOT off", async () => {
42
40
  });
43
41
  expect(global.fetch).toHaveBeenCalled();
44
42
  });
45
- //# sourceMappingURL=capture.test.js.map
46
- //# debugId=31b14236-b29d-51f6-a0ad-e9b7dd806439
43
+ //# sourceMappingURL=capture.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capture.test.js","sources":["services/telemetry/capture.test.ts"],"sourceRoot":"/","sourcesContent":["import { expect, test, vi } from \"vitest\";\nimport { capture } from \"./capture.js\";\n\ntest(\"it should not capture if telemetry is off\", async () => {\n\t// @ts-expect-error - global.fetch is not defined\n\tglobal.fetch = vi.fn(() => Promise.resolve());\n\n\tvi.mock(\"../env-variables/index.js\", async () => {\n\t\treturn {\n\t\t\tENV_VARIABLES: {\n\t\t\t\tPUBLIC_POSTHOG_TOKEN: \"mock-defined\",\n\t\t\t},\n\t\t};\n\t});\n\n\tawait capture(\"SDK loaded project\", {\n\t\tprojectId: \"test\",\n\t\taccountId: \"test\",\n\t\tsettings: {\n\t\t\ttelemetry: \"off\",\n\t\t},\n\t\tproperties: {},\n\t});\n\n\texpect(global.fetch).not.toHaveBeenCalled();\n});\n\ntest(\"it should not capture if telemetry is NOT off\", async () => {\n\t// @ts-expect-error - global.fetch is not defined\n\tglobal.fetch = vi.fn(() => Promise.resolve());\n\n\tvi.mock(\"../env-variables/index.js\", async () => {\n\t\treturn {\n\t\t\tENV_VARIABLES: {\n\t\t\t\tPUBLIC_POSTHOG_TOKEN: \"mock-defined\",\n\t\t\t},\n\t\t};\n\t});\n\n\tawait capture(\"SDK loaded project\", {\n\t\tprojectId: \"test\",\n\t\taccountId: \"test\",\n\t\tsettings: {\n\t\t\ttelemetry: undefined,\n\t\t},\n\t\tproperties: {},\n\t});\n\n\texpect(global.fetch).toHaveBeenCalled();\n});\n"],"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AAa,EAAE;gBACd,oBAAoB,EAAE,cAAc;aACpC;SACD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,oBAAoB,EAAE;QACnC,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE;YACT,SAAS,EAAE,SAAS;SACpB;QACD,UAAU,EAAE,EAAE;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACzC,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test, vi } from \"vitest\";\nimport { capture } from \"./capture.js\";\n\ntest(\"it should not capture if telemetry is off\", async () => {\n\t// @ts-expect-error - global.fetch is not defined\n\tglobal.fetch = vi.fn(() => Promise.resolve());\n\n\tvi.mock(\"../env-variables/index.js\", async () => {\n\t\treturn {\n\t\t\tENV_VARIABLES: {\n\t\t\t\tPUBLIC_POSTHOG_TOKEN: \"mock-defined\",\n\t\t\t},\n\t\t};\n\t});\n\n\tawait capture(\"SDK loaded project\", {\n\t\tprojectId: \"test\",\n\t\taccountId: \"test\",\n\t\tsettings: {\n\t\t\ttelemetry: \"off\",\n\t\t},\n\t\tproperties: {},\n\t});\n\n\texpect(global.fetch).not.toHaveBeenCalled();\n});\n\ntest(\"it should not capture if telemetry is NOT off\", async () => {\n\t// @ts-expect-error - global.fetch is not defined\n\tglobal.fetch = vi.fn(() => Promise.resolve());\n\n\tvi.mock(\"../env-variables/index.js\", async () => {\n\t\treturn {\n\t\t\tENV_VARIABLES: {\n\t\t\t\tPUBLIC_POSTHOG_TOKEN: \"mock-defined\",\n\t\t\t},\n\t\t};\n\t});\n\n\tawait capture(\"SDK loaded project\", {\n\t\tprojectId: \"test\",\n\t\taccountId: \"test\",\n\t\tsettings: {\n\t\t\ttelemetry: undefined,\n\t\t},\n\t\tproperties: {},\n\t});\n\n\texpect(global.fetch).toHaveBeenCalled();\n});\n"]}
@@ -7,8 +7,6 @@
7
7
  * const stringify = detectJsonFormatting(file)
8
8
  * const newFile = stringify(json)
9
9
  */
10
-
11
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="73442250-e5ab-565c-bf3d-a05914aa2cce")}catch(e){}}();
12
10
  export const detectJsonFormatting = (file) => {
13
11
  const endsWithNewLine = file.endsWith("\n");
14
12
  const spacing = guessJsonIndent(file);
@@ -79,5 +77,4 @@ const normalizeIndent = (indent) => {
79
77
  }
80
78
  return indent[0] === " " ? indent.length : indent;
81
79
  };
82
- //# sourceMappingURL=detectJsonFormatting.js.map
83
- //# debugId=73442250-e5ab-565c-bf3d-a05914aa2cce
80
+ //# sourceMappingURL=detectJsonFormatting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detectJsonFormatting.js","sources":["utilities/detectJsonFormatting.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Detects the formatting of a JSON file and returns a function\n * that can be used to stringify JSON with the same formatting.\n *\n * @example\n * const file = await fs.readFile(\"./messages.json\", { encoding: \"utf-8\" })\n * const stringify = detectJsonFormatting(file)\n * const newFile = stringify(json)\n */\nexport const detectJsonFormatting = (\n\tfile: string\n): ((\n\tvalue: Parameters<typeof JSON.stringify>[0],\n\treplacer?: Parameters<typeof JSON.stringify>[1]\n\t// space is provided by the function\n) => string) => {\n\tconst endsWithNewLine = file.endsWith(\"\\n\");\n\tconst spacing = guessJsonIndent(file);\n\n\treturn (value, replacer) =>\n\t\tJSON.stringify(value, replacer, spacing as any) +\n\t\t(endsWithNewLine ? \"\\n\" : \"\");\n};\n\n/**\n * vendored from https://github.com/ehmicky/guess-json-indent\n */\n// Guess the indentation of a JSON string\nconst guessJsonIndent = (jsonString: string) => {\n\tconst firstIndex = skipWhitespaces(jsonString, 0);\n\n\tif (\n\t\tfirstIndex === undefined ||\n\t\t!isJsonObjectOrArray(jsonString[firstIndex])\n\t) {\n\t\treturn;\n\t}\n\n\tconst secondIndex = skipWhitespaces(jsonString, firstIndex + 1);\n\n\tif (secondIndex === undefined) {\n\t\treturn;\n\t}\n\n\treturn getIndent(jsonString, firstIndex, secondIndex);\n};\n\n// Whitespaces are ignored before|between|after tokens in JSON.\n// Uses imperative logic for performance.\nconst skipWhitespaces = (jsonString: string | any[], startIndex: number) => {\n\tfor (let index = startIndex; index < jsonString.length; index += 1) {\n\t\tconst character = jsonString[index];\n\n\t\tif (!isJsonWhitespace(character)) {\n\t\t\treturn index;\n\t\t}\n\t}\n\treturn;\n};\n\n// JSON defines only those are valid whitespaces\nconst isJsonWhitespace = (character: string) =>\n\tcharacter === \" \" ||\n\tcharacter === \"\\t\" ||\n\tcharacter === \"\\n\" ||\n\tcharacter === \"\\r\";\n\n// If the top-level value is another type than an object or an array, there is\n// no possible indentation\nconst isJsonObjectOrArray = (character: string | undefined) =>\n\tcharacter === \"{\" || character === \"[\";\n\n// Uses imperative logic for performance\n// @ts-expect-error - not all code paths return a value\nconst getIndent = (\n\tjsonString: string | any[],\n\tfirstIndex: number,\n\tsecondIndex: number\n) => {\n\tlet indent;\n\n\tfor (let index = secondIndex - 1; index > firstIndex; index -= 1) {\n\t\tconst character = jsonString[index];\n\n\t\tif (character === \"\\r\") {\n\t\t\treturn;\n\t\t}\n\n\t\tif (character === \"\\n\") {\n\t\t\treturn normalizeIndent(indent);\n\t\t}\n\n\t\tif (indent === undefined) {\n\t\t\tindent = character;\n\t\t} else if (indent[0] === character) {\n\t\t\tindent += character;\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n};\n\nconst normalizeIndent = (indent: string | any[] | undefined) => {\n\tif (indent === undefined) {\n\t\treturn 0;\n\t}\n\n\treturn indent[0] === \" \" ? indent.length : indent;\n};\n"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CACnC,IAAY,EAKA,EAAE;IACd,MAAM,eAAe,GAAG,IA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,EAAE,EAAE;IAC9D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,CAAC;IACV,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC,CAAC","sourcesContent":["/**\n * Detects the formatting of a JSON file and returns a function\n * that can be used to stringify JSON with the same formatting.\n *\n * @example\n * const file = await fs.readFile(\"./messages.json\", { encoding: \"utf-8\" })\n * const stringify = detectJsonFormatting(file)\n * const newFile = stringify(json)\n */\nexport const detectJsonFormatting = (\n\tfile: string\n): ((\n\tvalue: Parameters<typeof JSON.stringify>[0],\n\treplacer?: Parameters<typeof JSON.stringify>[1]\n\t// space is provided by the function\n) => string) => {\n\tconst endsWithNewLine = file.endsWith(\"\\n\");\n\tconst spacing = guessJsonIndent(file);\n\n\treturn (value, replacer) =>\n\t\tJSON.stringify(value, replacer, spacing as any) +\n\t\t(endsWithNewLine ? \"\\n\" : \"\");\n};\n\n/**\n * vendored from https://github.com/ehmicky/guess-json-indent\n */\n// Guess the indentation of a JSON string\nconst guessJsonIndent = (jsonString: string) => {\n\tconst firstIndex = skipWhitespaces(jsonString, 0);\n\n\tif (\n\t\tfirstIndex === undefined ||\n\t\t!isJsonObjectOrArray(jsonString[firstIndex])\n\t) {\n\t\treturn;\n\t}\n\n\tconst secondIndex = skipWhitespaces(jsonString, firstIndex + 1);\n\n\tif (secondIndex === undefined) {\n\t\treturn;\n\t}\n\n\treturn getIndent(jsonString, firstIndex, secondIndex);\n};\n\n// Whitespaces are ignored before|between|after tokens in JSON.\n// Uses imperative logic for performance.\nconst skipWhitespaces = (jsonString: string | any[], startIndex: number) => {\n\tfor (let index = startIndex; index < jsonString.length; index += 1) {\n\t\tconst character = jsonString[index];\n\n\t\tif (!isJsonWhitespace(character)) {\n\t\t\treturn index;\n\t\t}\n\t}\n\treturn;\n};\n\n// JSON defines only those are valid whitespaces\nconst isJsonWhitespace = (character: string) =>\n\tcharacter === \" \" ||\n\tcharacter === \"\\t\" ||\n\tcharacter === \"\\n\" ||\n\tcharacter === \"\\r\";\n\n// If the top-level value is another type than an object or an array, there is\n// no possible indentation\nconst isJsonObjectOrArray = (character: string | undefined) =>\n\tcharacter === \"{\" || character === \"[\";\n\n// Uses imperative logic for performance\n// @ts-expect-error - not all code paths return a value\nconst getIndent = (\n\tjsonString: string | any[],\n\tfirstIndex: number,\n\tsecondIndex: number\n) => {\n\tlet indent;\n\n\tfor (let index = secondIndex - 1; index > firstIndex; index -= 1) {\n\t\tconst character = jsonString[index];\n\n\t\tif (character === \"\\r\") {\n\t\t\treturn;\n\t\t}\n\n\t\tif (character === \"\\n\") {\n\t\t\treturn normalizeIndent(indent);\n\t\t}\n\n\t\tif (indent === undefined) {\n\t\t\tindent = character;\n\t\t} else if (indent[0] === character) {\n\t\t\tindent += character;\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}\n};\n\nconst normalizeIndent = (indent: string | any[] | undefined) => {\n\tif (indent === undefined) {\n\t\treturn 0;\n\t}\n\n\treturn indent[0] === \" \" ? indent.length : indent;\n};\n"]}
@@ -1,5 +1,3 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="eed11d62-4499-5c30-9d3e-f2787865c751")}catch(e){}}();
3
1
  import { expect, it } from "vitest";
4
2
  import { detectJsonFormatting } from "./detectJsonFormatting.js";
5
3
  it("should detect spacing", () => {
@@ -29,5 +27,4 @@ it("should detect new lines correctly", () => {
29
27
  expect(serialize2(JSON.parse(withoutNewLine))).toBe(withoutNewLine);
30
28
  expect(serialize3(JSON.parse(withNewLineAndSpacing))).toBe(withNewLineAndSpacing);
31
29
  });
32
- //# sourceMappingURL=detectJsonFormatting.test.js.map
33
- //# debugId=eed11d62-4499-5c30-9d3e-f2787865c751
30
+ //# sourceMappingURL=detectJsonFormatting.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detectJsonFormatting.test.js","sources":["utilities/detectJsonFormatting.test.ts"],"sourceRoot":"/","sourcesContent":["import { expect, it } from \"vitest\";\nimport { detectJsonFormatting } from \"./detectJsonFormatting.js\";\n\nit(\"should detect spacing\", () => {\n\t// test all possible spacings\n\tfor (const value of [1, 2, 3, 4, 6, 8, \"\\t\"]) {\n\t\tconst spacing = value === \"\\t\" ? \"\\t\" : \" \".repeat(value as number);\n\t\tconst objectWithSpacing = `{\\n${spacing}\"test\": \"test\"\\n}`;\n\n\t\tconst serialize = detectJsonFormatting(objectWithSpacing);\n\t\texpect(serialize(JSON.parse(objectWithSpacing))).toBe(objectWithSpacing);\n\t}\n});\n\nit(\"should detect spacing if the json is an array\", () => {\n\t// testing with one element only because dynamic generation of\n\t// arrays with different spacings is too complex\n\tconst objectWithSpacing = `[\\n\\t\"test\",\\n\\t\"test\"\\n]`;\n\n\tconst serialize = detectJsonFormatting(objectWithSpacing);\n\texpect(serialize(JSON.parse(objectWithSpacing))).toBe(objectWithSpacing);\n});\n\nit(\"should detect new lines correctly\", () => {\n\tconst withNewLine = `{\"test\":\"test\"}\\n`;\n\tconst withoutNewLine = `{\"test\":\"test\"}`;\n\tconst withNewLineAndSpacing = `{\\n\\t\"test\": \"test\"\\n}`;\n\n\tconst serialize1 = detectJsonFormatting(withNewLine);\n\tconst serialize2 = detectJsonFormatting(withoutNewLine);\n\tconst serialize3 = detectJsonFormatting(withNewLineAndSpacing);\n\n\texpect(serialize1(JSON.parse(withNewLine))).toBe(withNewLine);\n\texpect(serialize2(JSON.parse(withoutNewLine))).toBe(withoutNewLine);\n\texpect(serialize3(JSON.parse(withNewLineAndSpacing))).toBe(\n\t\twithNewLineAndSpacing\n\t);\n});\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC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C;IAC1E,CAAC;AACF,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACxD,8DAA8D;IAC9D,gDAAgD;IAChD,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;IAEtD,MAAM,SAAS,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAC5C,MAAM,WAAW,GAAG,mBAAmB,CAAC;IACxC,MAAM,cAAc,GAAG,iBAAiB,CAAC;IACzC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;IAEvD,MAAM,UAAU,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;IAE/D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,IAAI,CACzD,qBAAqB,CACrB,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { expect, it } from \"vitest\";\nimport { detectJsonFormatting } from \"./detectJsonFormatting.js\";\n\nit(\"should detect spacing\", () => {\n\t// test all possible spacings\n\tfor (const value of [1, 2, 3, 4, 6, 8, \"\\t\"]) {\n\t\tconst spacing = value === \"\\t\" ? \"\\t\" : \" \".repeat(value as number);\n\t\tconst objectWithSpacing = `{\\n${spacing}\"test\": \"test\"\\n}`;\n\n\t\tconst serialize = detectJsonFormatting(objectWithSpacing);\n\t\texpect(serialize(JSON.parse(objectWithSpacing))).toBe(objectWithSpacing);\n\t}\n});\n\nit(\"should detect spacing if the json is an array\", () => {\n\t// testing with one element only because dynamic generation of\n\t// arrays with different spacings is too complex\n\tconst objectWithSpacing = `[\\n\\t\"test\",\\n\\t\"test\"\\n]`;\n\n\tconst serialize = detectJsonFormatting(objectWithSpacing);\n\texpect(serialize(JSON.parse(objectWithSpacing))).toBe(objectWithSpacing);\n});\n\nit(\"should detect new lines correctly\", () => {\n\tconst withNewLine = `{\"test\":\"test\"}\\n`;\n\tconst withoutNewLine = `{\"test\":\"test\"}`;\n\tconst withNewLineAndSpacing = `{\\n\\t\"test\": \"test\"\\n}`;\n\n\tconst serialize1 = detectJsonFormatting(withNewLine);\n\tconst serialize2 = detectJsonFormatting(withoutNewLine);\n\tconst serialize3 = detectJsonFormatting(withNewLineAndSpacing);\n\n\texpect(serialize1(JSON.parse(withNewLine))).toBe(withNewLine);\n\texpect(serialize2(JSON.parse(withoutNewLine))).toBe(withoutNewLine);\n\texpect(serialize3(JSON.parse(withNewLineAndSpacing))).toBe(\n\t\twithNewLineAndSpacing\n\t);\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inlang/sdk",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -26,16 +26,14 @@
26
26
  "node": ">=18.0.0"
27
27
  },
28
28
  "dependencies": {
29
- "@sentry/browser": "^7.118.0",
30
29
  "@sinclair/typebox": "^0.31.17",
31
30
  "kysely": "^0.27.4",
32
31
  "uuid": "^10.0.0",
33
- "sqlite-wasm-kysely": "0.3.0",
34
- "@lix-js/sdk": "0.3.5"
32
+ "@lix-js/sdk": "0.4.0",
33
+ "sqlite-wasm-kysely": "0.3.0"
35
34
  },
36
35
  "devDependencies": {
37
36
  "@eslint/js": "^9.12.0",
38
- "@sentry/cli": "^2.35.0",
39
37
  "@types/node": "^22.5.1",
40
38
  "@types/uuid": "^10.0.0",
41
39
  "@vitest/coverage-v8": "^2.0.5",
@@ -44,10 +42,9 @@
44
42
  "memfs": "4.6.0",
45
43
  "typescript": "^5.5.2",
46
44
  "vitest": "^2.0.5",
47
- "@opral/tsconfig": "1.0.0"
45
+ "@opral/tsconfig": "1.1.0"
48
46
  },
49
47
  "scripts": {
50
- "prepublish": "npm run sentry:sourcemaps",
51
48
  "build": "npm run env-variables && tsc --build",
52
49
  "dev": "npm run env-variables && tsc --watch",
53
50
  "env-variables": "node ./src/services/env-variables/createIndexFile.js",
@@ -55,7 +52,6 @@
55
52
  "test:watch": "vitest",
56
53
  "lint": "eslint ./src",
57
54
  "format": "prettier ./src --write",
58
- "clean": "rm -rf ./dist ./node_modules",
59
- "sentry:sourcemaps": "sentry-cli sourcemaps inject --org opral --project inlang-sdk ./dist && sentry-cli sourcemaps upload --org opral --project inlang-sdk ./dist"
55
+ "clean": "rm -rf ./dist ./node_modules"
60
56
  }
61
57
  }
@@ -13,7 +13,6 @@ import {
13
13
  import type { InlangProject } from "./api.js";
14
14
  import { withLanguageTagToLocaleMigration } from "../migrations/v2/withLanguageTagToLocaleMigration.js";
15
15
  import { v4 } from "uuid";
16
- import { initErrorReporting } from "../services/error-reporting/index.js";
17
16
  import { maybeCaptureLoadedProject } from "./maybeCaptureTelemetry.js";
18
17
  import { importFiles } from "../import-export/importFiles.js";
19
18
  import { exportFiles } from "../import-export/exportFiles.js";
@@ -110,8 +109,6 @@ export async function loadProject(args: {
110
109
  appId: args.appId,
111
110
  });
112
111
 
113
- initErrorReporting({ projectId: id });
114
-
115
112
  return {
116
113
  db,
117
114
  id: {
@@ -3,7 +3,6 @@ import { capture } from "../services/telemetry/capture.js";
3
3
  import type { InlangDatabaseSchema } from "../database/schema.js";
4
4
  import { ENV_VARIABLES } from "../services/env-variables/index.js";
5
5
  import type { ProjectSettings } from "../json-schema/settings.js";
6
- import { captureError } from "../services/error-reporting/index.js";
7
6
  import type { Lix } from "@lix-js/sdk";
8
7
 
9
8
  export async function maybeCaptureLoadedProject(args: {
@@ -64,6 +63,5 @@ export async function maybeCaptureLoadedProject(args: {
64
63
  // The project has been closed, nothing to capture
65
64
  return;
66
65
  }
67
- captureError(e);
68
66
  }
69
67
  }
@@ -6,7 +6,6 @@ import {
6
6
  createInMemoryDatabase,
7
7
  } from "sqlite-wasm-kysely";
8
8
  import { initDb } from "../database/initDb.js";
9
- import { captureError } from "../services/error-reporting/index.js";
10
9
 
11
10
  /**
12
11
  * Creates a new inlang project.
@@ -58,7 +57,6 @@ export async function newProject(args?: {
58
57
  const error = new Error(`Failed to create new inlang project: ${e}`, {
59
58
  cause: e,
60
59
  });
61
- captureError(error);
62
60
  throw error;
63
61
  } finally {
64
62
  sqlite.close();
@@ -2,7 +2,6 @@
2
2
 
3
3
  import type { ProjectSettings } from "../../json-schema/settings.js";
4
4
  import { ENV_VARIABLES } from "../env-variables/index.js";
5
- import { captureError } from "../error-reporting/index.js";
6
5
 
7
6
  /**
8
7
  * List of telemetry events for typesafety.
@@ -54,8 +53,8 @@ export const capture = async (
54
53
  // we need at least one property to make a project visible in the dashboar
55
54
  properties: { name: args.projectId },
56
55
  });
57
- } catch (e) {
58
- captureError(e);
56
+ } catch {
57
+ // do nothing
59
58
  }
60
59
  };
61
60
 
@@ -93,7 +92,7 @@ const identifyProject = async (args: {
93
92
  },
94
93
  }),
95
94
  });
96
- } catch (e) {
97
- captureError(e);
95
+ } catch {
96
+ // do nothing
98
97
  }
99
98
  };
@@ -1,15 +0,0 @@
1
- export declare function initErrorReporting(args: {
2
- projectId: string;
3
- }): void;
4
- /**
5
- * Capture an error.
6
- *
7
- * @example
8
- * try {
9
- * throw new Error("Something went wrong");
10
- * } catch (error) {
11
- * captureError(error);
12
- * }
13
- */
14
- export declare function captureError(error: Error | any): string;
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/error-reporting/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,QAU7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,UAE9C"}
@@ -1,30 +0,0 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6bcf1424-1b5e-5ac6-bdaf-bac4dd7a888b")}catch(e){}}();
3
- import { init, setUser, captureException } from "@sentry/browser";
4
- import { ENV_VARIABLES } from "../env-variables/index.js";
5
- export function initErrorReporting(args) {
6
- if (ENV_VARIABLES.PUBLIC_INLANG_SDK_SENTRY_DSN) {
7
- // in order to receive alerts like "if more than 100 "users" are effected, notify the team"
8
- // the user id is set to the project id
9
- setUser({ id: args.projectId });
10
- init({
11
- dsn: ENV_VARIABLES.PUBLIC_INLANG_SDK_SENTRY_DSN,
12
- release: ENV_VARIABLES.SDK_VERSION,
13
- });
14
- }
15
- }
16
- /**
17
- * Capture an error.
18
- *
19
- * @example
20
- * try {
21
- * throw new Error("Something went wrong");
22
- * } catch (error) {
23
- * captureError(error);
24
- * }
25
- */
26
- export function captureError(error) {
27
- return captureException(error);
28
- }
29
- //# sourceMappingURL=index.js.map
30
- //# debugId=6bcf1424-1b5e-5ac6-bdaf-bac4dd7a888b
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["services/error-reporting/index.ts"],"sourceRoot":"/","sourcesContent":["import { init, setUser, captureException } from \"@sentry/browser\";\nimport { ENV_VARIABLES } from \"../env-variables/index.js\";\n\nexport function initErrorReporting(args: { projectId: string }) {\n\tif (ENV_VARIABLES.PUBLIC_INLANG_SDK_SENTRY_DSN) {\n\t\t// in order to receive alerts like \"if more than 100 \"users\" are effected, notify the team\"\n\t\t// the user id is set to the project id\n\t\tsetUser({ id: args.projectId });\n\t\tinit({\n\t\t\tdsn: ENV_VARIABLES.PUBLIC_INLANG_SDK_SENTRY_DSN,\n\t\t\trelease: ENV_VARIABLES.SDK_VERSION,\n\t\t});\n\t}\n}\n\n/**\n * Capture an error.\n *\n * @example\n * try {\n * throw new Error(\"Something went wrong\");\n * } catch (error) {\n * captureError(error);\n * }\n */\nexport function captureError(error: Error | any) {\n\treturn captureException(error);\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,UAAU,kBAAkB,CAAC,IAA2B;IAC7D,IAAI,aAAa,CAAC,4BAA4B,EAAE,CAAC;QAChD,2FAA2F;QAC3F,uCAAuC;QACvC,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC;YACJ,GAAG,EAAE,aAAa,CAAC,4BAA4B;YAC/C,OAAO,EAAE,aAAa,CAAC,WAAW;SAClC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC9C,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC","debug_id":"6bcf1424-1b5e-5ac6-bdaf-bac4dd7a888b"}
@@ -1,28 +0,0 @@
1
- import { init, setUser, captureException } from "@sentry/browser";
2
- import { ENV_VARIABLES } from "../env-variables/index.js";
3
-
4
- export function initErrorReporting(args: { projectId: string }) {
5
- if (ENV_VARIABLES.PUBLIC_INLANG_SDK_SENTRY_DSN) {
6
- // in order to receive alerts like "if more than 100 "users" are effected, notify the team"
7
- // the user id is set to the project id
8
- setUser({ id: args.projectId });
9
- init({
10
- dsn: ENV_VARIABLES.PUBLIC_INLANG_SDK_SENTRY_DSN,
11
- release: ENV_VARIABLES.SDK_VERSION,
12
- });
13
- }
14
- }
15
-
16
- /**
17
- * Capture an error.
18
- *
19
- * @example
20
- * try {
21
- * throw new Error("Something went wrong");
22
- * } catch (error) {
23
- * captureError(error);
24
- * }
25
- */
26
- export function captureError(error: Error | any) {
27
- return captureException(error);
28
- }