@minecraft/diagnostics 1.0.0-beta.1.21.100-preview.20

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 (3) hide show
  1. package/README.md +9 -0
  2. package/index.d.ts +185 -0
  3. package/package.json +20 -0
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # `@minecraft/diagnostics`
2
+
3
+ Contains diagnostics functionality for discovering and diagnosing issues with content.
4
+
5
+ ## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
6
+
7
+ See full documentation for this module here:
8
+
9
+ https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/diagnostics/minecraft-diagnostics
package/index.d.ts ADDED
@@ -0,0 +1,185 @@
1
+ // Type definitions for Minecraft Bedrock Edition script APIs
2
+ // Project: https://docs.microsoft.com/minecraft/creator/
3
+ // Definitions by: Jake Shirley <https://github.com/JakeShirley>
4
+ // Mike Ammerlaan <https://github.com/mammerla>
5
+
6
+ /* *****************************************************************************
7
+ Copyright (c) Microsoft Corporation.
8
+ ***************************************************************************** */
9
+ /**
10
+ * @beta
11
+ * @packageDocumentation
12
+ * Contains diagnostics functionality for discovering and
13
+ * diagnosing issues with content.
14
+ *
15
+ * Manifest Details
16
+ * ```json
17
+ * {
18
+ * "module_name": "@minecraft/diagnostics",
19
+ * "version": "1.0.0-beta"
20
+ * }
21
+ * ```
22
+ *
23
+ */
24
+ import * as minecraftcommon from '@minecraft/common';
25
+ import * as minecraftserveradmin from '@minecraft/server-admin';
26
+ /**
27
+ * This defines the severity level of the breadcrumb. Levels
28
+ * are used in the UI to emphasize and deemphasize the crumb.
29
+ * The default is info. See Sentry documentation for more
30
+ * information:
31
+ * https://docs.sentry.io/product/issues/issue-details/breadcrumbs/
32
+ */
33
+ export enum SentryBreadcrumbLevel {
34
+ debug = 'debug',
35
+ error = 'error',
36
+ info = 'info',
37
+ warning = 'warning',
38
+ }
39
+
40
+ /**
41
+ * A class that allows hooking up reporting to Sentry. See
42
+ * https://sentry.io/ for more information.
43
+ */
44
+ export class Sentry {
45
+ private constructor();
46
+ /**
47
+ * @remarks
48
+ * Adds a breadcrumb to the next Sentry error reported. This
49
+ * can be useful for understanding a "trail" of events leading
50
+ * up to an error. See Sentry documentation for more details:
51
+ * https://docs.sentry.io/product/issues/issue-details/breadcrumbs/
52
+ *
53
+ * This function can't be called in read-only mode.
54
+ *
55
+ * This function can be called in early-execution mode.
56
+ *
57
+ * @param message
58
+ * The message to add to the breadcrumb.
59
+ * @param category
60
+ * The category of the breadcrumb.
61
+ * @throws This function can throw errors.
62
+ *
63
+ * {@link SentryUninitializedError}
64
+ */
65
+ addBreadcrumb(level: SentryBreadcrumbLevel, message: string, category?: string): void;
66
+ /**
67
+ * @remarks
68
+ * Adds a tag to the Sentry session. See Sentry documentation
69
+ * for more details:
70
+ * https://docs.sentry.io/platforms/javascript/enriching-events/tags/
71
+ *
72
+ * This function can't be called in read-only mode.
73
+ *
74
+ * This function can be called in early-execution mode.
75
+ *
76
+ * @throws This function can throw errors.
77
+ *
78
+ * {@link SentryUninitializedError}
79
+ */
80
+ addTag(name: string, value: string): void;
81
+ /**
82
+ * @remarks
83
+ * Gets the list of all session tags. See Sentry documentation
84
+ * for more details:
85
+ * https://docs.sentry.io/platforms/javascript/enriching-events/tags/
86
+ *
87
+ * This function can't be called in read-only mode.
88
+ *
89
+ * This function can be called in early-execution mode.
90
+ *
91
+ * @throws This function can throw errors.
92
+ *
93
+ * {@link SentryUninitializedError}
94
+ */
95
+ getTags(): Record<string, string>;
96
+ /**
97
+ * @remarks
98
+ * Initializes Sentry for use. This must be successfully
99
+ * called before any other Sentry functions are called.
100
+ *
101
+ * This function can't be called in read-only mode.
102
+ *
103
+ * This function can be called in early-execution mode.
104
+ *
105
+ * @throws This function can throw errors.
106
+ *
107
+ * {@link minecraftcommon.InvalidArgumentError}
108
+ *
109
+ * {@link SentryAlreadyInitializedError}
110
+ */
111
+ init(options: SentryOptions): void;
112
+ /**
113
+ * @remarks
114
+ * Removes a tag to the Sentry session. See Sentry
115
+ * documentation for more details:
116
+ * https://docs.sentry.io/platforms/javascript/enriching-events/tags/
117
+ *
118
+ * This function can't be called in read-only mode.
119
+ *
120
+ * This function can be called in early-execution mode.
121
+ *
122
+ * @throws This function can throw errors.
123
+ *
124
+ * {@link SentryUninitializedError}
125
+ */
126
+ removeTag(name: string): void;
127
+ }
128
+
129
+ /**
130
+ * Describes options for configuring Sentry for this scripting
131
+ * module.
132
+ */
133
+ export interface SentryOptions {
134
+ /**
135
+ * @remarks
136
+ * When set to true, additional content logging from the Sentry
137
+ * system will be enabled. Defaults to false.
138
+ *
139
+ */
140
+ debug?: boolean;
141
+ /**
142
+ * @remarks
143
+ * The fully qualified DSN for a Sentry project. See Sentry
144
+ * documentation for more information:
145
+ * https://docs.sentry.io/concepts/key-terms/dsn-explainer/
146
+ *
147
+ */
148
+ dsn: minecraftserveradmin.SecretString | string;
149
+ /**
150
+ * @remarks
151
+ * The maximum number of breadcrumbs (submitted via {@link
152
+ * Sentry.addBreadcrumb}) to store and report per error event
153
+ * to Sentry. Default is 20, supported values range from 0 (no
154
+ * breadcrumbs) to 100.
155
+ *
156
+ */
157
+ maxBreadcrumbs?: number;
158
+ /**
159
+ * @remarks
160
+ * A number between 0 and 1 that indicates the percentage of
161
+ * events that should be sent to Sentry. For example, a value
162
+ * of 0.5 means that 50% of events will be sent. Default is 1
163
+ * (100% of events). 0 means no events will be sent.
164
+ *
165
+ */
166
+ sampleRate?: number;
167
+ }
168
+
169
+ // @ts-ignore Class inheritance allowed for native defined classes
170
+ export class SentryAlreadyInitializedError extends Error {
171
+ private constructor();
172
+ }
173
+
174
+ // @ts-ignore Class inheritance allowed for native defined classes
175
+ export class SentryUninitializedError extends Error {
176
+ private constructor();
177
+ }
178
+
179
+ /**
180
+ * @remarks
181
+ * A class that allows hooking up reporting to Sentry. See
182
+ * https://sentry.io/ for more information.
183
+ *
184
+ */
185
+ export const sentry: Sentry;
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@minecraft/diagnostics",
3
+ "version": "1.0.0-beta.1.21.100-preview.20",
4
+ "description": "",
5
+ "contributors": [
6
+ {
7
+ "name": "Jake Shirley",
8
+ "email": "jake@xbox.com"
9
+ },
10
+ {
11
+ "name": "Mike Ammerlaan",
12
+ "email": "mikeam@microsoft.com"
13
+ }
14
+ ],
15
+ "dependencies": {
16
+ "@minecraft/common": "^1.0.0",
17
+ "@minecraft/server-admin": "^1.0.0-beta.1.21.100-preview.20"
18
+ },
19
+ "license": "MIT"
20
+ }