@monterosa/sdk-core 2.0.0-rc.4 → 2.0.0-rc.5
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/sdk-core.d.ts +249 -0
- package/dist/src/tsdoc-metadata.json +11 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialises the SDK and provides access to projects and configuration.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function addKit(sdk: MonterosaSdk, name: string, kit: MonterosaKit): void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates an SDK instance.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* Configure default SDK with host and Project ID
|
|
18
|
+
*
|
|
19
|
+
* ```javascript
|
|
20
|
+
* configure({
|
|
21
|
+
* host: "...",
|
|
22
|
+
* projectId: "..."
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param options - Configuration object containing `host` and `projectId`.
|
|
27
|
+
* These values can be found in the Embed section of your Project in Studio.
|
|
28
|
+
* @param name - Optional name of the sdk to initialise.
|
|
29
|
+
* If name is not provided, the default is "[DEFAULT]"
|
|
30
|
+
*
|
|
31
|
+
* @returns Configured SDK instance.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare function configure(options: SdkOptions, name?: string): MonterosaSdk;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Default sdk name.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare const DEFAULT_SDK_NAME = "[DEFAULT]";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare function deleteKit(sdk: MonterosaSdk, name: string): void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Destroy initialised SDK
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```javascript
|
|
54
|
+
* const sdk = configure(...);
|
|
55
|
+
*
|
|
56
|
+
* destroy(sdk);
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param sdk - sdk instance
|
|
60
|
+
*/
|
|
61
|
+
export declare function destroy(sdk: MonterosaSdk): void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Device ID storage key name
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare const DEVICE_ID_KEY = "device_id";
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export declare function getDeviceId(): string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export declare function getKit(sdk: MonterosaSdk, name: string): MonterosaKit | undefined;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves an SDK instance by its name.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```javascript
|
|
85
|
+
* const sdk = getSdk('my-sdk');
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @param name - Optional name of the sdk to initialise.
|
|
89
|
+
* If name is not provided, the default is "[DEFAULT]"
|
|
90
|
+
*
|
|
91
|
+
* @returns The configured SDK instance.
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export declare function getSdk(name?: string): MonterosaSdk;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns all configured SDK instances.
|
|
99
|
+
*
|
|
100
|
+
* @returns An array of all configured SDK instances.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export declare function getSdks(): MonterosaSdk[];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @license
|
|
108
|
+
* @monterosa/sdk-core
|
|
109
|
+
*
|
|
110
|
+
* Copyright © 2021-2024 Monterosa Productions Limited. All rights reserved.
|
|
111
|
+
*
|
|
112
|
+
* More details on the license can be found at https://www.monterosa.co/sdk/license
|
|
113
|
+
*/
|
|
114
|
+
/** @internal */
|
|
115
|
+
export declare type Kits = Map<string, MonterosaKit>;
|
|
116
|
+
|
|
117
|
+
/** @internal */
|
|
118
|
+
export declare class Logger {
|
|
119
|
+
name: string;
|
|
120
|
+
private _logLevel;
|
|
121
|
+
private _logHandler;
|
|
122
|
+
constructor(name: string);
|
|
123
|
+
get logLevel(): LogLevel;
|
|
124
|
+
set logLevel(level: LogLevel);
|
|
125
|
+
get logHandler(): LogHandler;
|
|
126
|
+
set logHandler(handler: LogHandler);
|
|
127
|
+
log(...args: unknown[]): void;
|
|
128
|
+
debug(...args: unknown[]): void;
|
|
129
|
+
info(...args: unknown[]): void;
|
|
130
|
+
warn(...args: unknown[]): void;
|
|
131
|
+
error(...args: unknown[]): void;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** @internal */
|
|
135
|
+
export declare type LogHandler = (logger: Logger, logType: LogLevel, ...args: unknown[]) => void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @license
|
|
139
|
+
* @monterosa/sdk-core
|
|
140
|
+
*
|
|
141
|
+
* Copyright © 2022 Monterosa Productions Limited. All rights reserved.
|
|
142
|
+
*
|
|
143
|
+
* More details on the license can be found at https://www.monterosa.co/sdk/license
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* Represents the possible log levels.
|
|
147
|
+
*/
|
|
148
|
+
export declare enum LogLevel {
|
|
149
|
+
/**
|
|
150
|
+
* Verbose level. Provides detailed and extensive logging.
|
|
151
|
+
*/
|
|
152
|
+
Verbose = 0,
|
|
153
|
+
/**
|
|
154
|
+
* Debug level. Used for debugging and development purposes.
|
|
155
|
+
*/
|
|
156
|
+
Debug = 1,
|
|
157
|
+
/**
|
|
158
|
+
* Info level. Used to provide general information about the system's state.
|
|
159
|
+
*/
|
|
160
|
+
Info = 2,
|
|
161
|
+
/**
|
|
162
|
+
* Warn level. Indicates potential issues or situations that might cause problems in the future.
|
|
163
|
+
*/
|
|
164
|
+
Warn = 3,
|
|
165
|
+
/**
|
|
166
|
+
* Error level. Indicates critical errors and issues that require immediate attention.
|
|
167
|
+
*/
|
|
168
|
+
Error = 4,
|
|
169
|
+
/**
|
|
170
|
+
* Silent level. No logs will be output.
|
|
171
|
+
*/
|
|
172
|
+
Silent = 5
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** @internal */
|
|
176
|
+
export declare interface MonterosaKit {
|
|
177
|
+
delete(): void;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Represents a configured SDK instance. Obtain one via
|
|
182
|
+
* {@link configure} or retrieve an existing one with
|
|
183
|
+
* {@link getSdk}.
|
|
184
|
+
*/
|
|
185
|
+
export declare interface MonterosaSdk {
|
|
186
|
+
/**
|
|
187
|
+
* SDK options
|
|
188
|
+
*/
|
|
189
|
+
readonly options: SdkOptions;
|
|
190
|
+
/**
|
|
191
|
+
* SDK name
|
|
192
|
+
*/
|
|
193
|
+
readonly name: string;
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
isDestroyed: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
kits: Kits;
|
|
202
|
+
/**
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
205
|
+
deleteKits(): void;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
211
|
+
export declare class Sdk implements MonterosaSdk {
|
|
212
|
+
private readonly _options;
|
|
213
|
+
private readonly _name;
|
|
214
|
+
private _isDestroyed;
|
|
215
|
+
private _kits;
|
|
216
|
+
constructor(options: SdkOptions, name: string);
|
|
217
|
+
get name(): string;
|
|
218
|
+
get options(): SdkOptions;
|
|
219
|
+
get isDestroyed(): boolean;
|
|
220
|
+
get kits(): Kits;
|
|
221
|
+
set isDestroyed(value: boolean);
|
|
222
|
+
deleteKits(): void;
|
|
223
|
+
private checkDestroyed;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Configuration object that used to initialise SDK and kits. Required values
|
|
228
|
+
* can be found in Monterosa / Interaction Cloud under
|
|
229
|
+
* {@link https://products.monterosa.co/mic/producer-guide/studio/project-settings | Project Settings tab}.
|
|
230
|
+
*/
|
|
231
|
+
export declare interface SdkOptions {
|
|
232
|
+
/**
|
|
233
|
+
* Studio instance host
|
|
234
|
+
*/
|
|
235
|
+
readonly host: string;
|
|
236
|
+
/**
|
|
237
|
+
* Unique identifier for the Studio Project
|
|
238
|
+
*/
|
|
239
|
+
readonly projectId: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* The current SDK version.
|
|
244
|
+
*
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
|
+
export declare const VERSION: string;
|
|
248
|
+
|
|
249
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.23.0"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monterosa/sdk-core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.5",
|
|
4
4
|
"description": "Monterosa JS SDK / Core",
|
|
5
5
|
"author": "Monterosa Productions Limited <hello@monterosa.co.uk> (https://www.monterosa.co/)",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@monterosa/sdk-util": "2.0.0-rc.
|
|
35
|
+
"@monterosa/sdk-util": "2.0.0-rc.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "4f697a9733d36fb689a35b8e1dd6d589a9ae284c"
|
|
57
57
|
}
|