Skip to content

Commit 6fad99b

Browse files
committed
chore: update library for 3.2.0
BREAKING CHANGE: The `Name` property is mandatory when creating or updating a profile. Additionally, the type of the `Fonts` field has changed due to the removal of the option to set a custom font list on Profiles.
1 parent 39639d3 commit 6fad99b

File tree

7 files changed

+87
-99
lines changed

7 files changed

+87
-99
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const { KameleoLocalApiClient, BuilderForCreateProfile } = require('@kameleo/loc
4949
// for browser fingerprinting protection
5050
const requestBody = BuilderForCreateProfile
5151
.forBaseProfile(baseProfiles[0].id)
52+
.setName('example profile')
5253
.setRecommendedDefaults()
5354
.build();
5455
const profile = await client.createProfile({
@@ -190,6 +191,7 @@ const baseProfileList = await client.searchBaseProfiles({
190191
// Set the launcher to 'chromium' so the mobile profile will be started in Chroma browser
191192
const createProfileRequest = BuilderForCreateProfile
192193
.forBaseProfile(baseProfileList[0].id)
194+
.setName('automate mobile profiles on desktop example')
193195
.setRecommendedDefaults()
194196
.setLauncher('chromium')
195197
.build();

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@kameleo/local-api-client",
33
"author": "Kameleo Team",
44
"description": "This JavaScript/TypeScript package provides convenient access to the Local API REST interface of the Kameleo Client.",
5-
"version": "3.1.1",
5+
"version": "3.2.0",
66
"engines": {
77
"node": ">=14.0.0"
88
},

src/builderForCreateProfile.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,11 @@ export class BuilderForCreateProfile {
168168

169169
/**
170170
* @summary <para>Specifies how the fonts will be spoofed. Possible values:</para>
171-
* <para>'enabled': Enable fonts spoofing. A list can be provided to override the fonts coming from the base profile.</para>
171+
* <para>'enabled': Enable fonts spoofing.</para>
172172
* <para>'disable': Disable fonts spoofing.</para>
173173
*/
174-
public setFonts(value: FontSpoofingType, options: string[]|undefined): BuilderForCreateProfile {
175-
this.profileRequest.fonts.value = value;
176-
this.profileRequest.fonts.extra = options;
174+
public setFonts(value: FontSpoofingType): BuilderForCreateProfile {
175+
this.profileRequest.fonts = value;
177176

178177
return this;
179178
}
@@ -266,15 +265,14 @@ export class BuilderForCreateProfile {
266265
* @summary This sets all the profile options to the defaults recommended by Kameleo Team. Please consider providing Proxy settings to your profile.
267266
*/
268267
public setRecommendedDefaults(): BuilderForCreateProfile {
269-
this.profileRequest.name = "";
270268
this.profileRequest.canvas = "intelligent";
271269
this.profileRequest.webgl = "off";
272270
this.profileRequest.webglMeta.value = "automatic";
273271
this.profileRequest.audio = "off";
274272
this.profileRequest.timezone.value = "automatic";
275273
this.profileRequest.geolocation.value = "automatic";
276274
this.profileRequest.webRtc.value = "automatic";
277-
this.profileRequest.fonts.value = "enabled";
275+
this.profileRequest.fonts = "enabled";
278276
this.profileRequest.screen.value = "automatic";
279277
this.profileRequest.hardwareConcurrency = { value: "automatic", extra: undefined };
280278
this.profileRequest.deviceMemory = { value: "automatic", extra: undefined };
@@ -285,6 +283,7 @@ export class BuilderForCreateProfile {
285283

286284
private reset(baseProfileId: string): CreateProfileRequest {
287285
return {
286+
name: undefined as unknown as string,
288287
baseProfileId: baseProfileId,
289288
canvas: "off",
290289
webgl: "off",
@@ -309,10 +308,7 @@ export class BuilderForCreateProfile {
309308
value: "off",
310309
extra: undefined,
311310
},
312-
fonts: {
313-
value: "disabled",
314-
extra: undefined,
315-
},
311+
fonts: "disabled",
316312
screen: {
317313
value: "off",
318314
extra: undefined,

src/kameleoLocalApiClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class KameleoLocalApiClient extends coreClient.ServiceClient {
5757
}
5858
const defaults: KameleoLocalApiClientOptionalParams = { requestContentType: "application/json; charset=utf-8", allowInsecureConnection: true, retryOptions: { maxRetries: 0 } };
5959

60-
const packageDetails = `azsdk-js-kameleoLocalApiClient/3.1.1`;
60+
const packageDetails = `azsdk-js-kameleoLocalApiClient/3.2.0`;
6161
const userAgentPrefix =
6262
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
6363
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`

src/models/index.ts

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface BaseProfilePreview {
2727
browser: Browser;
2828
/** Language of the base profile. Using ISO 639-1 language codes. */
2929
language: string;
30+
webglMeta: WebglMeta;
3031
}
3132

3233
export interface Device {
@@ -54,6 +55,13 @@ export interface Browser {
5455
version: string;
5556
}
5657

58+
export interface WebglMeta {
59+
/** The UnmaskedVendor field from WebGL context */
60+
vendor: string;
61+
/** The UnmaskedRenderer field from WebGL context */
62+
renderer?: string;
63+
}
64+
5765
/** Representation of a cookie. */
5866
export interface BrowserCookie {
5967
/** The domain attribute signifies the domain for which the cookie is valid and can be submitted with every request for this domain or its subdomains. If this attribute is not specified, then the hostname of the originating server is used as the default value. */
@@ -216,8 +224,8 @@ export interface StatusResponse {
216224
export interface CreateProfileRequest {
217225
/** The unique identifier of the base profile. This references the base profile which should be used to build the new profile. */
218226
baseProfileId: string;
219-
/** Sets a human readable name for the profile. The value obtained by file name for existing profiles. For new profiles the value is generated by random. */
220-
name?: string;
227+
/** Sets a human-readable name for the profile, which is modifiable at any time. */
228+
name: string;
221229
/** Use tags to categorize profiles by labeling them accordingly. */
222230
tags?: string[];
223231
/**
@@ -247,7 +255,12 @@ export interface CreateProfileRequest {
247255
geolocation: GeolocationSpoofingTypeGeolocationSpoofingOptionsMultiLevelChoice;
248256
proxy: ProxyConnectionTypeServerMultiLevelChoice;
249257
webRtc: WebRtcSpoofingTypeWebRtcSpoofingOptionsMultiLevelChoice;
250-
fonts: FontSpoofingTypeFontIListMultiLevelChoice;
258+
/**
259+
* Specifies how the fonts will be spoofed. Possible values:
260+
* 'enabled': Enable fonts spoofing.
261+
* 'disable': Disable fonts spoofing.
262+
*/
263+
fonts: FontSpoofingType;
251264
screen: ScreenSpoofingTypeScreenSizeMultiLevelChoice;
252265
hardwareConcurrency?: HardwareConcurrencySpoofingTypeInt32NullableMultiLevelChoice;
253266
deviceMemory?: DeviceMemorySpoofingTypeDoubleNullableMultiLevelChoice;
@@ -342,16 +355,6 @@ export interface WebRtcSpoofingOptions {
342355
publicIp: string;
343356
}
344357

345-
export interface FontSpoofingTypeFontIListMultiLevelChoice {
346-
/**
347-
* Specifies how the fonts will be spoofed. Possible values:
348-
* 'enabled': Enable fonts spoofing. A list can be provided to override the fonts coming from the base profile.
349-
* 'disable': Disable fonts spoofing.
350-
*/
351-
value: FontSpoofingType;
352-
extra?: string[];
353-
}
354-
355358
export interface ScreenSpoofingTypeScreenSizeMultiLevelChoice {
356359
/**
357360
* Specifies how the screen will be spoofed. Possible values:
@@ -424,7 +427,12 @@ export interface ProfileResponse {
424427
geolocation: GeolocationSpoofingTypeGeolocationSpoofingOptionsMultiLevelChoice;
425428
proxy: ProxyConnectionTypeServerMultiLevelChoice;
426429
webRtc: WebRtcSpoofingTypeWebRtcSpoofingOptionsMultiLevelChoice;
427-
fonts: FontSpoofingTypeFontIListMultiLevelChoice;
430+
/**
431+
* Specifies how the fonts will be spoofed. Possible values:
432+
* 'enabled': Enable fonts spoofing.
433+
* 'disable': Disable fonts spoofing.
434+
*/
435+
fonts: FontSpoofingType;
428436
screen: ScreenSpoofingTypeScreenSizeMultiLevelChoice;
429437
hardwareConcurrency: HardwareConcurrencySpoofingTypeInt32NullableMultiLevelChoice;
430438
deviceMemory: DeviceMemorySpoofingTypeDoubleNullableMultiLevelChoice;
@@ -458,18 +466,11 @@ export interface BaseProfile {
458466
browser: Browser;
459467
/** Language of the base profile. Using ISO 639-1 language codes. */
460468
language: string;
469+
webglMeta: WebglMeta;
461470
/** The screen size of the device in pixels */
462471
resolution: string;
463472
/** A list of font types included in the profile */
464473
fonts: string[];
465-
webglMeta: WebglMeta;
466-
}
467-
468-
export interface WebglMeta {
469-
/** The UnmaskedVendor field from WebGL context */
470-
vendor: string;
471-
/** The UnmaskedRenderer field from WebGL context */
472-
renderer?: string;
473474
}
474475

475476
export interface UpdateProfileRequest {
@@ -500,7 +501,12 @@ export interface UpdateProfileRequest {
500501
geolocation: GeolocationSpoofingTypeGeolocationSpoofingOptionsMultiLevelChoice;
501502
proxy: ProxyConnectionTypeServerMultiLevelChoice;
502503
webRtc: WebRtcSpoofingTypeWebRtcSpoofingOptionsMultiLevelChoice;
503-
fonts: FontSpoofingTypeFontIListMultiLevelChoice;
504+
/**
505+
* Specifies how the fonts will be spoofed. Possible values:
506+
* 'enabled': Enable fonts spoofing.
507+
* 'disable': Disable fonts spoofing.
508+
*/
509+
fonts: FontSpoofingType;
504510
screen: ScreenSpoofingTypeScreenSizeMultiLevelChoice;
505511
hardwareConcurrency: HardwareConcurrencySpoofingTypeInt32NullableMultiLevelChoice;
506512
deviceMemory?: DeviceMemorySpoofingTypeDoubleNullableMultiLevelChoice;

src/models/mappers.ts

Lines changed: 46 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ export const BaseProfilePreview: coreClient.CompositeMapper = {
120120
type: {
121121
name: "String"
122122
}
123+
},
124+
webglMeta: {
125+
serializedName: "webglMeta",
126+
type: {
127+
name: "Composite",
128+
className: "WebglMeta"
129+
}
123130
}
124131
}
125132
}
@@ -207,6 +214,28 @@ export const Browser: coreClient.CompositeMapper = {
207214
}
208215
};
209216

217+
export const WebglMeta: coreClient.CompositeMapper = {
218+
type: {
219+
name: "Composite",
220+
className: "WebglMeta",
221+
modelProperties: {
222+
vendor: {
223+
serializedName: "vendor",
224+
required: true,
225+
type: {
226+
name: "String"
227+
}
228+
},
229+
renderer: {
230+
serializedName: "renderer",
231+
type: {
232+
name: "String"
233+
}
234+
}
235+
}
236+
}
237+
};
238+
210239
export const BrowserCookie: coreClient.CompositeMapper = {
211240
type: {
212241
name: "Composite",
@@ -670,7 +699,11 @@ export const CreateProfileRequest: coreClient.CompositeMapper = {
670699
}
671700
},
672701
name: {
702+
constraints: {
703+
MinLength: 1
704+
},
673705
serializedName: "name",
706+
required: true,
674707
type: {
675708
name: "String"
676709
}
@@ -746,9 +779,9 @@ export const CreateProfileRequest: coreClient.CompositeMapper = {
746779
},
747780
fonts: {
748781
serializedName: "fonts",
782+
required: true,
749783
type: {
750-
name: "Composite",
751-
className: "FontSpoofingTypeFontIListMultiLevelChoice"
784+
name: "String"
752785
}
753786
},
754787
screen: {
@@ -978,33 +1011,6 @@ export const WebRtcSpoofingOptions: coreClient.CompositeMapper = {
9781011
}
9791012
};
9801013

981-
export const FontSpoofingTypeFontIListMultiLevelChoice: coreClient.CompositeMapper = {
982-
type: {
983-
name: "Composite",
984-
className: "FontSpoofingTypeFontIListMultiLevelChoice",
985-
modelProperties: {
986-
value: {
987-
serializedName: "value",
988-
required: true,
989-
type: {
990-
name: "String"
991-
}
992-
},
993-
extra: {
994-
serializedName: "extra",
995-
type: {
996-
name: "Sequence",
997-
element: {
998-
type: {
999-
name: "String"
1000-
}
1001-
}
1002-
}
1003-
}
1004-
}
1005-
}
1006-
};
1007-
10081014
export const ScreenSpoofingTypeScreenSizeMultiLevelChoice: coreClient.CompositeMapper = {
10091015
type: {
10101016
name: "Composite",
@@ -1176,9 +1182,9 @@ export const ProfileResponse: coreClient.CompositeMapper = {
11761182
},
11771183
fonts: {
11781184
serializedName: "fonts",
1185+
required: true,
11791186
type: {
1180-
name: "Composite",
1181-
className: "FontSpoofingTypeFontIListMultiLevelChoice"
1187+
name: "String"
11821188
}
11831189
},
11841190
screen: {
@@ -1307,6 +1313,13 @@ export const BaseProfile: coreClient.CompositeMapper = {
13071313
name: "String"
13081314
}
13091315
},
1316+
webglMeta: {
1317+
serializedName: "webglMeta",
1318+
type: {
1319+
name: "Composite",
1320+
className: "WebglMeta"
1321+
}
1322+
},
13101323
resolution: {
13111324
serializedName: "resolution",
13121325
required: true,
@@ -1325,35 +1338,6 @@ export const BaseProfile: coreClient.CompositeMapper = {
13251338
}
13261339
}
13271340
}
1328-
},
1329-
webglMeta: {
1330-
serializedName: "webglMeta",
1331-
type: {
1332-
name: "Composite",
1333-
className: "WebglMeta"
1334-
}
1335-
}
1336-
}
1337-
}
1338-
};
1339-
1340-
export const WebglMeta: coreClient.CompositeMapper = {
1341-
type: {
1342-
name: "Composite",
1343-
className: "WebglMeta",
1344-
modelProperties: {
1345-
vendor: {
1346-
serializedName: "vendor",
1347-
required: true,
1348-
type: {
1349-
name: "String"
1350-
}
1351-
},
1352-
renderer: {
1353-
serializedName: "renderer",
1354-
type: {
1355-
name: "String"
1356-
}
13571341
}
13581342
}
13591343
}
@@ -1424,9 +1408,9 @@ export const UpdateProfileRequest: coreClient.CompositeMapper = {
14241408
},
14251409
fonts: {
14261410
serializedName: "fonts",
1411+
required: true,
14271412
type: {
1428-
name: "Composite",
1429-
className: "FontSpoofingTypeFontIListMultiLevelChoice"
1413+
name: "String"
14301414
}
14311415
},
14321416
screen: {

0 commit comments

Comments
 (0)