@picteus/extension-sdk 0.3.0 → 0.3.2
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/picteus-ws-client/apis/ExtensionApi.d.ts +32 -5
- package/dist/picteus-ws-client/apis/ExtensionApi.js +34 -2
- package/dist/picteus-ws-client/models/ExtensionAndManual.d.ts +47 -0
- package/dist/picteus-ws-client/models/ExtensionAndManual.js +52 -0
- package/dist/picteus-ws-client/models/ExtensionManual.d.ts +32 -0
- package/dist/picteus-ws-client/models/ExtensionManual.js +43 -0
- package/dist/picteus-ws-client/models/index.d.ts +2 -0
- package/dist/picteus-ws-client/models/index.js +2 -0
- package/dist/picteusExtension.d.ts +4 -2
- package/dist/picteusExtension.js +12 -4
- package/package.json +4 -4
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime.js';
|
|
13
|
-
import type { Extension, ExtensionActivity, ExtensionGenerationOptions, ExtensionSettings, ExtensionsConfiguration } from '../models/index.js';
|
|
13
|
+
import type { Extension, ExtensionActivity, ExtensionAndManual, ExtensionGenerationOptions, ExtensionSettings, ExtensionsConfiguration } from '../models/index.js';
|
|
14
|
+
export interface ExtensionApiExtensionBuildRequest {
|
|
15
|
+
body: Blob;
|
|
16
|
+
}
|
|
14
17
|
export interface ExtensionApiExtensionGenerateRequest {
|
|
15
18
|
withPublicSdk: boolean;
|
|
16
19
|
extensionGenerationOptions: ExtensionGenerationOptions;
|
|
@@ -73,6 +76,20 @@ export interface ExtensionApiInterface {
|
|
|
73
76
|
* Indicates the extension activities
|
|
74
77
|
*/
|
|
75
78
|
extensionActivities(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ExtensionActivity>>;
|
|
79
|
+
/**
|
|
80
|
+
* Compiles and packages an extension from its source code.
|
|
81
|
+
* @summary Builds an extension
|
|
82
|
+
* @param {Blob} body The extension archive
|
|
83
|
+
* @param {*} [options] Override http request option.
|
|
84
|
+
* @throws {RequiredError}
|
|
85
|
+
* @memberof ExtensionApiInterface
|
|
86
|
+
*/
|
|
87
|
+
extensionBuildRaw(requestParameters: ExtensionApiExtensionBuildRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>>;
|
|
88
|
+
/**
|
|
89
|
+
* Compiles and packages an extension from its source code.
|
|
90
|
+
* Builds an extension
|
|
91
|
+
*/
|
|
92
|
+
extensionBuild(requestParameters: ExtensionApiExtensionBuildRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob>;
|
|
76
93
|
/**
|
|
77
94
|
* Scaffolds an extension respecting a set of specifications.
|
|
78
95
|
* @summary Generates an extension
|
|
@@ -96,12 +113,12 @@ export interface ExtensionApiInterface {
|
|
|
96
113
|
* @throws {RequiredError}
|
|
97
114
|
* @memberof ExtensionApiInterface
|
|
98
115
|
*/
|
|
99
|
-
extensionGetRaw(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<
|
|
116
|
+
extensionGetRaw(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ExtensionAndManual>>;
|
|
100
117
|
/**
|
|
101
118
|
* Returns the details about an extension.
|
|
102
119
|
* Gets an extension
|
|
103
120
|
*/
|
|
104
|
-
extensionGet(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<
|
|
121
|
+
extensionGet(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ExtensionAndManual>;
|
|
105
122
|
/**
|
|
106
123
|
* Returns the details in terms of all installed extensions capabilities, i.e. what they can offer, and the command they offer.
|
|
107
124
|
* @summary Provides the extensions configuration
|
|
@@ -277,6 +294,16 @@ export declare class ExtensionApi extends runtime.BaseAPI implements ExtensionAp
|
|
|
277
294
|
* Indicates the extension activities
|
|
278
295
|
*/
|
|
279
296
|
extensionActivities(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ExtensionActivity>>;
|
|
297
|
+
/**
|
|
298
|
+
* Compiles and packages an extension from its source code.
|
|
299
|
+
* Builds an extension
|
|
300
|
+
*/
|
|
301
|
+
extensionBuildRaw(requestParameters: ExtensionApiExtensionBuildRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>>;
|
|
302
|
+
/**
|
|
303
|
+
* Compiles and packages an extension from its source code.
|
|
304
|
+
* Builds an extension
|
|
305
|
+
*/
|
|
306
|
+
extensionBuild(requestParameters: ExtensionApiExtensionBuildRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob>;
|
|
280
307
|
/**
|
|
281
308
|
* Scaffolds an extension respecting a set of specifications.
|
|
282
309
|
* Generates an extension
|
|
@@ -291,12 +318,12 @@ export declare class ExtensionApi extends runtime.BaseAPI implements ExtensionAp
|
|
|
291
318
|
* Returns the details about an extension.
|
|
292
319
|
* Gets an extension
|
|
293
320
|
*/
|
|
294
|
-
extensionGetRaw(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<
|
|
321
|
+
extensionGetRaw(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ExtensionAndManual>>;
|
|
295
322
|
/**
|
|
296
323
|
* Returns the details about an extension.
|
|
297
324
|
* Gets an extension
|
|
298
325
|
*/
|
|
299
|
-
extensionGet(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<
|
|
326
|
+
extensionGet(requestParameters: ExtensionApiExtensionGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ExtensionAndManual>;
|
|
300
327
|
/**
|
|
301
328
|
* Returns the details in terms of all installed extensions capabilities, i.e. what they can offer, and the command they offer.
|
|
302
329
|
* Provides the extensions configuration
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
import * as runtime from '../runtime.js';
|
|
15
|
-
import { ExtensionFromJSON, ExtensionActivityFromJSON, ExtensionGenerationOptionsToJSON, ExtensionSettingsFromJSON, ExtensionSettingsToJSON, ExtensionsConfigurationFromJSON, } from '../models/index.js';
|
|
15
|
+
import { ExtensionFromJSON, ExtensionActivityFromJSON, ExtensionAndManualFromJSON, ExtensionGenerationOptionsToJSON, ExtensionSettingsFromJSON, ExtensionSettingsToJSON, ExtensionsConfigurationFromJSON, } from '../models/index.js';
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
@@ -44,6 +44,38 @@ export class ExtensionApi extends runtime.BaseAPI {
|
|
|
44
44
|
const response = await this.extensionActivitiesRaw(initOverrides);
|
|
45
45
|
return await response.value();
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Compiles and packages an extension from its source code.
|
|
49
|
+
* Builds an extension
|
|
50
|
+
*/
|
|
51
|
+
async extensionBuildRaw(requestParameters, initOverrides) {
|
|
52
|
+
if (requestParameters['body'] == null) {
|
|
53
|
+
throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling extensionBuild().');
|
|
54
|
+
}
|
|
55
|
+
const queryParameters = {};
|
|
56
|
+
const headerParameters = {};
|
|
57
|
+
headerParameters['Content-Type'] = 'application/zip';
|
|
58
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
59
|
+
headerParameters["X-API-KEY"] = await this.configuration.apiKey("X-API-KEY"); // api-key authentication
|
|
60
|
+
}
|
|
61
|
+
let urlPath = `/extension/build`;
|
|
62
|
+
const response = await this.request({
|
|
63
|
+
path: urlPath,
|
|
64
|
+
method: 'PUT',
|
|
65
|
+
headers: headerParameters,
|
|
66
|
+
query: queryParameters,
|
|
67
|
+
body: requestParameters['body'],
|
|
68
|
+
}, initOverrides);
|
|
69
|
+
return new runtime.BlobApiResponse(response);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Compiles and packages an extension from its source code.
|
|
73
|
+
* Builds an extension
|
|
74
|
+
*/
|
|
75
|
+
async extensionBuild(requestParameters, initOverrides) {
|
|
76
|
+
const response = await this.extensionBuildRaw(requestParameters, initOverrides);
|
|
77
|
+
return await response.value();
|
|
78
|
+
}
|
|
47
79
|
/**
|
|
48
80
|
* Scaffolds an extension respecting a set of specifications.
|
|
49
81
|
* Generates an extension
|
|
@@ -103,7 +135,7 @@ export class ExtensionApi extends runtime.BaseAPI {
|
|
|
103
135
|
headers: headerParameters,
|
|
104
136
|
query: queryParameters,
|
|
105
137
|
}, initOverrides);
|
|
106
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
138
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ExtensionAndManualFromJSON(jsonValue));
|
|
107
139
|
}
|
|
108
140
|
/**
|
|
109
141
|
* Returns the details about an extension.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picteus
|
|
3
|
+
* The Picteus API
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.3.0
|
|
6
|
+
* Contact: edouard@koppasoft.com
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExtensionManual } from './ExtensionManual.js';
|
|
13
|
+
import type { ExtensionStatus } from './ExtensionStatus.js';
|
|
14
|
+
import type { Manifest } from './Manifest.js';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
* @interface ExtensionAndManual
|
|
19
|
+
*/
|
|
20
|
+
export interface ExtensionAndManual {
|
|
21
|
+
/**
|
|
22
|
+
* The extension manifest
|
|
23
|
+
* @type {Manifest}
|
|
24
|
+
* @memberof ExtensionAndManual
|
|
25
|
+
*/
|
|
26
|
+
manifest: Manifest;
|
|
27
|
+
/**
|
|
28
|
+
* The status of the extension
|
|
29
|
+
* @type {ExtensionStatus}
|
|
30
|
+
* @memberof ExtensionAndManual
|
|
31
|
+
*/
|
|
32
|
+
status: ExtensionStatus;
|
|
33
|
+
/**
|
|
34
|
+
* The extension manual
|
|
35
|
+
* @type {ExtensionManual}
|
|
36
|
+
* @memberof ExtensionAndManual
|
|
37
|
+
*/
|
|
38
|
+
manual?: ExtensionManual;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if a given object implements the ExtensionAndManual interface.
|
|
42
|
+
*/
|
|
43
|
+
export declare function instanceOfExtensionAndManual(value: object): value is ExtensionAndManual;
|
|
44
|
+
export declare function ExtensionAndManualFromJSON(json: any): ExtensionAndManual;
|
|
45
|
+
export declare function ExtensionAndManualFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtensionAndManual;
|
|
46
|
+
export declare function ExtensionAndManualToJSON(json: any): ExtensionAndManual;
|
|
47
|
+
export declare function ExtensionAndManualToJSONTyped(value?: ExtensionAndManual | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Picteus
|
|
5
|
+
* The Picteus API
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.3.0
|
|
8
|
+
* Contact: edouard@koppasoft.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
import { ExtensionManualFromJSON, ExtensionManualToJSON, } from './ExtensionManual.js';
|
|
15
|
+
import { ExtensionStatusFromJSON, ExtensionStatusToJSON, } from './ExtensionStatus.js';
|
|
16
|
+
import { ManifestFromJSON, ManifestToJSON, } from './Manifest.js';
|
|
17
|
+
/**
|
|
18
|
+
* Check if a given object implements the ExtensionAndManual interface.
|
|
19
|
+
*/
|
|
20
|
+
export function instanceOfExtensionAndManual(value) {
|
|
21
|
+
if (!('manifest' in value) || value['manifest'] === undefined)
|
|
22
|
+
return false;
|
|
23
|
+
if (!('status' in value) || value['status'] === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
export function ExtensionAndManualFromJSON(json) {
|
|
28
|
+
return ExtensionAndManualFromJSONTyped(json, false);
|
|
29
|
+
}
|
|
30
|
+
export function ExtensionAndManualFromJSONTyped(json, ignoreDiscriminator) {
|
|
31
|
+
if (json == null) {
|
|
32
|
+
return json;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
'manifest': ManifestFromJSON(json['manifest']),
|
|
36
|
+
'status': ExtensionStatusFromJSON(json['status']),
|
|
37
|
+
'manual': json['manual'] == null ? undefined : ExtensionManualFromJSON(json['manual']),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function ExtensionAndManualToJSON(json) {
|
|
41
|
+
return ExtensionAndManualToJSONTyped(json, false);
|
|
42
|
+
}
|
|
43
|
+
export function ExtensionAndManualToJSONTyped(value, ignoreDiscriminator = false) {
|
|
44
|
+
if (value == null) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
'manifest': ManifestToJSON(value['manifest']),
|
|
49
|
+
'status': ExtensionStatusToJSON(value['status']),
|
|
50
|
+
'manual': ExtensionManualToJSON(value['manual']),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picteus
|
|
3
|
+
* The Picteus API
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.3.0
|
|
6
|
+
* Contact: edouard@koppasoft.com
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ExtensionManual
|
|
16
|
+
*/
|
|
17
|
+
export interface ExtensionManual {
|
|
18
|
+
/**
|
|
19
|
+
* The instructions
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof ExtensionManual
|
|
22
|
+
*/
|
|
23
|
+
instructions: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if a given object implements the ExtensionManual interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare function instanceOfExtensionManual(value: object): value is ExtensionManual;
|
|
29
|
+
export declare function ExtensionManualFromJSON(json: any): ExtensionManual;
|
|
30
|
+
export declare function ExtensionManualFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtensionManual;
|
|
31
|
+
export declare function ExtensionManualToJSON(json: any): ExtensionManual;
|
|
32
|
+
export declare function ExtensionManualToJSONTyped(value?: ExtensionManual | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Picteus
|
|
5
|
+
* The Picteus API
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.3.0
|
|
8
|
+
* Contact: edouard@koppasoft.com
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Check if a given object implements the ExtensionManual interface.
|
|
16
|
+
*/
|
|
17
|
+
export function instanceOfExtensionManual(value) {
|
|
18
|
+
if (!('instructions' in value) || value['instructions'] === undefined)
|
|
19
|
+
return false;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
export function ExtensionManualFromJSON(json) {
|
|
23
|
+
return ExtensionManualFromJSONTyped(json, false);
|
|
24
|
+
}
|
|
25
|
+
export function ExtensionManualFromJSONTyped(json, ignoreDiscriminator) {
|
|
26
|
+
if (json == null) {
|
|
27
|
+
return json;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
'instructions': json['instructions'],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function ExtensionManualToJSON(json) {
|
|
34
|
+
return ExtensionManualToJSONTyped(json, false);
|
|
35
|
+
}
|
|
36
|
+
export function ExtensionManualToJSONTyped(value, ignoreDiscriminator = false) {
|
|
37
|
+
if (value == null) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
'instructions': value['instructions'],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -8,10 +8,12 @@ export * from './Dates.js';
|
|
|
8
8
|
export * from './Extension.js';
|
|
9
9
|
export * from './ExtensionActivity.js';
|
|
10
10
|
export * from './ExtensionActivityKind.js';
|
|
11
|
+
export * from './ExtensionAndManual.js';
|
|
11
12
|
export * from './ExtensionGenerationOptions.js';
|
|
12
13
|
export * from './ExtensionImageEmbeddings.js';
|
|
13
14
|
export * from './ExtensionImageFeature.js';
|
|
14
15
|
export * from './ExtensionImageTag.js';
|
|
16
|
+
export * from './ExtensionManual.js';
|
|
15
17
|
export * from './ExtensionSettings.js';
|
|
16
18
|
export * from './ExtensionStatus.js';
|
|
17
19
|
export * from './ExtensionsConfiguration.js';
|
|
@@ -10,10 +10,12 @@ export * from './Dates.js';
|
|
|
10
10
|
export * from './Extension.js';
|
|
11
11
|
export * from './ExtensionActivity.js';
|
|
12
12
|
export * from './ExtensionActivityKind.js';
|
|
13
|
+
export * from './ExtensionAndManual.js';
|
|
13
14
|
export * from './ExtensionGenerationOptions.js';
|
|
14
15
|
export * from './ExtensionImageEmbeddings.js';
|
|
15
16
|
export * from './ExtensionImageFeature.js';
|
|
16
17
|
export * from './ExtensionImageTag.js';
|
|
18
|
+
export * from './ExtensionManual.js';
|
|
17
19
|
export * from './ExtensionSettings.js';
|
|
18
20
|
export * from './ExtensionStatus.js';
|
|
19
21
|
export * from './ExtensionsConfiguration.js';
|
|
@@ -93,7 +93,7 @@ export declare class Logger {
|
|
|
93
93
|
readonly error: LeveledLogMethod;
|
|
94
94
|
}
|
|
95
95
|
declare class ExtensionParameters {
|
|
96
|
-
readonly apiKey
|
|
96
|
+
readonly apiKey?: string;
|
|
97
97
|
readonly extensionId: string;
|
|
98
98
|
readonly webServicesBaseUrl: string;
|
|
99
99
|
constructor(parameters: Record<string, any>);
|
|
@@ -116,6 +116,7 @@ export declare class Communicator {
|
|
|
116
116
|
launchIntent<T>(intent: NotificationsIntent): Promise<T>;
|
|
117
117
|
private sendMessage;
|
|
118
118
|
}
|
|
119
|
+
export type SettingsValue = Record<string, any>;
|
|
119
120
|
export declare class PicteusExtension {
|
|
120
121
|
static getSdkVersion(): string;
|
|
121
122
|
protected readonly logger: Logger;
|
|
@@ -132,11 +133,12 @@ export declare class PicteusExtension {
|
|
|
132
133
|
protected initialize(): Promise<boolean>;
|
|
133
134
|
protected onReady(communicator?: Communicator): Promise<void>;
|
|
134
135
|
protected onTerminate(): Promise<void>;
|
|
136
|
+
protected onSettings(communicator: Communicator, value: SettingsValue): Promise<void>;
|
|
135
137
|
protected onEvent(communicator: Communicator, event: string, value: NotificationValue): Promise<any>;
|
|
136
138
|
protected getRepositoryApi(): RepositoryApi;
|
|
137
139
|
protected getImageApi(): ImageApi;
|
|
138
140
|
protected getImageAttachmentApi(): ImageAttachmentApi;
|
|
139
|
-
protected getSettings(): Promise<
|
|
141
|
+
protected getSettings(): Promise<SettingsValue>;
|
|
140
142
|
private getParameters;
|
|
141
143
|
private connectSocket;
|
|
142
144
|
private disconnectSocket;
|
package/dist/picteusExtension.js
CHANGED
|
@@ -48,6 +48,7 @@ export var NotificationEvent;
|
|
|
48
48
|
NotificationEvent["ImageRunCommand"] = "image.runCommand";
|
|
49
49
|
NotificationEvent["TextComputeEmbeddings"] = "text.computeEmbeddings";
|
|
50
50
|
})(NotificationEvent || (NotificationEvent = {}));
|
|
51
|
+
const extensionSettingsEvent = "extension.settings";
|
|
51
52
|
const dateToString = (date) => {
|
|
52
53
|
function padNumber(number, length) {
|
|
53
54
|
return number.toString().padStart(length, "0");
|
|
@@ -64,7 +65,7 @@ const computeLeveledLogMethod = (logger, level) => {
|
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
67
|
export class Logger {
|
|
67
|
-
debug = computeLeveledLogMethod(this, "
|
|
68
|
+
debug = computeLeveledLogMethod(this, "log");
|
|
68
69
|
info = computeLeveledLogMethod(this, "info");
|
|
69
70
|
warn = computeLeveledLogMethod(this, "warn");
|
|
70
71
|
error = computeLeveledLogMethod(this, "error");
|
|
@@ -96,10 +97,13 @@ class MessageSender {
|
|
|
96
97
|
const contextId = this.contextId;
|
|
97
98
|
this.logger.debug(`Sending the message '${JSON.stringify(body)}' on channel '${channel}' for ${this.toString()}${contextId === undefined ? "" : ` attached to the context with id '${contextId}'`}${callback === undefined ? "" : " and waiting for a callback"}`);
|
|
98
99
|
const value = {
|
|
99
|
-
apiKey: this.parameters.apiKey,
|
|
100
100
|
extensionId: this.parameters.extensionId,
|
|
101
101
|
...body
|
|
102
102
|
};
|
|
103
|
+
// If there is no API key, we do not set it
|
|
104
|
+
if (this.parameters.apiKey !== undefined) {
|
|
105
|
+
value.apiKey = this.parameters.apiKey;
|
|
106
|
+
}
|
|
103
107
|
if (contextId !== undefined) {
|
|
104
108
|
value.contextId = contextId;
|
|
105
109
|
}
|
|
@@ -215,6 +219,9 @@ export class PicteusExtension {
|
|
|
215
219
|
}
|
|
216
220
|
async onTerminate() {
|
|
217
221
|
}
|
|
222
|
+
async onSettings(communicator, value) {
|
|
223
|
+
return Promise.resolve();
|
|
224
|
+
}
|
|
218
225
|
// noinspection JSUnusedLocalSymbols
|
|
219
226
|
async onEvent(communicator, event, value) {
|
|
220
227
|
}
|
|
@@ -262,10 +269,11 @@ export class PicteusExtension {
|
|
|
262
269
|
return this.toString();
|
|
263
270
|
}, contextId);
|
|
264
271
|
const communicator = new Communicator(this.logger, sender);
|
|
272
|
+
const isRegularEvent = channel !== extensionSettingsEvent;
|
|
265
273
|
let result;
|
|
266
274
|
let success = false;
|
|
267
275
|
try {
|
|
268
|
-
result = await this.onEvent(communicator, channel, value);
|
|
276
|
+
result = await (isRegularEvent === true ? this.onEvent(communicator, channel, value) : this.onSettings(communicator, value.value));
|
|
269
277
|
success = true;
|
|
270
278
|
}
|
|
271
279
|
catch (error) {
|
|
@@ -277,7 +285,7 @@ export class PicteusExtension {
|
|
|
277
285
|
finally {
|
|
278
286
|
sender.sendMessage(notificationsChannel, { acknowledgment: { success } });
|
|
279
287
|
}
|
|
280
|
-
if (result !== undefined && onResult !== undefined) {
|
|
288
|
+
if (isRegularEvent === true && result !== undefined && onResult !== undefined) {
|
|
281
289
|
onResult(result);
|
|
282
290
|
}
|
|
283
291
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picteus/extension-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"productName": "Picteus TypeScript SDK",
|
|
5
5
|
"description": "The Picteus extension TypeScript SDK.",
|
|
6
6
|
"keywords": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "Copyright (C) 2024 KoppaSoft. The code hereby is the private full property of the KoppaSoft company, Paris, France. You have no right to re-use or modify it. There are no open-source, nor free license attached to it!",
|
|
17
17
|
"private": false,
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=22.17.1"
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/picteus/Picteus.git",
|
|
22
22
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"./dist"
|
|
39
39
|
],
|
|
40
40
|
"scripts": {
|
|
41
|
-
"compile": "tsc && tsc-alias",
|
|
42
|
-
"
|
|
41
|
+
"compile": "tsc && tsc-alias --resolve-full-paths",
|
|
42
|
+
"compileWithTsup": "tsup src/index.ts --tsconfig tsconfig.json --format cjs,esm --dts --clean --minify-whitespace --minify-identifiers --minify-syntax"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "5.9.2",
|