@activepieces/piece-muna-ai 0.0.1
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/package.json +17 -0
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +32 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-prediction.d.ts +8 -0
- package/src/lib/actions/create-prediction.d.ts.map +1 -0
- package/src/lib/actions/create-prediction.js +78 -0
- package/src/lib/actions/create-prediction.js.map +1 -0
- package/src/lib/auth.d.ts +2 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +10 -0
- package/src/lib/auth.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-muna-ai",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@activepieces/pieces-common": "0.12.3",
|
|
9
|
+
"@activepieces/pieces-framework": "0.30.0",
|
|
10
|
+
"@activepieces/shared": "0.86.0",
|
|
11
|
+
"tslib": "2.6.2"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM,mHAmBjB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.munaAi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const auth_1 = require("./lib/auth");
|
|
9
|
+
const create_prediction_1 = require("./lib/actions/create-prediction");
|
|
10
|
+
exports.munaAi = (0, pieces_framework_1.createPiece)({
|
|
11
|
+
displayName: 'Muna',
|
|
12
|
+
description: 'Run on-device AI predictions using Muna predictors.',
|
|
13
|
+
auth: auth_1.munaAiAuth,
|
|
14
|
+
minimumSupportedRelease: '0.36.1',
|
|
15
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/muna-ai.png',
|
|
16
|
+
categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
|
17
|
+
authors: ['sanket-a11y'],
|
|
18
|
+
actions: [
|
|
19
|
+
create_prediction_1.createPrediction,
|
|
20
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
21
|
+
baseUrl: () => 'https://api.muna.ai/v1',
|
|
22
|
+
auth: auth_1.munaAiAuth,
|
|
23
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
return ({
|
|
25
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
triggers: [],
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,qCAAwC;AACxC,uEAAmE;AAEtD,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,qDAAqD;IAClE,IAAI,EAAE,iBAAU;IAChB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,oCAAgB;QAChB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,wBAAwB;YACvC,IAAI,EAAE,iBAAU;YAChB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const createPrediction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
tag: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
configurationId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
deviceId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
predictionId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=create-prediction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-prediction.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-prediction.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;;;;EA2E3B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPrediction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
exports.createPrediction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'create_prediction',
|
|
10
|
+
displayName: 'Create Prediction',
|
|
11
|
+
description: 'Run a predictor and get back prediction resources.',
|
|
12
|
+
auth: auth_1.munaAiAuth,
|
|
13
|
+
props: {
|
|
14
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Predictor Tag',
|
|
16
|
+
description: 'The tag of the predictor to run (e.g. `@org/my-model`).',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
clientId: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Client ID',
|
|
21
|
+
description: 'A unique identifier for the client making the prediction. Used to track usage per device or user.',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
configurationId: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Configuration ID',
|
|
26
|
+
description: 'Optional predictor configuration identifier.',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
deviceId: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Device ID',
|
|
31
|
+
description: 'Optional device identifier. Muna uses this to choose the optimal implementation to respond with.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
predictionId: pieces_framework_1.Property.ShortText({
|
|
35
|
+
displayName: 'Prediction ID',
|
|
36
|
+
description: 'For embedded predictors — providing the original prediction ID ensures the same implementation is delivered.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
run(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
var _a;
|
|
43
|
+
const { tag, clientId, configurationId, deviceId, predictionId } = context.propsValue;
|
|
44
|
+
const body = { tag, clientId };
|
|
45
|
+
if (configurationId)
|
|
46
|
+
body['configurationId'] = configurationId;
|
|
47
|
+
if (deviceId)
|
|
48
|
+
body['deviceId'] = deviceId;
|
|
49
|
+
if (predictionId)
|
|
50
|
+
body['predictionId'] = predictionId;
|
|
51
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
52
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
53
|
+
url: 'https://api.muna.ai/v1/predictions',
|
|
54
|
+
headers: {
|
|
55
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
},
|
|
58
|
+
body,
|
|
59
|
+
});
|
|
60
|
+
const prediction = response.body;
|
|
61
|
+
return {
|
|
62
|
+
id: prediction.id,
|
|
63
|
+
tag: prediction.tag,
|
|
64
|
+
configuration: (_a = prediction.configuration) !== null && _a !== void 0 ? _a : null,
|
|
65
|
+
created: prediction.created,
|
|
66
|
+
resources: prediction.resources.map((r) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return ({
|
|
69
|
+
type: r.type,
|
|
70
|
+
url: r.url,
|
|
71
|
+
name: (_a = r.name) !== null && _a !== void 0 ? _a : null,
|
|
72
|
+
});
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=create-prediction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-prediction.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-prediction.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,kCAAqC;AAExB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,oDAAoD;IACjE,IAAI,EAAE,iBAAU;IAChB,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,eAAe;YAC5B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kB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,MAAM,UAAU,GAAG,QAAQ,CAAC,IAM3B,CAAC;YAEF,OAAO;gBACL,EAAE,EAAE,UAAU,CAAC,EAAE;gBACjB,GAAG,EAAE,UAAU,CAAC,GAAG;gBACnB,aAAa,EAAE,MAAA,UAAU,CAAC,aAAa,mCAAI,IAAI;gBAC/C,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;;oBAAC,OAAA,CAAC;wBAC1C,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,GAAG,EAAE,CAAC,CAAC,GAAG;wBACV,IAAI,EAAE,MAAA,CAAC,CAAC,IAAI,mCAAI,IAAI;qBACrB,CAAC,CAAA;iBAAA,CAAC;aACJ,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,mEAKrB,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.munaAiAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
exports.munaAiAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
6
|
+
displayName: 'API Key',
|
|
7
|
+
description: 'Go to [Muna Settings → Developer](https://muna.ai/settings/developer) to generate an access key.',
|
|
8
|
+
required: true,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAE9C,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,kGAAkG;IACpG,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
|