@ha-bits/cortex 1.1.10 → 1.1.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/pack/index.cjs +463 -27
- package/package.json +1 -1
package/pack/index.cjs
CHANGED
|
@@ -238491,6 +238491,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
238491
238491
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
238492
238492
|
var __getProtoOf = Object.getPrototypeOf;
|
|
238493
238493
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
238494
|
+
var __export = (target, all) => {
|
|
238495
|
+
for (var name in all)
|
|
238496
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
238497
|
+
};
|
|
238494
238498
|
var __copyProps = (to, from, except, desc) => {
|
|
238495
238499
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
238496
238500
|
for (let key of __getOwnPropNames(from))
|
|
@@ -238507,14 +238511,66 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
238507
238511
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
238508
238512
|
mod
|
|
238509
238513
|
));
|
|
238514
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
238510
238515
|
|
|
238511
|
-
// packages/cortex/server/src/
|
|
238512
|
-
var
|
|
238513
|
-
|
|
238514
|
-
|
|
238515
|
-
|
|
238516
|
-
|
|
238517
|
-
|
|
238516
|
+
// packages/cortex/server/src/main.ts
|
|
238517
|
+
var main_exports = {};
|
|
238518
|
+
__export(main_exports, {
|
|
238519
|
+
AuthenticationType: () => AuthenticationType,
|
|
238520
|
+
BitAuth: () => BitAuth,
|
|
238521
|
+
HttpMethod: () => HttpMethod,
|
|
238522
|
+
ManageModule: () => ManageModule,
|
|
238523
|
+
PieceAuth: () => PieceAuth,
|
|
238524
|
+
PieceCategory: () => PieceCategory,
|
|
238525
|
+
Property: () => Property,
|
|
238526
|
+
StoreScope: () => StoreScope,
|
|
238527
|
+
TriggerStrategy: () => TriggerStrategy3,
|
|
238528
|
+
WorkflowExecutor: () => WorkflowExecutor,
|
|
238529
|
+
WorkflowExecutorServer: () => WorkflowExecutorServer,
|
|
238530
|
+
createAction: () => createAction,
|
|
238531
|
+
createBit: () => createBit,
|
|
238532
|
+
createBitAction: () => createBitAction,
|
|
238533
|
+
createBitTrigger: () => createBitTrigger,
|
|
238534
|
+
createCustomApiCallAction: () => createCustomApiCallAction,
|
|
238535
|
+
createPiece: () => createPiece,
|
|
238536
|
+
createTrigger: () => createTrigger,
|
|
238537
|
+
customRequire: () => customRequire,
|
|
238538
|
+
generateOpenAPISpec: () => generateOpenAPISpec,
|
|
238539
|
+
httpClient: () => httpClient,
|
|
238540
|
+
isFrontendWorkflow: () => isFrontendWorkflow,
|
|
238541
|
+
registerCortexModule: () => registerCortexModule,
|
|
238542
|
+
setupManageRoutes: () => setupManageRoutes,
|
|
238543
|
+
setupOpenAPIRoutes: () => setupOpenAPIRoutes,
|
|
238544
|
+
startServer: () => startServer
|
|
238545
|
+
});
|
|
238546
|
+
module.exports = __toCommonJS(main_exports);
|
|
238547
|
+
|
|
238548
|
+
// packages/cortex/server/src/WorkflowExecutor.ts
|
|
238549
|
+
var import_express = __toESM(__nccwpck_require__(85152));
|
|
238550
|
+
var fs9 = __toESM(__nccwpck_require__(79896));
|
|
238551
|
+
var path15 = __toESM(__nccwpck_require__(16928));
|
|
238552
|
+
var import_uuid = __nccwpck_require__(12048);
|
|
238553
|
+
var yaml = __toESM(__nccwpck_require__(38815));
|
|
238554
|
+
|
|
238555
|
+
// packages/cortex/server/src/utils/moduleLoader.ts
|
|
238556
|
+
var path6 = __toESM(__nccwpck_require__(16928));
|
|
238557
|
+
|
|
238558
|
+
// packages/cortex/server/src/utils/moduleCloner.ts
|
|
238559
|
+
var fs5 = __toESM(__nccwpck_require__(79896));
|
|
238560
|
+
var path5 = __toESM(__nccwpck_require__(16928));
|
|
238561
|
+
var import_child_process2 = __nccwpck_require__(35317);
|
|
238562
|
+
var import_util2 = __nccwpck_require__(39023);
|
|
238563
|
+
|
|
238564
|
+
// packages/cortex/server/src/utils/utils.ts
|
|
238565
|
+
var fs3 = __toESM(__nccwpck_require__(79896));
|
|
238566
|
+
var path3 = __toESM(__nccwpck_require__(16928));
|
|
238567
|
+
var import_child_process = __nccwpck_require__(35317);
|
|
238568
|
+
var import_util = __nccwpck_require__(39023);
|
|
238569
|
+
|
|
238570
|
+
// packages/core/src/types.ts
|
|
238571
|
+
function isFrontendWorkflow(workflow) {
|
|
238572
|
+
return "nodes" in workflow && "edges" in workflow && Array.isArray(workflow.nodes) && Array.isArray(workflow.edges);
|
|
238573
|
+
}
|
|
238518
238574
|
|
|
238519
238575
|
// packages/core/src/converters/n8nConverter.ts
|
|
238520
238576
|
function convertN8nWorkflow(n8nWorkflow) {
|
|
@@ -240108,27 +240164,7 @@ var LoggerFactory = class {
|
|
|
240108
240164
|
}
|
|
240109
240165
|
};
|
|
240110
240166
|
|
|
240111
|
-
// packages/cortex/server/src/WorkflowExecutor.ts
|
|
240112
|
-
var import_express = __toESM(__nccwpck_require__(85152));
|
|
240113
|
-
var fs9 = __toESM(__nccwpck_require__(79896));
|
|
240114
|
-
var path15 = __toESM(__nccwpck_require__(16928));
|
|
240115
|
-
var import_uuid = __nccwpck_require__(12048);
|
|
240116
|
-
var yaml = __toESM(__nccwpck_require__(38815));
|
|
240117
|
-
|
|
240118
|
-
// packages/cortex/server/src/utils/moduleLoader.ts
|
|
240119
|
-
var path6 = __toESM(__nccwpck_require__(16928));
|
|
240120
|
-
|
|
240121
|
-
// packages/cortex/server/src/utils/moduleCloner.ts
|
|
240122
|
-
var fs5 = __toESM(__nccwpck_require__(79896));
|
|
240123
|
-
var path5 = __toESM(__nccwpck_require__(16928));
|
|
240124
|
-
var import_child_process2 = __nccwpck_require__(35317);
|
|
240125
|
-
var import_util2 = __nccwpck_require__(39023);
|
|
240126
|
-
|
|
240127
240167
|
// packages/cortex/server/src/utils/utils.ts
|
|
240128
|
-
var fs3 = __toESM(__nccwpck_require__(79896));
|
|
240129
|
-
var path3 = __toESM(__nccwpck_require__(16928));
|
|
240130
|
-
var import_child_process = __nccwpck_require__(35317);
|
|
240131
|
-
var import_util = __nccwpck_require__(39023);
|
|
240132
240168
|
var logger = LoggerFactory.getRoot();
|
|
240133
240169
|
var execAsync = (0, import_util.promisify)(import_child_process.exec);
|
|
240134
240170
|
function buildNpmInstallCommand(packageSpec, options = {}) {
|
|
@@ -245489,6 +245525,14 @@ var WorkflowExecutor = class {
|
|
|
245489
245525
|
}
|
|
245490
245526
|
};
|
|
245491
245527
|
|
|
245528
|
+
// packages/cortex/server/src/server.ts
|
|
245529
|
+
var import_express3 = __toESM(__nccwpck_require__(85152));
|
|
245530
|
+
var import_dotenv = __toESM(__nccwpck_require__(18889));
|
|
245531
|
+
var import_yargs = __toESM(__nccwpck_require__(15229));
|
|
245532
|
+
var import_helpers = __nccwpck_require__(47763);
|
|
245533
|
+
var fs11 = __toESM(__nccwpck_require__(79896));
|
|
245534
|
+
var path17 = __toESM(__nccwpck_require__(16928));
|
|
245535
|
+
|
|
245492
245536
|
// packages/cortex/server/src/openapi/schemas.ts
|
|
245493
245537
|
var HealthResponseSchema = {
|
|
245494
245538
|
type: "object",
|
|
@@ -247704,12 +247748,404 @@ async function runCLI() {
|
|
|
247704
247748
|
}
|
|
247705
247749
|
}
|
|
247706
247750
|
}
|
|
247751
|
+
async function startServer(configPath, portOverride) {
|
|
247752
|
+
const server = new WorkflowExecutorServer();
|
|
247753
|
+
await server.loadConfig(configPath);
|
|
247754
|
+
const config = server["executor"].getConfig();
|
|
247755
|
+
let port;
|
|
247756
|
+
if (portOverride !== void 0) {
|
|
247757
|
+
port = portOverride;
|
|
247758
|
+
} else if (config?.server?.port !== void 0) {
|
|
247759
|
+
port = config.server.port;
|
|
247760
|
+
} else if (process.env.PORT) {
|
|
247761
|
+
port = parseInt(process.env.PORT, 10);
|
|
247762
|
+
} else {
|
|
247763
|
+
port = 3e3;
|
|
247764
|
+
}
|
|
247765
|
+
const host = config?.server?.host ?? process.env.HOST ?? "0.0.0.0";
|
|
247766
|
+
process.on("SIGTERM", async () => {
|
|
247767
|
+
console.log("\n\u{1F6D1} Received SIGTERM, shutting down gracefully...");
|
|
247768
|
+
await server.stop();
|
|
247769
|
+
process.exit(0);
|
|
247770
|
+
});
|
|
247771
|
+
process.on("SIGINT", async () => {
|
|
247772
|
+
console.log("\n\u{1F6D1} Received SIGINT, shutting down gracefully...");
|
|
247773
|
+
await server.stop();
|
|
247774
|
+
process.exit(0);
|
|
247775
|
+
});
|
|
247776
|
+
await server.start(port, host);
|
|
247777
|
+
return server;
|
|
247778
|
+
}
|
|
247779
|
+
|
|
247780
|
+
// packages/cortex/server/src/bits/framework.ts
|
|
247781
|
+
var import_axios4 = __toESM(__nccwpck_require__(87269));
|
|
247782
|
+
var AuthenticationType = /* @__PURE__ */ ((AuthenticationType2) => {
|
|
247783
|
+
AuthenticationType2["BEARER_TOKEN"] = "BEARER_TOKEN";
|
|
247784
|
+
AuthenticationType2["BASIC"] = "BASIC";
|
|
247785
|
+
AuthenticationType2["API_KEY"] = "API_KEY";
|
|
247786
|
+
AuthenticationType2["CUSTOM"] = "CUSTOM";
|
|
247787
|
+
AuthenticationType2["NONE"] = "NONE";
|
|
247788
|
+
return AuthenticationType2;
|
|
247789
|
+
})(AuthenticationType || {});
|
|
247790
|
+
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
247791
|
+
HttpMethod2["GET"] = "GET";
|
|
247792
|
+
HttpMethod2["POST"] = "POST";
|
|
247793
|
+
HttpMethod2["PUT"] = "PUT";
|
|
247794
|
+
HttpMethod2["DELETE"] = "DELETE";
|
|
247795
|
+
HttpMethod2["PATCH"] = "PATCH";
|
|
247796
|
+
HttpMethod2["HEAD"] = "HEAD";
|
|
247797
|
+
HttpMethod2["OPTIONS"] = "OPTIONS";
|
|
247798
|
+
return HttpMethod2;
|
|
247799
|
+
})(HttpMethod || {});
|
|
247800
|
+
var httpClient = {
|
|
247801
|
+
async sendRequest(request) {
|
|
247802
|
+
const config = {
|
|
247803
|
+
url: request.url,
|
|
247804
|
+
method: request.method,
|
|
247805
|
+
headers: { ...request.headers },
|
|
247806
|
+
data: request.body,
|
|
247807
|
+
params: request.queryParams,
|
|
247808
|
+
timeout: request.timeout || 3e4
|
|
247809
|
+
};
|
|
247810
|
+
if (request.authentication) {
|
|
247811
|
+
switch (request.authentication.type) {
|
|
247812
|
+
case "BEARER_TOKEN" /* BEARER_TOKEN */:
|
|
247813
|
+
config.headers = {
|
|
247814
|
+
...config.headers,
|
|
247815
|
+
Authorization: `Bearer ${request.authentication.token}`
|
|
247816
|
+
};
|
|
247817
|
+
break;
|
|
247818
|
+
case "BASIC" /* BASIC */:
|
|
247819
|
+
config.auth = {
|
|
247820
|
+
username: request.authentication.username || "",
|
|
247821
|
+
password: request.authentication.password || ""
|
|
247822
|
+
};
|
|
247823
|
+
break;
|
|
247824
|
+
case "API_KEY" /* API_KEY */:
|
|
247825
|
+
const headerName = request.authentication.headerName || "X-API-Key";
|
|
247826
|
+
config.headers = {
|
|
247827
|
+
...config.headers,
|
|
247828
|
+
[headerName]: request.authentication.apiKey || ""
|
|
247829
|
+
};
|
|
247830
|
+
break;
|
|
247831
|
+
}
|
|
247832
|
+
}
|
|
247833
|
+
const response = await (0, import_axios4.default)(config);
|
|
247834
|
+
return {
|
|
247835
|
+
status: response.status,
|
|
247836
|
+
headers: response.headers,
|
|
247837
|
+
body: response.data
|
|
247838
|
+
};
|
|
247839
|
+
}
|
|
247840
|
+
};
|
|
247841
|
+
var StoreScope = /* @__PURE__ */ ((StoreScope2) => {
|
|
247842
|
+
StoreScope2["PROJECT"] = "PROJECT";
|
|
247843
|
+
StoreScope2["FLOW"] = "FLOW";
|
|
247844
|
+
return StoreScope2;
|
|
247845
|
+
})(StoreScope || {});
|
|
247846
|
+
var Property = {
|
|
247847
|
+
ShortText(config) {
|
|
247848
|
+
return {
|
|
247849
|
+
type: "SHORT_TEXT",
|
|
247850
|
+
displayName: config.displayName,
|
|
247851
|
+
description: config.description,
|
|
247852
|
+
required: config.required,
|
|
247853
|
+
defaultValue: config.defaultValue
|
|
247854
|
+
};
|
|
247855
|
+
},
|
|
247856
|
+
LongText(config) {
|
|
247857
|
+
return {
|
|
247858
|
+
type: "LONG_TEXT",
|
|
247859
|
+
displayName: config.displayName,
|
|
247860
|
+
description: config.description,
|
|
247861
|
+
required: config.required,
|
|
247862
|
+
defaultValue: config.defaultValue
|
|
247863
|
+
};
|
|
247864
|
+
},
|
|
247865
|
+
Number(config) {
|
|
247866
|
+
return {
|
|
247867
|
+
type: "NUMBER",
|
|
247868
|
+
displayName: config.displayName,
|
|
247869
|
+
description: config.description,
|
|
247870
|
+
required: config.required,
|
|
247871
|
+
defaultValue: config.defaultValue
|
|
247872
|
+
};
|
|
247873
|
+
},
|
|
247874
|
+
Checkbox(config) {
|
|
247875
|
+
return {
|
|
247876
|
+
type: "CHECKBOX",
|
|
247877
|
+
displayName: config.displayName,
|
|
247878
|
+
description: config.description,
|
|
247879
|
+
required: config.required,
|
|
247880
|
+
defaultValue: config.defaultValue
|
|
247881
|
+
};
|
|
247882
|
+
},
|
|
247883
|
+
Dropdown(config) {
|
|
247884
|
+
return {
|
|
247885
|
+
type: "DROPDOWN",
|
|
247886
|
+
displayName: config.displayName,
|
|
247887
|
+
description: config.description,
|
|
247888
|
+
required: config.required,
|
|
247889
|
+
defaultValue: config.defaultValue,
|
|
247890
|
+
refreshers: config.refreshers,
|
|
247891
|
+
options: config.options
|
|
247892
|
+
};
|
|
247893
|
+
},
|
|
247894
|
+
StaticDropdown(config) {
|
|
247895
|
+
return {
|
|
247896
|
+
type: "STATIC_DROPDOWN",
|
|
247897
|
+
displayName: config.displayName,
|
|
247898
|
+
description: config.description,
|
|
247899
|
+
required: config.required,
|
|
247900
|
+
defaultValue: config.defaultValue,
|
|
247901
|
+
options: config.options
|
|
247902
|
+
};
|
|
247903
|
+
},
|
|
247904
|
+
Json(config) {
|
|
247905
|
+
return {
|
|
247906
|
+
type: "JSON",
|
|
247907
|
+
displayName: config.displayName,
|
|
247908
|
+
description: config.description,
|
|
247909
|
+
required: config.required,
|
|
247910
|
+
defaultValue: config.defaultValue
|
|
247911
|
+
};
|
|
247912
|
+
},
|
|
247913
|
+
Object(config) {
|
|
247914
|
+
return {
|
|
247915
|
+
type: "OBJECT",
|
|
247916
|
+
displayName: config.displayName,
|
|
247917
|
+
description: config.description,
|
|
247918
|
+
required: config.required,
|
|
247919
|
+
defaultValue: config.defaultValue
|
|
247920
|
+
};
|
|
247921
|
+
},
|
|
247922
|
+
Array(config) {
|
|
247923
|
+
return {
|
|
247924
|
+
type: "ARRAY",
|
|
247925
|
+
displayName: config.displayName,
|
|
247926
|
+
description: config.description,
|
|
247927
|
+
required: config.required,
|
|
247928
|
+
defaultValue: config.defaultValue,
|
|
247929
|
+
properties: config.properties
|
|
247930
|
+
};
|
|
247931
|
+
},
|
|
247932
|
+
File(config) {
|
|
247933
|
+
return {
|
|
247934
|
+
type: "FILE",
|
|
247935
|
+
displayName: config.displayName,
|
|
247936
|
+
description: config.description,
|
|
247937
|
+
required: config.required
|
|
247938
|
+
};
|
|
247939
|
+
},
|
|
247940
|
+
DateTime(config) {
|
|
247941
|
+
return {
|
|
247942
|
+
type: "DATE_TIME",
|
|
247943
|
+
displayName: config.displayName,
|
|
247944
|
+
description: config.description,
|
|
247945
|
+
required: config.required,
|
|
247946
|
+
defaultValue: config.defaultValue
|
|
247947
|
+
};
|
|
247948
|
+
},
|
|
247949
|
+
Markdown(config) {
|
|
247950
|
+
return {
|
|
247951
|
+
type: "MARKDOWN",
|
|
247952
|
+
displayName: config.displayName,
|
|
247953
|
+
description: config.description,
|
|
247954
|
+
required: false,
|
|
247955
|
+
defaultValue: config.value
|
|
247956
|
+
};
|
|
247957
|
+
}
|
|
247958
|
+
};
|
|
247959
|
+
var BitAuth = {
|
|
247960
|
+
CustomAuth(config) {
|
|
247961
|
+
return {
|
|
247962
|
+
type: "CUSTOM_AUTH",
|
|
247963
|
+
displayName: "Authentication",
|
|
247964
|
+
description: config.description,
|
|
247965
|
+
required: config.required,
|
|
247966
|
+
props: config.props,
|
|
247967
|
+
validate: config.validate
|
|
247968
|
+
};
|
|
247969
|
+
},
|
|
247970
|
+
SecretText(config) {
|
|
247971
|
+
return {
|
|
247972
|
+
type: "SECRET_TEXT",
|
|
247973
|
+
displayName: config.displayName,
|
|
247974
|
+
description: config.description,
|
|
247975
|
+
required: config.required
|
|
247976
|
+
};
|
|
247977
|
+
},
|
|
247978
|
+
None() {
|
|
247979
|
+
return {
|
|
247980
|
+
type: "CUSTOM_AUTH",
|
|
247981
|
+
displayName: "None",
|
|
247982
|
+
required: false
|
|
247983
|
+
};
|
|
247984
|
+
},
|
|
247985
|
+
OAuth2(config) {
|
|
247986
|
+
return {
|
|
247987
|
+
type: "CUSTOM_AUTH",
|
|
247988
|
+
displayName: "OAuth2",
|
|
247989
|
+
description: config.description,
|
|
247990
|
+
required: config.required,
|
|
247991
|
+
...config
|
|
247992
|
+
};
|
|
247993
|
+
},
|
|
247994
|
+
BasicAuth(config) {
|
|
247995
|
+
return {
|
|
247996
|
+
type: "CUSTOM_AUTH",
|
|
247997
|
+
displayName: "Basic Authentication",
|
|
247998
|
+
description: config.description,
|
|
247999
|
+
required: config.required,
|
|
248000
|
+
...config
|
|
248001
|
+
};
|
|
248002
|
+
}
|
|
248003
|
+
};
|
|
248004
|
+
var PieceAuth = BitAuth;
|
|
248005
|
+
function createAction(config) {
|
|
248006
|
+
return {
|
|
248007
|
+
name: config.name,
|
|
248008
|
+
displayName: config.displayName,
|
|
248009
|
+
description: config.description,
|
|
248010
|
+
auth: config.auth,
|
|
248011
|
+
props: config.props,
|
|
248012
|
+
run: config.run
|
|
248013
|
+
};
|
|
248014
|
+
}
|
|
248015
|
+
var createBitAction = createAction;
|
|
248016
|
+
var TriggerStrategy3 = /* @__PURE__ */ ((TriggerStrategy4) => {
|
|
248017
|
+
TriggerStrategy4["POLLING"] = "POLLING";
|
|
248018
|
+
TriggerStrategy4["WEBHOOK"] = "WEBHOOK";
|
|
248019
|
+
TriggerStrategy4["APP_WEBHOOK"] = "APP_WEBHOOK";
|
|
248020
|
+
return TriggerStrategy4;
|
|
248021
|
+
})(TriggerStrategy3 || {});
|
|
248022
|
+
function createTrigger(config) {
|
|
248023
|
+
return {
|
|
248024
|
+
name: config.name,
|
|
248025
|
+
displayName: config.displayName,
|
|
248026
|
+
description: config.description,
|
|
248027
|
+
type: config.type,
|
|
248028
|
+
auth: config.auth,
|
|
248029
|
+
props: config.props,
|
|
248030
|
+
onEnable: config.onEnable,
|
|
248031
|
+
onDisable: config.onDisable,
|
|
248032
|
+
run: config.run,
|
|
248033
|
+
test: config.test,
|
|
248034
|
+
onHandshake: config.onHandshake,
|
|
248035
|
+
sampleData: config.sampleData
|
|
248036
|
+
};
|
|
248037
|
+
}
|
|
248038
|
+
var createBitTrigger = createTrigger;
|
|
248039
|
+
var PieceCategory = /* @__PURE__ */ ((PieceCategory2) => {
|
|
248040
|
+
PieceCategory2["ARTIFICIAL_INTELLIGENCE"] = "ARTIFICIAL_INTELLIGENCE";
|
|
248041
|
+
PieceCategory2["COMMUNICATION"] = "COMMUNICATION";
|
|
248042
|
+
PieceCategory2["CORE"] = "CORE";
|
|
248043
|
+
PieceCategory2["CONTENT_AND_FILES"] = "CONTENT_AND_FILES";
|
|
248044
|
+
PieceCategory2["DEVELOPER_TOOLS"] = "DEVELOPER_TOOLS";
|
|
248045
|
+
PieceCategory2["BUSINESS_INTELLIGENCE"] = "BUSINESS_INTELLIGENCE";
|
|
248046
|
+
PieceCategory2["ACCOUNTING"] = "ACCOUNTING";
|
|
248047
|
+
PieceCategory2["SALES_AND_CRM"] = "SALES_AND_CRM";
|
|
248048
|
+
PieceCategory2["PRODUCTIVITY"] = "PRODUCTIVITY";
|
|
248049
|
+
PieceCategory2["MARKETING"] = "MARKETING";
|
|
248050
|
+
PieceCategory2["CUSTOMER_SUPPORT"] = "CUSTOMER_SUPPORT";
|
|
248051
|
+
PieceCategory2["PREMIUM"] = "PREMIUM";
|
|
248052
|
+
return PieceCategory2;
|
|
248053
|
+
})(PieceCategory || {});
|
|
248054
|
+
function createBit(config) {
|
|
248055
|
+
const actionsRecord = {};
|
|
248056
|
+
for (const action of config.actions) {
|
|
248057
|
+
actionsRecord[action.name] = action;
|
|
248058
|
+
}
|
|
248059
|
+
const triggersRecord = {};
|
|
248060
|
+
if (config.triggers) {
|
|
248061
|
+
for (const trigger of config.triggers) {
|
|
248062
|
+
triggersRecord[trigger.name] = trigger;
|
|
248063
|
+
}
|
|
248064
|
+
}
|
|
248065
|
+
return {
|
|
248066
|
+
displayName: config.displayName,
|
|
248067
|
+
description: config.description,
|
|
248068
|
+
logoUrl: config.logoUrl,
|
|
248069
|
+
minimumSupportedRelease: config.minimumSupportedRelease,
|
|
248070
|
+
maximumSupportedRelease: config.maximumSupportedRelease,
|
|
248071
|
+
categories: config.categories,
|
|
248072
|
+
auth: config.auth,
|
|
248073
|
+
actions: actionsRecord,
|
|
248074
|
+
triggers: triggersRecord,
|
|
248075
|
+
authors: config.authors
|
|
248076
|
+
};
|
|
248077
|
+
}
|
|
248078
|
+
var createPiece = createBit;
|
|
248079
|
+
function createCustomApiCallAction(config) {
|
|
248080
|
+
return createAction({
|
|
248081
|
+
name: "custom_api_call",
|
|
248082
|
+
displayName: "Custom API Call",
|
|
248083
|
+
description: "Make a custom API call to any endpoint",
|
|
248084
|
+
auth: config.auth,
|
|
248085
|
+
props: {
|
|
248086
|
+
method: Property.StaticDropdown({
|
|
248087
|
+
displayName: "Method",
|
|
248088
|
+
required: true,
|
|
248089
|
+
defaultValue: "GET",
|
|
248090
|
+
options: {
|
|
248091
|
+
options: [
|
|
248092
|
+
{ label: "GET", value: "GET" },
|
|
248093
|
+
{ label: "POST", value: "POST" },
|
|
248094
|
+
{ label: "PUT", value: "PUT" },
|
|
248095
|
+
{ label: "PATCH", value: "PATCH" },
|
|
248096
|
+
{ label: "DELETE", value: "DELETE" }
|
|
248097
|
+
]
|
|
248098
|
+
}
|
|
248099
|
+
}),
|
|
248100
|
+
path: Property.ShortText({
|
|
248101
|
+
displayName: "Path",
|
|
248102
|
+
description: "API path (e.g., /users)",
|
|
248103
|
+
required: true
|
|
248104
|
+
}),
|
|
248105
|
+
headers: Property.Json({
|
|
248106
|
+
displayName: "Headers",
|
|
248107
|
+
description: "Request headers as JSON object",
|
|
248108
|
+
required: false,
|
|
248109
|
+
defaultValue: {}
|
|
248110
|
+
}),
|
|
248111
|
+
queryParams: Property.Json({
|
|
248112
|
+
displayName: "Query Parameters",
|
|
248113
|
+
description: "Query parameters as JSON object",
|
|
248114
|
+
required: false,
|
|
248115
|
+
defaultValue: {}
|
|
248116
|
+
}),
|
|
248117
|
+
body: Property.Json({
|
|
248118
|
+
displayName: "Body",
|
|
248119
|
+
description: "Request body as JSON (for POST, PUT, PATCH)",
|
|
248120
|
+
required: false,
|
|
248121
|
+
defaultValue: {}
|
|
248122
|
+
})
|
|
248123
|
+
},
|
|
248124
|
+
async run({ auth, propsValue }) {
|
|
248125
|
+
const baseUrl = config.baseUrl(auth);
|
|
248126
|
+
const authHeaders = config.authMapping ? await config.authMapping(auth) : { headers: {} };
|
|
248127
|
+
const response = await httpClient.sendRequest({
|
|
248128
|
+
url: `${baseUrl}${propsValue.path}`,
|
|
248129
|
+
method: propsValue.method,
|
|
248130
|
+
headers: {
|
|
248131
|
+
...authHeaders.headers,
|
|
248132
|
+
...propsValue.headers || {}
|
|
248133
|
+
},
|
|
248134
|
+
queryParams: propsValue.queryParams,
|
|
248135
|
+
body: propsValue.body
|
|
248136
|
+
});
|
|
248137
|
+
return response.body;
|
|
248138
|
+
}
|
|
248139
|
+
});
|
|
248140
|
+
}
|
|
247707
248141
|
|
|
247708
248142
|
// packages/cortex/server/src/main.ts
|
|
247709
248143
|
runCLI().catch((error) => {
|
|
247710
248144
|
console.error("\u274C CLI failed:", error);
|
|
247711
248145
|
process.exit(1);
|
|
247712
248146
|
});
|
|
248147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
248148
|
+
0 && (0);
|
|
247713
248149
|
//# sourceMappingURL=main.cjs.map
|
|
247714
248150
|
|
|
247715
248151
|
|