@elevasis/sdk 1.49.0 → 1.50.0
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/chunk-MGZZ4HL4.js +4399 -0
- package/dist/chunk-VYWGWJRW.js +130 -0
- package/dist/chunk-YJDXRHNP.js +7901 -0
- package/dist/cli.cjs +208 -51
- package/dist/index.d.ts +347 -2
- package/dist/index.js +2 -7831
- package/dist/node/index.d.ts +3 -3759
- package/dist/node/index.js +2 -124
- package/dist/test-utils/index.d.ts +2 -12664
- package/dist/test-utils/index.js +93 -28073
- package/dist/worker/index.d.ts +532 -12872
- package/dist/worker/index.js +3 -7509
- package/package.json +10 -2
- package/reference/packages/core/src/content/README.md +4 -1
- package/reference/rules/agent-start-here.md +1 -1
- package/reference/rules/frontend.md +3 -1
- package/reference/rules/package-taxonomy.md +7 -5
- package/reference/rules/ui.md +30 -4
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +8 -6
- package/reference/scaffold/ui/feature-flags-and-gating.md +11 -1
- package/reference/sdk/cli-management.mdx +127 -125
- package/reference/sdk/cli.mdx +70 -61
- package/reference/sdk/deployment/index.mdx +23 -6
- package/reference/sdk/platform-tools/adapters-platform.mdx +1 -1
- package/reference/sdk/troubleshooting.mdx +72 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/project-deployment-spec.ts
|
|
9
|
+
function toSdkResourceDescriptor(resource, getResourceOntologyBinding) {
|
|
10
|
+
const ontologyBinding = getResourceOntologyBinding?.(resource.id);
|
|
11
|
+
return {
|
|
12
|
+
...resource,
|
|
13
|
+
...ontologyBinding ?? {},
|
|
14
|
+
systemId: resource.systemPath
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function withPlatformResourceDescriptor(workflow, getWorkflowResourceDescriptor, getResourceOntologyBinding) {
|
|
18
|
+
const resource = getWorkflowResourceDescriptor(workflow.config.resourceId);
|
|
19
|
+
const sdkResource = toSdkResourceDescriptor(resource, getResourceOntologyBinding);
|
|
20
|
+
return {
|
|
21
|
+
...workflow,
|
|
22
|
+
config: {
|
|
23
|
+
...workflow.config,
|
|
24
|
+
resource: sdkResource,
|
|
25
|
+
resourceId: sdkResource.id,
|
|
26
|
+
type: sdkResource.kind
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function withPlatformResourceDescriptors(workflows, getWorkflowResourceDescriptor, getResourceOntologyBinding) {
|
|
31
|
+
return workflows.map(
|
|
32
|
+
(workflow) => withPlatformResourceDescriptor(workflow, getWorkflowResourceDescriptor, getResourceOntologyBinding)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function withPlatformAgentResourceDescriptor(agent, getAgentResourceDescriptor, getResourceOntologyBinding) {
|
|
36
|
+
const resource = getAgentResourceDescriptor(agent.config.resourceId);
|
|
37
|
+
const sdkResource = toSdkResourceDescriptor(resource, getResourceOntologyBinding);
|
|
38
|
+
return {
|
|
39
|
+
...agent,
|
|
40
|
+
config: {
|
|
41
|
+
...agent.config,
|
|
42
|
+
resource: sdkResource,
|
|
43
|
+
resourceId: sdkResource.id,
|
|
44
|
+
type: sdkResource.kind
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function withPlatformAgentResourceDescriptors(agents, getAgentResourceDescriptor, getResourceOntologyBinding) {
|
|
49
|
+
return agents.map(
|
|
50
|
+
(agent) => withPlatformAgentResourceDescriptor(agent, getAgentResourceDescriptor, getResourceOntologyBinding)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function withPlatformIntegrationResourceDescriptor(integration, getIntegrationResourceDescriptor, getResourceOntologyBinding) {
|
|
54
|
+
const resource = getIntegrationResourceDescriptor(integration.resourceId);
|
|
55
|
+
const sdkResource = toSdkResourceDescriptor(resource, getResourceOntologyBinding);
|
|
56
|
+
return {
|
|
57
|
+
...integration,
|
|
58
|
+
resource: sdkResource,
|
|
59
|
+
resourceId: sdkResource.id,
|
|
60
|
+
type: sdkResource.kind
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function withPlatformIntegrationResourceDescriptors(integrations, getIntegrationResourceDescriptor, getResourceOntologyBinding) {
|
|
64
|
+
return integrations.map(
|
|
65
|
+
(integration) => withPlatformIntegrationResourceDescriptor(integration, getIntegrationResourceDescriptor, getResourceOntologyBinding)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function projectTopologyRelationships(model) {
|
|
69
|
+
const projected = {};
|
|
70
|
+
function ensure(sourceId) {
|
|
71
|
+
projected[sourceId] ??= {};
|
|
72
|
+
return projected[sourceId];
|
|
73
|
+
}
|
|
74
|
+
for (const relationship of Object.values(model.topology.relationships)) {
|
|
75
|
+
if (relationship.from.kind === "humanCheckpoint") continue;
|
|
76
|
+
if (relationship.kind === "triggers" && relationship.to.kind === "resource") {
|
|
77
|
+
const target = model.resources[relationship.to.id];
|
|
78
|
+
if (target?.kind !== "workflow" && target?.kind !== "agent") continue;
|
|
79
|
+
const source = ensure(relationship.from.id);
|
|
80
|
+
source.triggers ??= {};
|
|
81
|
+
if (target.kind === "workflow") {
|
|
82
|
+
source.triggers.workflows ??= [];
|
|
83
|
+
source.triggers.workflows.push(target.id);
|
|
84
|
+
} else {
|
|
85
|
+
source.triggers.agents ??= [];
|
|
86
|
+
source.triggers.agents.push(target.id);
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (relationship.kind === "uses" && relationship.from.kind === "resource" && relationship.to.kind === "resource") {
|
|
91
|
+
const target = model.resources[relationship.to.id];
|
|
92
|
+
if (target?.kind !== "integration") continue;
|
|
93
|
+
const source = ensure(relationship.from.id);
|
|
94
|
+
source.uses ??= {};
|
|
95
|
+
source.uses.integrations ??= [];
|
|
96
|
+
source.uses.integrations.push(target.id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return projected;
|
|
100
|
+
}
|
|
101
|
+
function projectDeploymentSpec(options) {
|
|
102
|
+
const workflows = withPlatformResourceDescriptors(
|
|
103
|
+
options.workflows,
|
|
104
|
+
options.getWorkflowResourceDescriptor,
|
|
105
|
+
options.getResourceOntologyBinding
|
|
106
|
+
);
|
|
107
|
+
const integrations = withPlatformIntegrationResourceDescriptors(
|
|
108
|
+
options.integrations ?? [],
|
|
109
|
+
options.getIntegrationResourceDescriptor,
|
|
110
|
+
options.getResourceOntologyBinding
|
|
111
|
+
);
|
|
112
|
+
const agents = options.getAgentResourceDescriptor === void 0 ? options.agents ?? [] : withPlatformAgentResourceDescriptors(
|
|
113
|
+
options.agents ?? [],
|
|
114
|
+
options.getAgentResourceDescriptor,
|
|
115
|
+
options.getResourceOntologyBinding
|
|
116
|
+
);
|
|
117
|
+
return {
|
|
118
|
+
version: options.version,
|
|
119
|
+
organizationModel: options.organizationModel,
|
|
120
|
+
workflows,
|
|
121
|
+
agents,
|
|
122
|
+
triggers: options.triggers,
|
|
123
|
+
integrations,
|
|
124
|
+
humanCheckpoints: options.humanCheckpoints,
|
|
125
|
+
relationships: projectTopologyRelationships(options.organizationModel),
|
|
126
|
+
...options.externalResources ? { externalResources: options.externalResources } : {}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { __require, projectDeploymentSpec, projectTopologyRelationships, toSdkResourceDescriptor, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
|