@dainprotocol/service-sdk 1.0.10 → 1.0.12
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/__tests__/integration.test.js +5 -5
- package/dist/__tests__/integration.test.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/service/cloudflareService.d.ts +3 -0
- package/dist/service/cloudflareService.js +19 -0
- package/dist/service/cloudflareService.js.map +1 -0
- package/dist/service/denoService.d.ts +3 -0
- package/dist/service/denoService.js +31 -0
- package/dist/service/denoService.js.map +1 -0
- package/dist/service/index.d.ts +7 -3
- package/dist/service/index.js +13 -5
- package/dist/service/index.js.map +1 -1
- package/dist/service/nodeService.d.ts +5 -0
- package/dist/service/nodeService.js +41 -0
- package/dist/service/nodeService.js.map +1 -0
- package/dist/service/service.d.ts +6 -2
- package/dist/service/service.js +5 -50
- package/dist/service/service.js.map +1 -1
- package/dist/service/types.d.ts +1 -0
- package/package.json +49 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
//File: src/___tests___/integration.test.ts
|
|
5
|
-
const
|
|
5
|
+
const nodeService_1 = require("../service/nodeService");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
7
|
const supertest_1 = tslib_1.__importDefault(require("supertest"));
|
|
8
8
|
const ed25519_1 = require("@noble/curves/ed25519");
|
|
@@ -25,7 +25,7 @@ describe("DAIN Framework Integration", () => {
|
|
|
25
25
|
const dainConnection = new client_1.DainServiceConnection(
|
|
26
26
|
//agent URI
|
|
27
27
|
"http://localhost:3003", agentAuth);
|
|
28
|
-
const weatherTool = (0,
|
|
28
|
+
const weatherTool = (0, nodeService_1.createTool)({
|
|
29
29
|
id: "get-weather",
|
|
30
30
|
name: "Get Weather",
|
|
31
31
|
description: "Fetches weather for a city",
|
|
@@ -38,7 +38,7 @@ describe("DAIN Framework Integration", () => {
|
|
|
38
38
|
ui: null
|
|
39
39
|
}),
|
|
40
40
|
});
|
|
41
|
-
const weatherService = (0,
|
|
41
|
+
const weatherService = (0, nodeService_1.createService)({
|
|
42
42
|
id: "weather-service",
|
|
43
43
|
name: "Weather Service",
|
|
44
44
|
description: "Provides weather information",
|
|
@@ -49,7 +49,7 @@ describe("DAIN Framework Integration", () => {
|
|
|
49
49
|
recommendedPrompt: "Ask about the weather",
|
|
50
50
|
recommendedTools: ["get-weather"],
|
|
51
51
|
});
|
|
52
|
-
const weatherToolbox = (0,
|
|
52
|
+
const weatherToolbox = (0, nodeService_1.createToolbox)({
|
|
53
53
|
id: "weather-toolbox",
|
|
54
54
|
name: "Weather Toolbox",
|
|
55
55
|
description: "Collection of weather tools",
|
|
@@ -60,7 +60,7 @@ describe("DAIN Framework Integration", () => {
|
|
|
60
60
|
},
|
|
61
61
|
recommendedPrompt: "Use these tools for weather-related tasks",
|
|
62
62
|
});
|
|
63
|
-
const dainService = (0,
|
|
63
|
+
const dainService = (0, nodeService_1.defineDAINService)({
|
|
64
64
|
metadata: {
|
|
65
65
|
title: "Weather DAIN Service",
|
|
66
66
|
description: "A DAIN service for weather information",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.test.js","sourceRoot":"","sources":["../../src/__tests__/integration.test.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"integration.test.js","sourceRoot":"","sources":["../../src/__tests__/integration.test.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,wDAKgC;AAChC,6BAAwB;AACxB,kEAAgC;AAChC,mDAAgD;AAChD,wDAAwB;AACxB,mEAA0E;AAC1E,2DAAmE;AACnE,sDAAsD;AACtD,4CAAwD;AAExD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,UAAU,GAAG,iBAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE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B,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAElC,mDAAmD;YACnD,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACzD,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAClE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;YAExE,sDAAsD;YACtD,MAAM,oBAAoB,GAAG,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC;gBAC7D,IAAI,EAAE,OAAO;aACd,CAAC,CAAC;YACH,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEhD,gEAAgE;YAChE,MAAM,CAAC,WAAW,CAAC,OAAO,YAAY,OAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CoreUtils = exports.createToolbox = exports.createService = exports.createTool = exports.DAINServiceClient = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
|
|
5
|
+
tslib_1.__exportStar(require("./service"), exports);
|
|
6
6
|
exports.DAINServiceClient = tslib_1.__importStar(require("./client"));
|
|
7
|
+
// Explicitly re-export the utility functions
|
|
8
|
+
var service_1 = require("./service");
|
|
9
|
+
Object.defineProperty(exports, "createTool", { enumerable: true, get: function () { return service_1.createTool; } });
|
|
10
|
+
Object.defineProperty(exports, "createService", { enumerable: true, get: function () { return service_1.createService; } });
|
|
11
|
+
Object.defineProperty(exports, "createToolbox", { enumerable: true, get: function () { return service_1.createToolbox; } });
|
|
12
|
+
Object.defineProperty(exports, "CoreUtils", { enumerable: true, get: function () { return service_1.CoreUtils; } });
|
|
13
|
+
// If you want to keep the previous naming convention, you can do:
|
|
14
|
+
// export * as DAINService from './service';
|
|
15
|
+
// This will create a namespace DAINService containing all exports from './service'
|
|
7
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,oDAA0B;AAC1B,sEAA8C;AAE9C,6CAA6C;AAC7C,qCAAgF;AAAvE,qGAAA,UAAU,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,oGAAA,SAAS,OAAA;AAE5D,kEAAkE;AAClE,4CAA4C;AAC5C,mFAAmF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineDAINService = defineDAINService;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const service_1 = require("./service");
|
|
6
|
+
function defineDAINService(config) {
|
|
7
|
+
const baseService = (0, service_1.createBaseDAINService)(config);
|
|
8
|
+
const startWorkers = () => {
|
|
9
|
+
const service = baseService.startService();
|
|
10
|
+
console.log(`DAIN Service exported to cloudflare workers with version ${config.metadata.version}`);
|
|
11
|
+
return service.fetch;
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
...baseService,
|
|
15
|
+
startWorkers,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
19
|
+
//# sourceMappingURL=cloudflareService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflareService.js","sourceRoot":"","sources":["../../src/service/cloudflareService.ts"],"names":[],"mappings":";;AAIA,8CAgBC;;AAnBD,uCAAkD;AAGlD,SAAgB,iBAAiB,CAAC,MAAyB;IACzD,MAAM,WAAW,GAAG,IAAA,+BAAqB,EAAC,MAAM,CAAC,CAAC;IAElD,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,MAAM,OAAO,GAAG,WAAW,CAAC,YAAa,EAAE,CAAC;QAC5C,OAAO,CAAC,GAAG,CACT,4DAA4D,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CACtF,CAAC;QAEF,OAAO,OAAO,CAAC,KAAK,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,WAAW;QACd,YAAY;KACE,CAAC;AACnB,CAAC;AAED,kDAAwB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineDAINService = defineDAINService;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const service_1 = require("./service");
|
|
6
|
+
function defineDAINService(config) {
|
|
7
|
+
const baseService = (0, service_1.createBaseDAINService)(config);
|
|
8
|
+
const startDeno = async (options = {
|
|
9
|
+
port: 8787,
|
|
10
|
+
}) => {
|
|
11
|
+
const service = baseService.startService();
|
|
12
|
+
const { port } = options;
|
|
13
|
+
//@ts-ignore Deno.listen is not yet typed if not in a Deno environment
|
|
14
|
+
const server = Deno.listen({ port });
|
|
15
|
+
console.log(`Server is listening on port ${port} -- Deno Environment`);
|
|
16
|
+
console.log(`DAIN Service is running on version ${config.metadata.version}`);
|
|
17
|
+
return {
|
|
18
|
+
address: () => ({ port }),
|
|
19
|
+
shutdown: async () => {
|
|
20
|
+
console.log("Shutting down DAIN service...");
|
|
21
|
+
server.close();
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
...baseService,
|
|
27
|
+
startDeno,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
31
|
+
//# sourceMappingURL=denoService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"denoService.js","sourceRoot":"","sources":["../../src/service/denoService.ts"],"names":[],"mappings":";;AAIA,8CA8BC;;AAjCD,uCAAkD;AAGlD,SAAgB,iBAAiB,CAAC,MAAyB;IACzD,MAAM,WAAW,GAAG,IAAA,+BAAqB,EAAC,MAAM,CAAC,CAAC;IAElD,MAAM,SAAS,GAAG,KAAK,EACrB,UAA6B;QAC3B,IAAI,EAAE,IAAI;KACX,EACD,EAAE;QACF,MAAM,OAAO,GAAG,WAAW,CAAC,YAAa,EAAE,CAAC;QAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QAEzB,sEAAsE;QACtE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAErC,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,sBAAsB,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,sCAAsC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7E,OAAO;YACL,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;YACzB,QAAQ,EAAE,KAAK,IAAI,EAAE;gBACnB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;gBAC7C,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,WAAW;QACd,SAAS;KACK,CAAC;AACnB,CAAC;AAED,kDAAwB"}
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { DAINServiceConfig, DAINService } from "./types";
|
|
2
|
+
import { defineDAINService as defineNodeService } from "./nodeService";
|
|
3
|
+
import { defineDAINService as defineDenoService } from "./denoService";
|
|
4
|
+
import { defineDAINService as defineCloudflareService } from "./cloudflareService";
|
|
5
|
+
import { createTool, createService, createToolbox, CoreUtils } from "./core";
|
|
6
|
+
export declare const defineDAINService: (config: DAINServiceConfig) => DAINService;
|
|
7
|
+
export { defineNodeService, defineDenoService, defineCloudflareService, createTool, createService, createToolbox, CoreUtils };
|
|
3
8
|
export * from './types';
|
|
4
|
-
export * from './auth';
|
package/dist/service/index.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File: src/service/index.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.CoreUtils = exports.createToolbox = exports.createService = exports.createTool = exports.defineDAINService = void 0;
|
|
4
|
+
exports.CoreUtils = exports.createToolbox = exports.createService = exports.createTool = exports.defineCloudflareService = exports.defineDenoService = exports.defineNodeService = exports.defineDAINService = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
|
|
6
|
+
const nodeService_1 = require("./nodeService");
|
|
7
|
+
Object.defineProperty(exports, "defineNodeService", { enumerable: true, get: function () { return nodeService_1.defineDAINService; } });
|
|
8
|
+
const denoService_1 = require("./denoService");
|
|
9
|
+
Object.defineProperty(exports, "defineDenoService", { enumerable: true, get: function () { return denoService_1.defineDAINService; } });
|
|
10
|
+
const cloudflareService_1 = require("./cloudflareService");
|
|
11
|
+
Object.defineProperty(exports, "defineCloudflareService", { enumerable: true, get: function () { return cloudflareService_1.defineDAINService; } });
|
|
12
|
+
const core_1 = require("./core");
|
|
9
13
|
Object.defineProperty(exports, "createTool", { enumerable: true, get: function () { return core_1.createTool; } });
|
|
10
14
|
Object.defineProperty(exports, "createService", { enumerable: true, get: function () { return core_1.createService; } });
|
|
11
15
|
Object.defineProperty(exports, "createToolbox", { enumerable: true, get: function () { return core_1.createToolbox; } });
|
|
12
16
|
Object.defineProperty(exports, "CoreUtils", { enumerable: true, get: function () { return core_1.CoreUtils; } });
|
|
17
|
+
const defineDAINService = (config) => {
|
|
18
|
+
throw new Error("This is a fallback implementation. Use the appropriate runtime-specific import.");
|
|
19
|
+
};
|
|
20
|
+
exports.defineDAINService = defineDAINService;
|
|
21
|
+
// Re-export all types
|
|
13
22
|
tslib_1.__exportStar(require("./types"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./auth"), exports);
|
|
15
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;;AAG7B,+CAAuE;AAUrE,kGAV4B,+BAAiB,OAU5B;AATnB,+CAAuE;AAUrE,kGAV4B,+BAAiB,OAU5B;AATnB,2DAAmF;AAUjF,wGAV4B,qCAAuB,OAU5B;AATzB,iCAA6E;AAU3E,2FAVO,iBAAU,OAUP;AACV,8FAXmB,oBAAa,OAWnB;AACb,8FAZkC,oBAAa,OAYlC;AACb,0FAbiD,gBAAS,OAajD;AAXJ,MAAM,iBAAiB,GAAG,CAAC,MAAyB,EAAe,EAAE;IAC1E,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;AACrG,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAYF,sBAAsB;AACtB,kDAAwB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DAINServiceConfig, DAINService } from "./types";
|
|
2
|
+
import { createTool, createService, createToolbox, CoreUtils } from "./core";
|
|
3
|
+
export declare function defineDAINService(config: DAINServiceConfig): DAINService;
|
|
4
|
+
export { createTool, createService, createToolbox, CoreUtils };
|
|
5
|
+
export * from './types';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoreUtils = exports.createToolbox = exports.createService = exports.createTool = void 0;
|
|
4
|
+
exports.defineDAINService = defineDAINService;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const service_1 = require("./service");
|
|
7
|
+
const core_1 = require("./core");
|
|
8
|
+
Object.defineProperty(exports, "createTool", { enumerable: true, get: function () { return core_1.createTool; } });
|
|
9
|
+
Object.defineProperty(exports, "createService", { enumerable: true, get: function () { return core_1.createService; } });
|
|
10
|
+
Object.defineProperty(exports, "createToolbox", { enumerable: true, get: function () { return core_1.createToolbox; } });
|
|
11
|
+
Object.defineProperty(exports, "CoreUtils", { enumerable: true, get: function () { return core_1.CoreUtils; } });
|
|
12
|
+
function defineDAINService(config) {
|
|
13
|
+
const baseService = (0, service_1.createBaseDAINService)(config);
|
|
14
|
+
const startNode = async (options = {
|
|
15
|
+
port: 3000,
|
|
16
|
+
}) => {
|
|
17
|
+
const { port } = options;
|
|
18
|
+
const { serve } = await Promise.resolve().then(() => tslib_1.__importStar(require("@hono/node-server")));
|
|
19
|
+
const service = baseService.startService();
|
|
20
|
+
const server = serve({
|
|
21
|
+
fetch: service.fetch,
|
|
22
|
+
port
|
|
23
|
+
});
|
|
24
|
+
console.log(`Server is listening on port ${port} -- Node Environment`);
|
|
25
|
+
console.log(`DAIN Service is running on version ${config.metadata.version}`);
|
|
26
|
+
return {
|
|
27
|
+
address: () => ({ port }),
|
|
28
|
+
shutdown: async () => {
|
|
29
|
+
console.log("Shutting down DAIN service...");
|
|
30
|
+
server.close();
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
...baseService,
|
|
36
|
+
startNode,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Re-export all types
|
|
40
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
41
|
+
//# sourceMappingURL=nodeService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeService.js","sourceRoot":"","sources":["../../src/service/nodeService.ts"],"names":[],"mappings":";;;AAKA,8CAiCC;;AArCD,uCAAkD;AAClD,iCAA6E;AAsCpE,2FAtCA,iBAAU,OAsCA;AAAE,8FAtCA,oBAAa,OAsCA;AAAE,8FAtCA,oBAAa,OAsCA;AAAE,0FAtCA,gBAAS,OAsCA;AAnC5D,SAAgB,iBAAiB,CAAC,MAAyB;IACzD,MAAM,WAAW,GAAG,IAAA,+BAAqB,EAAC,MAAM,CAAC,CAAC;IAElD,MAAM,SAAS,GAAG,KAAK,EACrB,UAA6B;QAC3B,IAAI,EAAE,IAAI;KACX,EACD,EAAE;QACF,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,MAAM,EAAE,KAAK,EAAE,GAAG,gEAAa,mBAAmB,GAAC,CAAC;QACpD,MAAM,OAAO,GAAG,WAAW,CAAC,YAAa,EAAE,CAAC;QAE5C,MAAM,MAAM,GAAG,KAAK,CAAC;YACnB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI;SACL,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,sBAAsB,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,sCAAsC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7E,OAAO;YACL,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;YACzB,QAAQ,EAAE,KAAK,IAAI,EAAE;gBACnB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;gBAC7C,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,WAAW;QACd,SAAS;KACK,CAAC;AACnB,CAAC;AAKC,sBAAsB;AACtB,kDAAwB"}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { DAINServiceConfig, DAINService } from "./types";
|
|
2
|
-
|
|
1
|
+
import { DAINServiceConfig, DAINService, Identity } from "./types";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
export declare function parseApiKey(apiKey: string): Identity;
|
|
4
|
+
export declare function createBaseDAINService(config: DAINServiceConfig): Partial<DAINService> & {
|
|
5
|
+
startService: () => Hono;
|
|
6
|
+
};
|
package/dist/service/service.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File: src/service/service.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.parseApiKey = parseApiKey;
|
|
5
|
+
exports.createBaseDAINService = createBaseDAINService;
|
|
5
6
|
const tslib_1 = require("tslib");
|
|
6
7
|
const core_1 = require("./core");
|
|
7
8
|
const server_1 = require("./server");
|
|
@@ -25,7 +26,7 @@ function parseApiKey(apiKey) {
|
|
|
25
26
|
publicKey: bs58_1.default.encode(publicKey), // Assuming the public key is the first 32 bytes
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function createBaseDAINService(config) {
|
|
29
30
|
let identity;
|
|
30
31
|
if (config.identity.apiKey) {
|
|
31
32
|
identity = parseApiKey(config.identity.apiKey);
|
|
@@ -43,51 +44,8 @@ function defineDAINService(config) {
|
|
|
43
44
|
const tools = config.tools.map((toolConfig) => (0, core_1.createTool)(toolConfig));
|
|
44
45
|
const services = config.services.map((serviceConfig) => (0, core_1.createService)(serviceConfig));
|
|
45
46
|
const toolboxes = config.toolboxes.map((toolboxConfig) => (0, core_1.createToolbox)(toolboxConfig));
|
|
46
|
-
// Validate and sanitize metadata
|
|
47
47
|
config.metadata.tags = core_1.CoreUtils.sanitizeTags(config.metadata.tags);
|
|
48
48
|
let app;
|
|
49
|
-
const startWorkers = () => {
|
|
50
|
-
const service = startService();
|
|
51
|
-
console.log(`DAIN Service exported to cloudflare workers with version ${config.metadata.version}`);
|
|
52
|
-
return service.fetch;
|
|
53
|
-
};
|
|
54
|
-
const startNode = async (options = {
|
|
55
|
-
port: 3000,
|
|
56
|
-
}) => {
|
|
57
|
-
const { port } = options;
|
|
58
|
-
const { serve } = await Promise.resolve().then(() => tslib_1.__importStar(require("@hono/node-server")));
|
|
59
|
-
const service = await startService();
|
|
60
|
-
const server = serve({
|
|
61
|
-
fetch: service.fetch,
|
|
62
|
-
port
|
|
63
|
-
});
|
|
64
|
-
console.log(`Server is listening on port ${port} -- Node Environment`);
|
|
65
|
-
console.log(`DAIN Service is running on version ${config.metadata.version}`);
|
|
66
|
-
return {
|
|
67
|
-
address: () => ({ port }),
|
|
68
|
-
shutdown: async () => {
|
|
69
|
-
console.log("Shutting down DAIN service...");
|
|
70
|
-
server.close();
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
const startDeno = async (options = {
|
|
75
|
-
port: 8787,
|
|
76
|
-
}) => {
|
|
77
|
-
const service = await startService();
|
|
78
|
-
const { port } = options;
|
|
79
|
-
//@ts-ignore Deno.listen is not yet typed if not in a Deno environment
|
|
80
|
-
const server = Deno.listen({ port });
|
|
81
|
-
console.log(`Server is listening on port ${port} -- Deno Environment`);
|
|
82
|
-
console.log(`DAIN Service is running on version ${config.metadata.version}`);
|
|
83
|
-
return {
|
|
84
|
-
address: () => ({ port }),
|
|
85
|
-
shutdown: async () => {
|
|
86
|
-
console.log("Shutting down DAIN service...");
|
|
87
|
-
server.close();
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
49
|
const startService = function () {
|
|
92
50
|
const privateKey = bs58_1.default.decode(identity.privateKey);
|
|
93
51
|
app = (0, server_1.setupHttpServer)({ ...config, identity }, tools, services, toolboxes, config.metadata, privateKey);
|
|
@@ -100,7 +58,7 @@ function defineDAINService(config) {
|
|
|
100
58
|
const findTool = (toolId) => tools.find((tool) => tool.id === toolId);
|
|
101
59
|
const findToolbox = (toolboxId) => toolboxes.find((toolbox) => toolbox.id === toolboxId);
|
|
102
60
|
const findService = (serviceId) => services.find((service) => service.id === serviceId);
|
|
103
|
-
|
|
61
|
+
return {
|
|
104
62
|
getMetadata,
|
|
105
63
|
getServices,
|
|
106
64
|
getTools,
|
|
@@ -109,10 +67,7 @@ function defineDAINService(config) {
|
|
|
109
67
|
findToolbox,
|
|
110
68
|
findService,
|
|
111
69
|
app,
|
|
112
|
-
|
|
113
|
-
startDeno,
|
|
114
|
-
startWorkers,
|
|
70
|
+
startService,
|
|
115
71
|
};
|
|
116
|
-
return dainService;
|
|
117
72
|
}
|
|
118
73
|
//# sourceMappingURL=service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/service/service.ts"],"names":[],"mappings":";AAAA,+BAA+B;;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/service/service.ts"],"names":[],"mappings":";AAAA,+BAA+B;;AAgB/B,kCAwBC;AAED,sDAmEC;;AAlGD,iCAA6E;AAC7E,qCAA2C;AAC3C,wDAAwB;AAGxB,SAAgB,WAAW,CAAC,MAAc;IACxC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3C,M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C,EAAE,KAAK,MAAM,CAAC,CAAC;IAE3C,MAAM,WAAW,GAAG,CAAC,SAAiB,EAA6B,EAAE,CACnE,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;IAExD,MAAM,WAAW,GAAG,CAAC,SAAiB,EAA6B,EAAE,CACnE,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;IAEvD,OAAO;QACL,WAAW;QACX,WAAW;QACX,QAAQ;QACR,YAAY;QACZ,QAAQ;QACR,WAAW;QACX,WAAW;QACX,GAAG;QACH,YAAY;KACb,CAAC;AACJ,CAAC"}
|
package/dist/service/types.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export interface DAINService {
|
|
|
76
76
|
findToolbox: (toolboxId: string) => ToolboxConfig | undefined;
|
|
77
77
|
findService: (serviceId: string) => ServiceConfig | undefined;
|
|
78
78
|
app: Hono;
|
|
79
|
+
startService: () => Hono;
|
|
79
80
|
}
|
|
80
81
|
export type DAINServiceConfig = {
|
|
81
82
|
metadata: Metadata;
|
package/package.json
CHANGED
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dainprotocol/service-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "DAIN Service SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
".": {
|
|
9
|
+
"node": {
|
|
10
|
+
"types": "./dist/service/nodeService.d.ts",
|
|
11
|
+
"default": "./dist/service/nodeService.js"
|
|
12
|
+
},
|
|
13
|
+
"workerd": {
|
|
14
|
+
"types": "./dist/service/cloudflareService.d.ts",
|
|
15
|
+
"default": "./dist/service/cloudflareService.js"
|
|
16
|
+
},
|
|
17
|
+
"deno": {
|
|
18
|
+
"types": "./dist/service/denoService.d.ts",
|
|
19
|
+
"default": "./dist/service/denoService.js"
|
|
20
|
+
},
|
|
21
|
+
"default": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./client": {
|
|
27
|
+
"types": "./dist/client/index.d.ts",
|
|
28
|
+
"default": "./dist/client/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./service": {
|
|
31
|
+
"node": {
|
|
32
|
+
"types": "./dist/service/nodeService.d.ts",
|
|
33
|
+
"default": "./dist/service/nodeService.js"
|
|
34
|
+
},
|
|
35
|
+
"workerd": {
|
|
36
|
+
"types": "./dist/service/cloudflareService.d.ts",
|
|
37
|
+
"default": "./dist/service/cloudflareService.js"
|
|
38
|
+
},
|
|
39
|
+
"deno": {
|
|
40
|
+
"types": "./dist/service/denoService.d.ts",
|
|
41
|
+
"default": "./dist/service/denoService.js"
|
|
42
|
+
},
|
|
43
|
+
"default": {
|
|
44
|
+
"types": "./dist/service/index.d.ts",
|
|
45
|
+
"default": "./dist/service/index.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"./client/*": {
|
|
49
|
+
"types": "./dist/client/*.d.ts",
|
|
50
|
+
"default": "./dist/client/*.js"
|
|
51
|
+
},
|
|
52
|
+
"./service/*": {
|
|
53
|
+
"types": "./dist/service/*.d.ts",
|
|
54
|
+
"default": "./dist/service/*.js"
|
|
55
|
+
}
|
|
13
56
|
},
|
|
14
57
|
"typesVersions": {
|
|
15
58
|
"*": {
|