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