@asiyst/sdk 0.1.8 → 0.1.9
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/README.md +3 -0
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -82,6 +82,8 @@ type TargetInput = string | TargetRef;
|
|
|
82
82
|
interface InitOptions {
|
|
83
83
|
projectId: string;
|
|
84
84
|
publicKey: string;
|
|
85
|
+
avatarId?: string;
|
|
86
|
+
position?: AnchorPosition;
|
|
85
87
|
apiBaseUrl?: string;
|
|
86
88
|
mode?: AssistantMode;
|
|
87
89
|
allowedActions?: ActionKind[];
|
|
@@ -290,9 +292,13 @@ declare function normalizeProjectConfig(raw: unknown): ProjectConfig;
|
|
|
290
292
|
declare function validateInitOptions(options: {
|
|
291
293
|
projectId?: unknown;
|
|
292
294
|
publicKey?: unknown;
|
|
295
|
+
avatarId?: unknown;
|
|
296
|
+
position?: unknown;
|
|
293
297
|
}): {
|
|
294
298
|
projectId: string;
|
|
295
299
|
publicKey: string;
|
|
300
|
+
avatarId?: string;
|
|
301
|
+
position?: AnchorPosition;
|
|
296
302
|
};
|
|
297
303
|
|
|
298
304
|
declare function isSafeSelector(selector: string): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ type TargetInput = string | TargetRef;
|
|
|
82
82
|
interface InitOptions {
|
|
83
83
|
projectId: string;
|
|
84
84
|
publicKey: string;
|
|
85
|
+
avatarId?: string;
|
|
86
|
+
position?: AnchorPosition;
|
|
85
87
|
apiBaseUrl?: string;
|
|
86
88
|
mode?: AssistantMode;
|
|
87
89
|
allowedActions?: ActionKind[];
|
|
@@ -290,9 +292,13 @@ declare function normalizeProjectConfig(raw: unknown): ProjectConfig;
|
|
|
290
292
|
declare function validateInitOptions(options: {
|
|
291
293
|
projectId?: unknown;
|
|
292
294
|
publicKey?: unknown;
|
|
295
|
+
avatarId?: unknown;
|
|
296
|
+
position?: unknown;
|
|
293
297
|
}): {
|
|
294
298
|
projectId: string;
|
|
295
299
|
publicKey: string;
|
|
300
|
+
avatarId?: string;
|
|
301
|
+
position?: AnchorPosition;
|
|
296
302
|
};
|
|
297
303
|
|
|
298
304
|
declare function isSafeSelector(selector: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var ALL_ACTION_KINDS = [
|
|
|
69
69
|
];
|
|
70
70
|
|
|
71
71
|
// src/core/constants.ts
|
|
72
|
-
var SDK_VERSION = "0.1.
|
|
72
|
+
var SDK_VERSION = "0.1.9" ;
|
|
73
73
|
var DEFAULT_API_BASE_URL = "https://nqhxpgsjofzqudyqkqib.supabase.co/functions/v1/api";
|
|
74
74
|
var CONFIG_SCHEMA_VERSION = 1;
|
|
75
75
|
var HOST_ELEMENT_ID = "asiyst-host";
|
|
@@ -368,9 +368,19 @@ function validateInitOptions(options) {
|
|
|
368
368
|
if (projectIdValue.length > 128 || options.publicKey.trim().length > 256) {
|
|
369
369
|
throw new ConfigurationError("project credentials exceed allowed length");
|
|
370
370
|
}
|
|
371
|
+
const avatarId = typeof options.avatarId === "string" ? options.avatarId.trim() : "";
|
|
372
|
+
if (options.avatarId !== void 0 && (!avatarId || avatarId.length > 128 || !/^[A-Za-z0-9_-]+$/.test(avatarId))) {
|
|
373
|
+
throw new ConfigurationError("Asiyst SDK: avatarId is invalid.");
|
|
374
|
+
}
|
|
375
|
+
const position = options.position === void 0 ? void 0 : ANCHORS.includes(options.position) ? options.position : void 0;
|
|
376
|
+
if (options.position !== void 0 && !position) {
|
|
377
|
+
throw new ConfigurationError("Asiyst SDK: position is invalid.");
|
|
378
|
+
}
|
|
371
379
|
return {
|
|
372
380
|
projectId: projectIdValue,
|
|
373
|
-
publicKey: options.publicKey.trim()
|
|
381
|
+
publicKey: options.publicKey.trim(),
|
|
382
|
+
avatarId: avatarId || void 0,
|
|
383
|
+
position
|
|
374
384
|
};
|
|
375
385
|
}
|
|
376
386
|
|
|
@@ -421,6 +431,7 @@ var HttpTransport = class {
|
|
|
421
431
|
"Content-Type": "application/json",
|
|
422
432
|
"X-Asiyst-Project-Id": this.options.projectId,
|
|
423
433
|
"X-Asiyst-Public-Key": this.options.publicKey,
|
|
434
|
+
...this.options.avatarId ? { "X-Asiyst-Avatar-Id": this.options.avatarId } : {},
|
|
424
435
|
"X-Asiyst-SDK-Version": SDK_VERSION
|
|
425
436
|
},
|
|
426
437
|
body: req.body === void 0 ? void 0 : JSON.stringify(req.body),
|
|
@@ -650,6 +661,7 @@ var ConfigManager = class {
|
|
|
650
661
|
return {
|
|
651
662
|
...base,
|
|
652
663
|
mode: this.options.mode ?? base.mode,
|
|
664
|
+
position: this.options.position ?? base.position,
|
|
653
665
|
allowedActions: this.options.allowedActions ?? base.allowedActions
|
|
654
666
|
};
|
|
655
667
|
}
|
|
@@ -2357,7 +2369,8 @@ var AsiystRuntime = class {
|
|
|
2357
2369
|
const transport = new HttpTransport({
|
|
2358
2370
|
apiBaseUrl: options.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
2359
2371
|
projectId: options.projectId,
|
|
2360
|
-
publicKey: options.publicKey
|
|
2372
|
+
publicKey: options.publicKey,
|
|
2373
|
+
avatarId: options.avatarId
|
|
2361
2374
|
});
|
|
2362
2375
|
this.cloud = new CloudClient(transport, options.projectId);
|
|
2363
2376
|
this.config = new ConfigManager(options, this.cloud, this.events);
|