@elevasis/sdk 0.6.2 → 0.6.3
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/cli.cjs +98 -141
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -43884,7 +43884,7 @@ async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
|
|
|
43884
43884
|
// package.json
|
|
43885
43885
|
var package_default = {
|
|
43886
43886
|
name: "@elevasis/sdk",
|
|
43887
|
-
version: "0.6.
|
|
43887
|
+
version: "0.6.3",
|
|
43888
43888
|
description: "SDK for building Elevasis organization resources",
|
|
43889
43889
|
type: "module",
|
|
43890
43890
|
bin: {
|
|
@@ -43950,6 +43950,31 @@ var SDK_VERSION = package_default.version;
|
|
|
43950
43950
|
|
|
43951
43951
|
// src/cli/commands/deploy.ts
|
|
43952
43952
|
var import_meta = {};
|
|
43953
|
+
function extractResourceMetadata(resource, schemaWarnings) {
|
|
43954
|
+
const meta = {
|
|
43955
|
+
resourceId: resource.config.resourceId,
|
|
43956
|
+
name: resource.config.name,
|
|
43957
|
+
version: resource.config.version,
|
|
43958
|
+
status: resource.config.status,
|
|
43959
|
+
description: resource.config.description,
|
|
43960
|
+
domains: resource.config.domains
|
|
43961
|
+
};
|
|
43962
|
+
if (resource.contract.inputSchema) {
|
|
43963
|
+
try {
|
|
43964
|
+
meta.inputSchema = external_exports.toJSONSchema(resource.contract.inputSchema);
|
|
43965
|
+
} catch {
|
|
43966
|
+
schemaWarnings.push(`${resource.config.resourceId}: inputSchema could not be serialized`);
|
|
43967
|
+
}
|
|
43968
|
+
}
|
|
43969
|
+
if (resource.contract.outputSchema) {
|
|
43970
|
+
try {
|
|
43971
|
+
meta.outputSchema = external_exports.toJSONSchema(resource.contract.outputSchema);
|
|
43972
|
+
} catch {
|
|
43973
|
+
schemaWarnings.push(`${resource.config.resourceId}: outputSchema could not be serialized`);
|
|
43974
|
+
}
|
|
43975
|
+
}
|
|
43976
|
+
return meta;
|
|
43977
|
+
}
|
|
43953
43978
|
var IGNORED_DOC_DIRS = /* @__PURE__ */ new Set([".archive"]);
|
|
43954
43979
|
async function scanDocumentation() {
|
|
43955
43980
|
const docsDir = (0, import_path.resolve)("docs");
|
|
@@ -44531,56 +44556,8 @@ function registerDeployCommand(program3) {
|
|
|
44531
44556
|
);
|
|
44532
44557
|
}
|
|
44533
44558
|
const schemaWarnings = [];
|
|
44534
|
-
const workflows = activeWorkflows.map((w) =>
|
|
44535
|
-
|
|
44536
|
-
resourceId: w.config.resourceId,
|
|
44537
|
-
name: w.config.name,
|
|
44538
|
-
version: w.config.version,
|
|
44539
|
-
status: w.config.status,
|
|
44540
|
-
description: w.config.description,
|
|
44541
|
-
domains: w.config.domains
|
|
44542
|
-
};
|
|
44543
|
-
if (w.contract.inputSchema) {
|
|
44544
|
-
try {
|
|
44545
|
-
meta.inputSchema = external_exports.toJSONSchema(w.contract.inputSchema);
|
|
44546
|
-
} catch {
|
|
44547
|
-
schemaWarnings.push(`${w.config.resourceId}: inputSchema could not be serialized`);
|
|
44548
|
-
}
|
|
44549
|
-
}
|
|
44550
|
-
if (w.contract.outputSchema) {
|
|
44551
|
-
try {
|
|
44552
|
-
meta.outputSchema = external_exports.toJSONSchema(w.contract.outputSchema);
|
|
44553
|
-
} catch {
|
|
44554
|
-
schemaWarnings.push(`${w.config.resourceId}: outputSchema could not be serialized`);
|
|
44555
|
-
}
|
|
44556
|
-
}
|
|
44557
|
-
return meta;
|
|
44558
|
-
});
|
|
44559
|
-
const agents = activeAgents.map((a) => {
|
|
44560
|
-
const meta = {
|
|
44561
|
-
resourceId: a.config.resourceId,
|
|
44562
|
-
name: a.config.name,
|
|
44563
|
-
version: a.config.version,
|
|
44564
|
-
status: a.config.status,
|
|
44565
|
-
description: a.config.description,
|
|
44566
|
-
domains: a.config.domains
|
|
44567
|
-
};
|
|
44568
|
-
if (a.contract.inputSchema) {
|
|
44569
|
-
try {
|
|
44570
|
-
meta.inputSchema = external_exports.toJSONSchema(a.contract.inputSchema);
|
|
44571
|
-
} catch {
|
|
44572
|
-
schemaWarnings.push(`${a.config.resourceId}: inputSchema could not be serialized`);
|
|
44573
|
-
}
|
|
44574
|
-
}
|
|
44575
|
-
if (a.contract.outputSchema) {
|
|
44576
|
-
try {
|
|
44577
|
-
meta.outputSchema = external_exports.toJSONSchema(a.contract.outputSchema);
|
|
44578
|
-
} catch {
|
|
44579
|
-
schemaWarnings.push(`${a.config.resourceId}: outputSchema could not be serialized`);
|
|
44580
|
-
}
|
|
44581
|
-
}
|
|
44582
|
-
return meta;
|
|
44583
|
-
});
|
|
44559
|
+
const workflows = activeWorkflows.map((w) => extractResourceMetadata(w, schemaWarnings));
|
|
44560
|
+
const agents = activeAgents.map((a) => extractResourceMetadata(a, schemaWarnings));
|
|
44584
44561
|
if (schemaWarnings.length > 0) {
|
|
44585
44562
|
for (const warning of schemaWarnings) {
|
|
44586
44563
|
console.log(source_default.yellow(` warn ${warning}`));
|
|
@@ -44695,103 +44672,83 @@ startWorker(org)
|
|
|
44695
44672
|
// src/cli/commands/check.ts
|
|
44696
44673
|
var import_meta2 = {};
|
|
44697
44674
|
function registerCheckCommand(program3) {
|
|
44698
|
-
program3.command("check").description(
|
|
44699
|
-
|
|
44700
|
-
|
|
44701
|
-
|
|
44702
|
-
const
|
|
44703
|
-
const
|
|
44704
|
-
|
|
44705
|
-
|
|
44706
|
-
|
|
44707
|
-
|
|
44708
|
-
|
|
44709
|
-
|
|
44710
|
-
|
|
44711
|
-
|
|
44712
|
-
|
|
44713
|
-
|
|
44714
|
-
|
|
44715
|
-
|
|
44716
|
-
|
|
44717
|
-
|
|
44718
|
-
|
|
44719
|
-
|
|
44720
|
-
|
|
44721
|
-
|
|
44722
|
-
|
|
44723
|
-
|
|
44724
|
-
|
|
44725
|
-
|
|
44726
|
-
|
|
44727
|
-
|
|
44728
|
-
|
|
44729
|
-
|
|
44730
|
-
|
|
44731
|
-
|
|
44732
|
-
console.log(source_default.gray(`
|
|
44733
|
-
|
|
44734
|
-
|
|
44735
|
-
|
|
44736
|
-
|
|
44737
|
-
|
|
44738
|
-
|
|
44739
|
-
|
|
44740
|
-
|
|
44741
|
-
|
|
44742
|
-
external_exports.toJSONSchema(w.contract.inputSchema);
|
|
44743
|
-
} catch {
|
|
44744
|
-
schemaWarnings.push(`${w.config.resourceId}: inputSchema could not be serialized`);
|
|
44745
|
-
}
|
|
44675
|
+
program3.command("check").description(
|
|
44676
|
+
"Validate project resources against the ResourceRegistry\n Example: elevasis-sdk check --entry ./src/index.ts"
|
|
44677
|
+
).option("--entry <path>", "Path to entry file (default: ./src/index.ts)").action(
|
|
44678
|
+
wrapAction("check", async (options2) => {
|
|
44679
|
+
const entryPath = options2.entry ?? "./src/index.ts";
|
|
44680
|
+
const spinner = ora("Validating resources...").start();
|
|
44681
|
+
try {
|
|
44682
|
+
const jiti = (0, import_jiti2.createJiti)(import_meta2.url);
|
|
44683
|
+
const entryModule = await jiti.import((0, import_path2.resolve)(entryPath));
|
|
44684
|
+
const org = entryModule.default;
|
|
44685
|
+
if (!org) {
|
|
44686
|
+
spinner.fail("Invalid entry: no default export found");
|
|
44687
|
+
console.error(source_default.gray(` Entry file: ${(0, import_path2.resolve)(entryPath)}`));
|
|
44688
|
+
console.error(source_default.gray(" Expected: export default { workflows: [...], agents: [...] }"));
|
|
44689
|
+
throw new Error("Invalid entry");
|
|
44690
|
+
}
|
|
44691
|
+
new ResourceRegistry({ _check: org });
|
|
44692
|
+
const workflowCount = org.workflows?.length ?? 0;
|
|
44693
|
+
const agentCount = org.agents?.length ?? 0;
|
|
44694
|
+
const totalCount = workflowCount + agentCount;
|
|
44695
|
+
spinner.succeed(
|
|
44696
|
+
source_default.green("Validation passed") + source_default.gray(` (${totalCount} resource${totalCount !== 1 ? "s" : ""}, 0 errors)`)
|
|
44697
|
+
);
|
|
44698
|
+
if (workflowCount > 0) {
|
|
44699
|
+
console.log(source_default.gray(` Workflows: ${workflowCount}`));
|
|
44700
|
+
}
|
|
44701
|
+
if (agentCount > 0) {
|
|
44702
|
+
console.log(source_default.gray(` Agents: ${agentCount}`));
|
|
44703
|
+
}
|
|
44704
|
+
const triggerCount = org.triggers?.length ?? 0;
|
|
44705
|
+
const integrationCount = org.integrations?.length ?? 0;
|
|
44706
|
+
const checkpointCount = org.humanCheckpoints?.length ?? 0;
|
|
44707
|
+
if (triggerCount > 0) console.log(source_default.gray(` Triggers: ${triggerCount}`));
|
|
44708
|
+
if (integrationCount > 0) console.log(source_default.gray(` Integrations: ${integrationCount}`));
|
|
44709
|
+
if (checkpointCount > 0) console.log(source_default.gray(` Checkpoints: ${checkpointCount}`));
|
|
44710
|
+
const relationshipCount = org.relationships ? Object.keys(org.relationships).length : 0;
|
|
44711
|
+
if (relationshipCount > 0) {
|
|
44712
|
+
console.log(source_default.gray(` Relationships: ${relationshipCount}`));
|
|
44713
|
+
}
|
|
44714
|
+
const documentation = await scanDocumentation();
|
|
44715
|
+
if (documentation) {
|
|
44716
|
+
console.log(
|
|
44717
|
+
source_default.gray(` Docs: ${documentation.length} file${documentation.length !== 1 ? "s" : ""}`)
|
|
44718
|
+
);
|
|
44746
44719
|
}
|
|
44747
|
-
|
|
44748
|
-
|
|
44749
|
-
|
|
44750
|
-
} catch {
|
|
44751
|
-
schemaWarnings.push(`${w.config.resourceId}: outputSchema could not be serialized`);
|
|
44752
|
-
}
|
|
44720
|
+
const schemaWarnings = [];
|
|
44721
|
+
for (const w of org.workflows ?? []) {
|
|
44722
|
+
extractResourceMetadata(w, schemaWarnings);
|
|
44753
44723
|
}
|
|
44754
|
-
|
|
44755
|
-
|
|
44756
|
-
if (a.contract.inputSchema) {
|
|
44757
|
-
try {
|
|
44758
|
-
external_exports.toJSONSchema(a.contract.inputSchema);
|
|
44759
|
-
} catch {
|
|
44760
|
-
schemaWarnings.push(`${a.config.resourceId}: inputSchema could not be serialized`);
|
|
44761
|
-
}
|
|
44724
|
+
for (const a of org.agents ?? []) {
|
|
44725
|
+
extractResourceMetadata(a, schemaWarnings);
|
|
44762
44726
|
}
|
|
44763
|
-
if (
|
|
44764
|
-
|
|
44765
|
-
|
|
44766
|
-
|
|
44767
|
-
schemaWarnings.push(`${a.config.resourceId}: outputSchema could not be serialized`);
|
|
44727
|
+
if (schemaWarnings.length > 0) {
|
|
44728
|
+
console.log("");
|
|
44729
|
+
for (const warning of schemaWarnings) {
|
|
44730
|
+
console.log(source_default.yellow(` warn ${warning}`));
|
|
44768
44731
|
}
|
|
44732
|
+
console.log(source_default.gray(" Schemas will be unavailable on the platform for these resources."));
|
|
44769
44733
|
}
|
|
44770
|
-
}
|
|
44771
|
-
|
|
44772
|
-
|
|
44773
|
-
|
|
44774
|
-
console.
|
|
44775
|
-
|
|
44776
|
-
|
|
44777
|
-
|
|
44778
|
-
|
|
44779
|
-
|
|
44780
|
-
|
|
44781
|
-
|
|
44782
|
-
|
|
44783
|
-
if (error46.resourceId) {
|
|
44784
|
-
console.error(source_default.gray(` Resource: ${error46.resourceId}`));
|
|
44785
|
-
}
|
|
44786
|
-
if (error46.field) {
|
|
44787
|
-
console.error(source_default.gray(` Field: ${error46.field}`));
|
|
44734
|
+
} catch (error46) {
|
|
44735
|
+
if (error46 instanceof RegistryValidationError) {
|
|
44736
|
+
spinner.fail(source_default.red("Validation failed"));
|
|
44737
|
+
console.error("");
|
|
44738
|
+
console.error(source_default.red(` ERROR ${error46.message}`));
|
|
44739
|
+
if (error46.resourceId) {
|
|
44740
|
+
console.error(source_default.gray(` Resource: ${error46.resourceId}`));
|
|
44741
|
+
}
|
|
44742
|
+
if (error46.field) {
|
|
44743
|
+
console.error(source_default.gray(` Field: ${error46.field}`));
|
|
44744
|
+
}
|
|
44745
|
+
console.error("");
|
|
44746
|
+
console.error(source_default.gray(" 1 error. Fix the issue and run again."));
|
|
44788
44747
|
}
|
|
44789
|
-
|
|
44790
|
-
console.error(source_default.gray(" 1 error. Fix the issue and run again."));
|
|
44748
|
+
throw error46;
|
|
44791
44749
|
}
|
|
44792
|
-
|
|
44793
|
-
|
|
44794
|
-
}));
|
|
44750
|
+
})
|
|
44751
|
+
);
|
|
44795
44752
|
}
|
|
44796
44753
|
|
|
44797
44754
|
// src/cli/commands/exec.ts
|