@project-ajax/sdk 0.0.61 → 0.0.62
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.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/package.json +2 -6
- package/src/index.ts +0 -1
- package/dist/capabilities/slashCommand.d.ts +0 -56
- package/dist/capabilities/slashCommand.d.ts.map +0 -1
- package/dist/capabilities/slashCommand.js +0 -32
- package/src/capabilities/slashCommand.ts +0 -71
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { emojiIcon, notionIcon } from "./builder.js";
|
|
2
|
-
export { slashCommand } from "./capabilities/slashCommand.js";
|
|
3
2
|
export type { SyncConfiguration, SyncExecutionResult, SyncedObject, } from "./capabilities/sync.js";
|
|
4
3
|
export { sync } from "./capabilities/sync.js";
|
|
5
4
|
export { tool } from "./capabilities/tool.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EACX,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { emojiIcon, notionIcon } from "./builder.js";
|
|
2
|
-
import { slashCommand } from "./capabilities/slashCommand.js";
|
|
3
2
|
import { sync } from "./capabilities/sync.js";
|
|
4
3
|
import { tool } from "./capabilities/tool.js";
|
|
5
4
|
export {
|
|
6
5
|
emojiIcon,
|
|
7
6
|
notionIcon,
|
|
8
|
-
slashCommand,
|
|
9
7
|
sync,
|
|
10
8
|
tool
|
|
11
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@project-ajax/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"description": "An SDK for building workers for the Project Ajax platform",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -32,15 +32,11 @@
|
|
|
32
32
|
"./sync": {
|
|
33
33
|
"types": "./dist/capabilities/sync.d.ts",
|
|
34
34
|
"default": "./dist/capabilities/sync.js"
|
|
35
|
-
},
|
|
36
|
-
"./slashCommand": {
|
|
37
|
-
"types": "./dist/capabilities/slashCommand.d.ts",
|
|
38
|
-
"default": "./dist/capabilities/slashCommand.js"
|
|
39
35
|
}
|
|
40
36
|
},
|
|
41
37
|
"engines": {
|
|
42
38
|
"node": ">=22.0.0",
|
|
43
|
-
"npm": ">=10.9.
|
|
39
|
+
"npm": ">=10.9.2"
|
|
44
40
|
},
|
|
45
41
|
"publishConfig": {
|
|
46
42
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { Block } from "../block.js";
|
|
2
|
-
export type SlashCommandConfiguration = {
|
|
3
|
-
menuTitle: string;
|
|
4
|
-
menuDescription: string;
|
|
5
|
-
search: {
|
|
6
|
-
placeholder: string;
|
|
7
|
-
debounce: number;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* A function that returns a list of items to display in the search results
|
|
11
|
-
* as well as the corresponding blocks to insert for each item should it be selected.
|
|
12
|
-
*/
|
|
13
|
-
executeSearch: (searchQuery: string) => Promise<{
|
|
14
|
-
items: {
|
|
15
|
-
title: string;
|
|
16
|
-
description: string;
|
|
17
|
-
id: string;
|
|
18
|
-
}[];
|
|
19
|
-
}>;
|
|
20
|
-
executeSelect: (selectedItemId: string) => Promise<Block[]>;
|
|
21
|
-
};
|
|
22
|
-
export type SlashCommandHandlerResult = {
|
|
23
|
-
menuTitle: string;
|
|
24
|
-
menuDescription: string;
|
|
25
|
-
search: {
|
|
26
|
-
placeholder: string;
|
|
27
|
-
debounce: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Creates a special handler for handling slash commands.
|
|
32
|
-
*
|
|
33
|
-
* @param slashCommandConfiguration - The configuration for the slash command.
|
|
34
|
-
* @returns A handler function that executes the slash command function, and passes data
|
|
35
|
-
* needed to complete the operation back to the platform.
|
|
36
|
-
*/
|
|
37
|
-
export declare function slashCommand(slashCommandConfiguration: SlashCommandConfiguration): {
|
|
38
|
-
_tag: string;
|
|
39
|
-
config: {
|
|
40
|
-
menuTitle: string;
|
|
41
|
-
menuDescription: string;
|
|
42
|
-
search: {
|
|
43
|
-
placeholder: string;
|
|
44
|
-
debounce: number;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
handleSearch(searchQuery: string): Promise<{
|
|
48
|
-
items: {
|
|
49
|
-
title: string;
|
|
50
|
-
description: string;
|
|
51
|
-
id: string;
|
|
52
|
-
}[];
|
|
53
|
-
}>;
|
|
54
|
-
handleSelect(selectedItemId: string): Promise<Block[]>;
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=slashCommand.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slashCommand.d.ts","sourceRoot":"","sources":["../../src/capabilities/slashCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,MAAM,yBAAyB,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;;OAGG;IACH,aAAa,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;QAC/C,KAAK,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC5D,CAAC,CAAC;IACH,aAAa,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;CACF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,yBAAyB,EAAE,yBAAyB;;;;;;yBA/BtC,MAAM;sBACT,MAAM;;;8BAuCgB,MAAM;eA/B/B;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,EAAE;;iCA0CxB,MAAM;EAY1C"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ExecutionError } from "../error.js";
|
|
2
|
-
function slashCommand(slashCommandConfiguration) {
|
|
3
|
-
return {
|
|
4
|
-
_tag: "slashCommand",
|
|
5
|
-
config: {
|
|
6
|
-
menuTitle: slashCommandConfiguration.menuTitle,
|
|
7
|
-
menuDescription: slashCommandConfiguration.menuDescription,
|
|
8
|
-
search: slashCommandConfiguration.search
|
|
9
|
-
},
|
|
10
|
-
async handleSearch(searchQuery) {
|
|
11
|
-
const result = await slashCommandConfiguration.executeSearch(searchQuery).catch((err) => {
|
|
12
|
-
throw new ExecutionError(err);
|
|
13
|
-
});
|
|
14
|
-
process.stdout.write(`
|
|
15
|
-
<output>${JSON.stringify(result)}</output>
|
|
16
|
-
`);
|
|
17
|
-
return result;
|
|
18
|
-
},
|
|
19
|
-
async handleSelect(selectedItemId) {
|
|
20
|
-
const result = await slashCommandConfiguration.executeSelect(selectedItemId).catch((err) => {
|
|
21
|
-
throw new ExecutionError(err);
|
|
22
|
-
});
|
|
23
|
-
process.stdout.write(`
|
|
24
|
-
<output>${JSON.stringify(result)}</output>
|
|
25
|
-
`);
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
slashCommand
|
|
32
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { Block } from "../block.js";
|
|
2
|
-
import { ExecutionError } from "../error.js";
|
|
3
|
-
|
|
4
|
-
export type SlashCommandConfiguration = {
|
|
5
|
-
menuTitle: string;
|
|
6
|
-
menuDescription: string;
|
|
7
|
-
search: {
|
|
8
|
-
placeholder: string;
|
|
9
|
-
debounce: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A function that returns a list of items to display in the search results
|
|
14
|
-
* as well as the corresponding blocks to insert for each item should it be selected.
|
|
15
|
-
*/
|
|
16
|
-
executeSearch: (searchQuery: string) => Promise<{
|
|
17
|
-
items: { title: string; description: string; id: string }[];
|
|
18
|
-
}>;
|
|
19
|
-
executeSelect: (selectedItemId: string) => Promise<Block[]>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type SlashCommandHandlerResult = {
|
|
23
|
-
menuTitle: string;
|
|
24
|
-
menuDescription: string;
|
|
25
|
-
search: {
|
|
26
|
-
placeholder: string;
|
|
27
|
-
debounce: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates a special handler for handling slash commands.
|
|
33
|
-
*
|
|
34
|
-
* @param slashCommandConfiguration - The configuration for the slash command.
|
|
35
|
-
* @returns A handler function that executes the slash command function, and passes data
|
|
36
|
-
* needed to complete the operation back to the platform.
|
|
37
|
-
*/
|
|
38
|
-
export function slashCommand(
|
|
39
|
-
slashCommandConfiguration: SlashCommandConfiguration,
|
|
40
|
-
) {
|
|
41
|
-
return {
|
|
42
|
-
_tag: "slashCommand",
|
|
43
|
-
config: {
|
|
44
|
-
menuTitle: slashCommandConfiguration.menuTitle,
|
|
45
|
-
menuDescription: slashCommandConfiguration.menuDescription,
|
|
46
|
-
search: slashCommandConfiguration.search,
|
|
47
|
-
},
|
|
48
|
-
async handleSearch(searchQuery: string) {
|
|
49
|
-
const result = await slashCommandConfiguration
|
|
50
|
-
.executeSearch(searchQuery)
|
|
51
|
-
.catch((err) => {
|
|
52
|
-
throw new ExecutionError(err);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
process.stdout.write(`\n<output>${JSON.stringify(result)}</output>\n`);
|
|
56
|
-
|
|
57
|
-
return result;
|
|
58
|
-
},
|
|
59
|
-
async handleSelect(selectedItemId: string) {
|
|
60
|
-
const result = await slashCommandConfiguration
|
|
61
|
-
.executeSelect(selectedItemId)
|
|
62
|
-
.catch((err) => {
|
|
63
|
-
throw new ExecutionError(err);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
process.stdout.write(`\n<output>${JSON.stringify(result)}</output>\n`);
|
|
67
|
-
|
|
68
|
-
return result;
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|