@oomol-lab/open-flow 0.1.0-beta.60 → 0.1.0-beta.61
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/README.md +14 -1
- package/dist/browser/{createResourceDialog-B7ThMSeA.js → createResourceDialog-D71fO68i.js} +2 -2
- package/dist/browser/{flowChanges-Cbl6Izr-.js → flowChanges-DSA0FxxN.js} +3389 -3290
- package/dist/browser/{flowWorkspace-BdbsnUDs.js → flowWorkspace-0sUJ5JhQ.js} +41 -49
- package/dist/browser/{icons-D70mz3qW.js → icons-DVJvrj1H.js} +10503 -10503
- package/dist/browser/preview.js +687 -718
- package/dist/browser/ui.css +697 -1
- package/dist/browser/ui.d.ts +45 -0
- package/dist/browser/ui.js +6243 -740
- package/dist/browser/workbench.js +6 -64
- package/dist/browser/{workbenchSelect-gB45mZY7.js → workbenchSelect-cr4-mKq3.js} +1 -1
- package/dist/command/index.d.ts +6 -0
- package/dist/command/index.js +84 -0
- package/dist/command/licenses.md +191 -0
- package/dist/common/authoring.d.ts +1 -1
- package/dist/common/control-api-conformance.js +3675 -3585
- package/dist/common/control-api-errors.d.ts +4 -0
- package/dist/common/control-api.d.ts +30 -9
- package/dist/common/control-api.js +4259 -3789
- package/dist/common/mcp.d.ts +61 -0
- package/dist/common/mcp.js +342 -232
- package/dist/common/publicationResources.d.ts +29 -0
- package/package.json +5 -1
- package/skills/open-flow/SKILL.md +2 -1
- package/skills/open-flow/references/flow-authoring.md +32 -0
package/dist/common/mcp.js
CHANGED
|
@@ -9687,40 +9687,6 @@ var resultQuerySchema = strictObject({
|
|
|
9687
9687
|
maxBytes: number().int().min(1).max(1048576).default(15e3)
|
|
9688
9688
|
});
|
|
9689
9689
|
//#endregion
|
|
9690
|
-
//#region src/control/common/providerIconSprite.ts
|
|
9691
|
-
/** Optional artwork must never make an otherwise usable catalog unavailable. */
|
|
9692
|
-
function providerIconAppearance(metadata, position) {
|
|
9693
|
-
if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
|
|
9694
|
-
const m = metadata;
|
|
9695
|
-
const p = position;
|
|
9696
|
-
if (typeof m.version != "string" || ![
|
|
9697
|
-
m.pixelRatio,
|
|
9698
|
-
m.iconSize,
|
|
9699
|
-
m.width,
|
|
9700
|
-
m.height
|
|
9701
|
-
].every((v) => Number.isInteger(v) && v > 0) || ![
|
|
9702
|
-
m.bleed,
|
|
9703
|
-
p.x,
|
|
9704
|
-
p.y
|
|
9705
|
-
].every((v) => Number.isInteger(v) && v >= 0) || p.x + m.iconSize > m.width || p.y + m.iconSize > m.height) return {};
|
|
9706
|
-
try {
|
|
9707
|
-
for (const url of [m.lightUrl, m.darkUrl]) if (typeof url != "string" || ![
|
|
9708
|
-
"https:",
|
|
9709
|
-
"http:",
|
|
9710
|
-
"data:"
|
|
9711
|
-
].includes(new URL(url).protocol)) return {};
|
|
9712
|
-
} catch {
|
|
9713
|
-
return {};
|
|
9714
|
-
}
|
|
9715
|
-
return {
|
|
9716
|
-
iconSprite: m,
|
|
9717
|
-
iconSpritePosition: {
|
|
9718
|
-
x: p.x,
|
|
9719
|
-
y: p.y
|
|
9720
|
-
}
|
|
9721
|
-
};
|
|
9722
|
-
}
|
|
9723
|
-
//#endregion
|
|
9724
9690
|
//#region src/control/common/errors.ts
|
|
9725
9691
|
var controlErrorCode = {
|
|
9726
9692
|
authenticationRequired: "authentication.required",
|
|
@@ -9754,6 +9720,7 @@ var controlErrorCode = {
|
|
|
9754
9720
|
publicationConflict: "publication.conflict",
|
|
9755
9721
|
publicationNotFound: "publication.not-found",
|
|
9756
9722
|
publicationUnsupported: "publication.unsupported",
|
|
9723
|
+
resourceNotFound: "resource.not-found",
|
|
9757
9724
|
publishOperationNotFound: "publication.operation-not-found",
|
|
9758
9725
|
routeNotFound: "route.not-found",
|
|
9759
9726
|
runConflict: "run.conflict",
|
|
@@ -9770,7 +9737,7 @@ var controlErrorCode = {
|
|
|
9770
9737
|
variableLimitReached: "variable.limit-reached",
|
|
9771
9738
|
variableNotFound: "variable.not-found"
|
|
9772
9739
|
};
|
|
9773
|
-
controlErrorCode.eventSourceInvalid, controlErrorCode.eventSourceIdentityUnavailable, controlErrorCode.eventSourceNotFound, controlErrorCode.eventSourceConflict, controlErrorCode.authenticationRequired, controlErrorCode.authorizationDenied, controlErrorCode.bindingUnresolved, controlErrorCode.connectorActionNotFound, controlErrorCode.connectorAccessConflict, controlErrorCode.connectorAccessInvalid, controlErrorCode.connectorAccessRequired, controlErrorCode.connectorAccessUnsupported, controlErrorCode.connectorUnconfigured, controlErrorCode.connectorUnavailable, controlErrorCode.connectorConsoleUnconfigured, controlErrorCode.engineUnavailable, controlErrorCode.engineUnsupported, controlErrorCode.flowInvalid, controlErrorCode.flowRepairRequired, controlErrorCode.flowUpgradeRequired, controlErrorCode.flowNotFound, controlErrorCode.flowBusy, controlErrorCode.flowConflict, controlErrorCode.flowPresentationConflict, controlErrorCode.flowRevisionConflict, controlErrorCode.liveConflict, controlErrorCode.liveNotFound, controlErrorCode.pageInvalidCursor, controlErrorCode.publicationConflict, controlErrorCode.publicationNotFound, controlErrorCode.publicationUnsupported, controlErrorCode.publishOperationNotFound, controlErrorCode.routeNotFound, controlErrorCode.runConflict, controlErrorCode.runEventsExpired, controlErrorCode.runInvalid, controlErrorCode.runNotFound, controlErrorCode.runNotTerminal, controlErrorCode.runOverloaded, controlErrorCode.runWaitNotFound, controlErrorCode.triggerKeyInvalid, controlErrorCode.triggerKeyNotFound, controlErrorCode.triggerNotFound, controlErrorCode.variableInvalid, controlErrorCode.variableLimitReached, controlErrorCode.variableNotFound;
|
|
9740
|
+
controlErrorCode.eventSourceInvalid, controlErrorCode.eventSourceIdentityUnavailable, controlErrorCode.eventSourceNotFound, controlErrorCode.eventSourceConflict, controlErrorCode.authenticationRequired, controlErrorCode.authorizationDenied, controlErrorCode.bindingUnresolved, controlErrorCode.connectorActionNotFound, controlErrorCode.connectorAccessConflict, controlErrorCode.connectorAccessInvalid, controlErrorCode.connectorAccessRequired, controlErrorCode.connectorAccessUnsupported, controlErrorCode.connectorUnconfigured, controlErrorCode.connectorUnavailable, controlErrorCode.connectorConsoleUnconfigured, controlErrorCode.engineUnavailable, controlErrorCode.engineUnsupported, controlErrorCode.flowInvalid, controlErrorCode.flowRepairRequired, controlErrorCode.flowUpgradeRequired, controlErrorCode.flowNotFound, controlErrorCode.flowBusy, controlErrorCode.flowConflict, controlErrorCode.flowPresentationConflict, controlErrorCode.flowRevisionConflict, controlErrorCode.liveConflict, controlErrorCode.liveNotFound, controlErrorCode.pageInvalidCursor, controlErrorCode.publicationConflict, controlErrorCode.publicationNotFound, controlErrorCode.publicationUnsupported, controlErrorCode.resourceNotFound, controlErrorCode.publishOperationNotFound, controlErrorCode.routeNotFound, controlErrorCode.runConflict, controlErrorCode.runEventsExpired, controlErrorCode.runInvalid, controlErrorCode.runNotFound, controlErrorCode.runNotTerminal, controlErrorCode.runOverloaded, controlErrorCode.runWaitNotFound, controlErrorCode.triggerKeyInvalid, controlErrorCode.triggerKeyNotFound, controlErrorCode.triggerNotFound, controlErrorCode.variableInvalid, controlErrorCode.variableLimitReached, controlErrorCode.variableNotFound;
|
|
9774
9741
|
var ApiError = class extends Error {
|
|
9775
9742
|
constructor(status, code, message, details) {
|
|
9776
9743
|
super(message);
|
|
@@ -9820,6 +9787,272 @@ function optionalString(value) {
|
|
|
9820
9787
|
if (value == null) return;
|
|
9821
9788
|
return string(value);
|
|
9822
9789
|
}
|
|
9790
|
+
//#endregion
|
|
9791
|
+
//#region src/trigger/common/configSchema.ts
|
|
9792
|
+
var configInputsSchema = array(union([strictObject({
|
|
9793
|
+
handle: string$1().min(1),
|
|
9794
|
+
description: string$1().optional(),
|
|
9795
|
+
jsonSchema: json$4(),
|
|
9796
|
+
nullable: boolean(),
|
|
9797
|
+
value: json$4().optional()
|
|
9798
|
+
}), strictObject({
|
|
9799
|
+
group: string$1(),
|
|
9800
|
+
collapsed: boolean().optional()
|
|
9801
|
+
})]));
|
|
9802
|
+
//#endregion
|
|
9803
|
+
//#region src/control/common/triggerDecoders.ts
|
|
9804
|
+
function triggerKeySummary(value) {
|
|
9805
|
+
const source = record(value);
|
|
9806
|
+
const type = source.type;
|
|
9807
|
+
if (type != "integration" && type != "poll") return invalidResponse();
|
|
9808
|
+
return {
|
|
9809
|
+
description: typeof source.description == "string" ? source.description : invalidResponse(),
|
|
9810
|
+
displayName: string(source.displayName),
|
|
9811
|
+
key: string(source.key),
|
|
9812
|
+
name: string(source.name),
|
|
9813
|
+
provider: string(source.provider),
|
|
9814
|
+
type
|
|
9815
|
+
};
|
|
9816
|
+
}
|
|
9817
|
+
function triggerKey(value) {
|
|
9818
|
+
const source = record(value);
|
|
9819
|
+
const summary = triggerKeySummary(source);
|
|
9820
|
+
const base = {
|
|
9821
|
+
configInputs: configInputsSchema.parse(source.configInputs),
|
|
9822
|
+
definitionVersion: source.definitionVersion === 2 ? 2 : invalidResponse(),
|
|
9823
|
+
description: summary.description,
|
|
9824
|
+
displayName: summary.displayName,
|
|
9825
|
+
key: summary.key,
|
|
9826
|
+
name: summary.name,
|
|
9827
|
+
outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
|
|
9828
|
+
const port = record(entry);
|
|
9829
|
+
return Object.assign({
|
|
9830
|
+
handle: string(port.handle),
|
|
9831
|
+
jsonSchema: jsonValue(port.jsonSchema),
|
|
9832
|
+
nullable: typeof port.nullable === "boolean" ? port.nullable : invalidResponse()
|
|
9833
|
+
}, port.description == null ? {} : { description: string(port.description) });
|
|
9834
|
+
}),
|
|
9835
|
+
provider: summary.provider
|
|
9836
|
+
};
|
|
9837
|
+
if (summary.type == "poll") return {
|
|
9838
|
+
...base,
|
|
9839
|
+
type: "poll"
|
|
9840
|
+
};
|
|
9841
|
+
const endpoint = record(source.endpoint);
|
|
9842
|
+
const body = record(endpoint.body);
|
|
9843
|
+
if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
|
|
9844
|
+
const methods = endpoint.methods.map(string);
|
|
9845
|
+
const formats = body.formats.map(string);
|
|
9846
|
+
const successStatus = integer(endpoint.successStatus);
|
|
9847
|
+
if (methods.some((method) => ![
|
|
9848
|
+
"DELETE",
|
|
9849
|
+
"GET",
|
|
9850
|
+
"HEAD",
|
|
9851
|
+
"PATCH",
|
|
9852
|
+
"POST",
|
|
9853
|
+
"PUT"
|
|
9854
|
+
].includes(method)) || formats.some((format) => ![
|
|
9855
|
+
"form",
|
|
9856
|
+
"json",
|
|
9857
|
+
"multipart",
|
|
9858
|
+
"text"
|
|
9859
|
+
].includes(format)) || successStatus < 200 || successStatus > 299) return invalidResponse();
|
|
9860
|
+
return {
|
|
9861
|
+
...base,
|
|
9862
|
+
endpoint: {
|
|
9863
|
+
body: {
|
|
9864
|
+
allowArray: body.allowArray,
|
|
9865
|
+
allowEmpty: body.allowEmpty,
|
|
9866
|
+
formats
|
|
9867
|
+
},
|
|
9868
|
+
methods,
|
|
9869
|
+
successStatus
|
|
9870
|
+
},
|
|
9871
|
+
type: "integration"
|
|
9872
|
+
};
|
|
9873
|
+
}
|
|
9874
|
+
var triggerKinds = /* @__PURE__ */ new Set([
|
|
9875
|
+
"error",
|
|
9876
|
+
"cron",
|
|
9877
|
+
"integration",
|
|
9878
|
+
"poll",
|
|
9879
|
+
"webhook"
|
|
9880
|
+
]);
|
|
9881
|
+
var triggerHealth = /* @__PURE__ */ new Set([
|
|
9882
|
+
"failed",
|
|
9883
|
+
"healthy",
|
|
9884
|
+
"initializing",
|
|
9885
|
+
"needs_reauth",
|
|
9886
|
+
"suspended"
|
|
9887
|
+
]);
|
|
9888
|
+
var triggerActivityKinds = /* @__PURE__ */ new Set([
|
|
9889
|
+
"delivery.failed",
|
|
9890
|
+
"health.failed",
|
|
9891
|
+
"health.needs_reauth",
|
|
9892
|
+
"health.recovered",
|
|
9893
|
+
"health.suspended",
|
|
9894
|
+
"operator.paused",
|
|
9895
|
+
"operator.resumed"
|
|
9896
|
+
]);
|
|
9897
|
+
function triggerBinding(value) {
|
|
9898
|
+
const source = record(value);
|
|
9899
|
+
const health = source.health;
|
|
9900
|
+
const listener = source.listener == null ? void 0 : record(source.listener);
|
|
9901
|
+
if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
|
|
9902
|
+
const kind = source.kind;
|
|
9903
|
+
const runtimeVersion = integer(source.runtimeVersion);
|
|
9904
|
+
if (source.version != 1 || typeof health != "string" || !triggerHealth.has(health)) return invalidResponse();
|
|
9905
|
+
if (typeof kind != "string" || !triggerKinds.has(kind)) return invalidResponse();
|
|
9906
|
+
if (runtimeVersion <= 0) return invalidResponse();
|
|
9907
|
+
return {
|
|
9908
|
+
...source.currentPublicationId == null ? {} : { currentPublicationId: string(source.currentPublicationId) },
|
|
9909
|
+
...source.currentRevisionId == null ? {} : { currentRevisionId: string(source.currentRevisionId) },
|
|
9910
|
+
...source.endpointUrl == null ? {} : { endpointUrl: string(source.endpointUrl) },
|
|
9911
|
+
...listener == null ? {} : { listener: {
|
|
9912
|
+
health: listener.health,
|
|
9913
|
+
...listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }
|
|
9914
|
+
} },
|
|
9915
|
+
flowId: string(source.flowId),
|
|
9916
|
+
health,
|
|
9917
|
+
kind,
|
|
9918
|
+
...source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) },
|
|
9919
|
+
runtimeVersion,
|
|
9920
|
+
triggerNodeId: string(source.triggerNodeId),
|
|
9921
|
+
updatedAt: string(source.updatedAt),
|
|
9922
|
+
version: 1
|
|
9923
|
+
};
|
|
9924
|
+
}
|
|
9925
|
+
function triggerBindingDetail(value) {
|
|
9926
|
+
const source = record(value);
|
|
9927
|
+
if (source.version != 1) return invalidResponse();
|
|
9928
|
+
return {
|
|
9929
|
+
binding: triggerBinding(source.binding),
|
|
9930
|
+
version: 1
|
|
9931
|
+
};
|
|
9932
|
+
}
|
|
9933
|
+
function triggerActivity(value) {
|
|
9934
|
+
const source = record(value);
|
|
9935
|
+
const kind = source.kind;
|
|
9936
|
+
if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
|
|
9937
|
+
const errorCode = optionalString(source.errorCode);
|
|
9938
|
+
const errorMessage = optionalString(source.errorMessage);
|
|
9939
|
+
if (errorMessage != null && errorMessage.length > 512) return invalidResponse();
|
|
9940
|
+
return {
|
|
9941
|
+
activityId: string(source.activityId),
|
|
9942
|
+
createdAt: string(source.createdAt),
|
|
9943
|
+
...errorCode == null ? {} : { errorCode },
|
|
9944
|
+
...errorMessage == null ? {} : { errorMessage },
|
|
9945
|
+
kind
|
|
9946
|
+
};
|
|
9947
|
+
}
|
|
9948
|
+
function triggerActivityPage(value) {
|
|
9949
|
+
const source = record(value);
|
|
9950
|
+
const nextCursor = optionalString(source.nextCursor);
|
|
9951
|
+
if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
|
|
9952
|
+
return {
|
|
9953
|
+
activities: source.activities.map(triggerActivity),
|
|
9954
|
+
...nextCursor == null ? {} : { nextCursor },
|
|
9955
|
+
version: 1
|
|
9956
|
+
};
|
|
9957
|
+
}
|
|
9958
|
+
function pollTriggerTestResult(value) {
|
|
9959
|
+
const source = record(value);
|
|
9960
|
+
const filtered = integer(source.filtered);
|
|
9961
|
+
if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
|
|
9962
|
+
return {
|
|
9963
|
+
events: source.events.map((event) => {
|
|
9964
|
+
const object = record(event);
|
|
9965
|
+
return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
|
|
9966
|
+
}),
|
|
9967
|
+
filtered,
|
|
9968
|
+
hasMore: source.hasMore,
|
|
9969
|
+
version: 1
|
|
9970
|
+
};
|
|
9971
|
+
}
|
|
9972
|
+
//#endregion
|
|
9973
|
+
//#region src/control/common/publicationResources.ts
|
|
9974
|
+
function context(source) {
|
|
9975
|
+
if (source.version != 1 || source.status != "live" && source.status != "historical") return invalidResponse();
|
|
9976
|
+
if (source.status == "live" ? typeof source.enabled != "boolean" : source.enabled !== void 0) return invalidResponse();
|
|
9977
|
+
return {
|
|
9978
|
+
flowId: string(source.flowId),
|
|
9979
|
+
publicationId: string(source.publicationId),
|
|
9980
|
+
revisionId: string(source.revisionId),
|
|
9981
|
+
status: source.status,
|
|
9982
|
+
...source.enabled == null ? {} : { enabled: source.enabled },
|
|
9983
|
+
version: 1
|
|
9984
|
+
};
|
|
9985
|
+
}
|
|
9986
|
+
function resource(value, scope) {
|
|
9987
|
+
const source = record(value);
|
|
9988
|
+
const type = source.type;
|
|
9989
|
+
if (source.kind != "trigger" || type != "webhook" && type != "cron" && type != "poll" && type != "integration" && type != "error") return invalidResponse();
|
|
9990
|
+
if (source.description != null && typeof source.description != "string") return invalidResponse();
|
|
9991
|
+
const resourceId = string(source.resourceId);
|
|
9992
|
+
const runtime = source.runtime == null ? void 0 : triggerBinding(source.runtime);
|
|
9993
|
+
if (runtime != null && (scope.status != "live" || runtime.flowId != scope.flowId || runtime.currentPublicationId != scope.publicationId || runtime.currentRevisionId != scope.revisionId || runtime.triggerNodeId != resourceId || runtime.kind != type)) return invalidResponse();
|
|
9994
|
+
return {
|
|
9995
|
+
resourceId,
|
|
9996
|
+
kind: "trigger",
|
|
9997
|
+
type,
|
|
9998
|
+
name: string(source.name),
|
|
9999
|
+
...source.description == null ? {} : { description: source.description },
|
|
10000
|
+
config: jsonValue(source.config),
|
|
10001
|
+
inputs: jsonValue(source.inputs),
|
|
10002
|
+
...runtime == null ? {} : { runtime }
|
|
10003
|
+
};
|
|
10004
|
+
}
|
|
10005
|
+
function decodePublicationResources(value) {
|
|
10006
|
+
const source = record(value);
|
|
10007
|
+
const scope = context(source);
|
|
10008
|
+
if (!Array.isArray(source.resources)) return invalidResponse();
|
|
10009
|
+
return {
|
|
10010
|
+
...scope,
|
|
10011
|
+
resources: source.resources.map((item) => resource(item, scope))
|
|
10012
|
+
};
|
|
10013
|
+
}
|
|
10014
|
+
function decodePublicationResource(value) {
|
|
10015
|
+
const source = record(value);
|
|
10016
|
+
const scope = context(source);
|
|
10017
|
+
return {
|
|
10018
|
+
...scope,
|
|
10019
|
+
resource: resource(source.resource, scope)
|
|
10020
|
+
};
|
|
10021
|
+
}
|
|
10022
|
+
//#endregion
|
|
10023
|
+
//#region src/control/common/providerIconSprite.ts
|
|
10024
|
+
/** Optional artwork must never make an otherwise usable catalog unavailable. */
|
|
10025
|
+
function providerIconAppearance(metadata, position) {
|
|
10026
|
+
if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
|
|
10027
|
+
const m = metadata;
|
|
10028
|
+
const p = position;
|
|
10029
|
+
if (typeof m.version != "string" || ![
|
|
10030
|
+
m.pixelRatio,
|
|
10031
|
+
m.iconSize,
|
|
10032
|
+
m.width,
|
|
10033
|
+
m.height
|
|
10034
|
+
].every((v) => Number.isInteger(v) && v > 0) || ![
|
|
10035
|
+
m.bleed,
|
|
10036
|
+
p.x,
|
|
10037
|
+
p.y
|
|
10038
|
+
].every((v) => Number.isInteger(v) && v >= 0) || p.x + m.iconSize > m.width || p.y + m.iconSize > m.height) return {};
|
|
10039
|
+
try {
|
|
10040
|
+
for (const url of [m.lightUrl, m.darkUrl]) if (typeof url != "string" || ![
|
|
10041
|
+
"https:",
|
|
10042
|
+
"http:",
|
|
10043
|
+
"data:"
|
|
10044
|
+
].includes(new URL(url).protocol)) return {};
|
|
10045
|
+
} catch {
|
|
10046
|
+
return {};
|
|
10047
|
+
}
|
|
10048
|
+
return {
|
|
10049
|
+
iconSprite: m,
|
|
10050
|
+
iconSpritePosition: {
|
|
10051
|
+
x: p.x,
|
|
10052
|
+
y: p.y
|
|
10053
|
+
}
|
|
10054
|
+
};
|
|
10055
|
+
}
|
|
9823
10056
|
new TextEncoder();
|
|
9824
10057
|
//#endregion
|
|
9825
10058
|
//#region src/control/common/providerAccess.ts
|
|
@@ -10236,191 +10469,6 @@ function isUiLanguage(value) {
|
|
|
10236
10469
|
return typeof value == "string" && uiLanguageTags.get(value.toLowerCase()) == value;
|
|
10237
10470
|
}
|
|
10238
10471
|
//#endregion
|
|
10239
|
-
//#region src/trigger/common/configSchema.ts
|
|
10240
|
-
var configInputsSchema = array(union([strictObject({
|
|
10241
|
-
handle: string$1().min(1),
|
|
10242
|
-
description: string$1().optional(),
|
|
10243
|
-
jsonSchema: json$4(),
|
|
10244
|
-
nullable: boolean(),
|
|
10245
|
-
value: json$4().optional()
|
|
10246
|
-
}), strictObject({
|
|
10247
|
-
group: string$1(),
|
|
10248
|
-
collapsed: boolean().optional()
|
|
10249
|
-
})]));
|
|
10250
|
-
//#endregion
|
|
10251
|
-
//#region src/control/common/triggerDecoders.ts
|
|
10252
|
-
function triggerKeySummary(value) {
|
|
10253
|
-
const source = record(value);
|
|
10254
|
-
const type = source.type;
|
|
10255
|
-
if (type != "integration" && type != "poll") return invalidResponse();
|
|
10256
|
-
return {
|
|
10257
|
-
description: typeof source.description == "string" ? source.description : invalidResponse(),
|
|
10258
|
-
displayName: string(source.displayName),
|
|
10259
|
-
key: string(source.key),
|
|
10260
|
-
name: string(source.name),
|
|
10261
|
-
provider: string(source.provider),
|
|
10262
|
-
type
|
|
10263
|
-
};
|
|
10264
|
-
}
|
|
10265
|
-
function triggerKey(value) {
|
|
10266
|
-
const source = record(value);
|
|
10267
|
-
const summary = triggerKeySummary(source);
|
|
10268
|
-
const base = {
|
|
10269
|
-
configInputs: configInputsSchema.parse(source.configInputs),
|
|
10270
|
-
definitionVersion: source.definitionVersion === 2 ? 2 : invalidResponse(),
|
|
10271
|
-
description: summary.description,
|
|
10272
|
-
displayName: summary.displayName,
|
|
10273
|
-
key: summary.key,
|
|
10274
|
-
name: summary.name,
|
|
10275
|
-
outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
|
|
10276
|
-
const port = record(entry);
|
|
10277
|
-
return Object.assign({
|
|
10278
|
-
handle: string(port.handle),
|
|
10279
|
-
jsonSchema: jsonValue(port.jsonSchema),
|
|
10280
|
-
nullable: typeof port.nullable === "boolean" ? port.nullable : invalidResponse()
|
|
10281
|
-
}, port.description == null ? {} : { description: string(port.description) });
|
|
10282
|
-
}),
|
|
10283
|
-
provider: summary.provider
|
|
10284
|
-
};
|
|
10285
|
-
if (summary.type == "poll") return {
|
|
10286
|
-
...base,
|
|
10287
|
-
type: "poll"
|
|
10288
|
-
};
|
|
10289
|
-
const endpoint = record(source.endpoint);
|
|
10290
|
-
const body = record(endpoint.body);
|
|
10291
|
-
if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
|
|
10292
|
-
const methods = endpoint.methods.map(string);
|
|
10293
|
-
const formats = body.formats.map(string);
|
|
10294
|
-
const successStatus = integer(endpoint.successStatus);
|
|
10295
|
-
if (methods.some((method) => ![
|
|
10296
|
-
"DELETE",
|
|
10297
|
-
"GET",
|
|
10298
|
-
"HEAD",
|
|
10299
|
-
"PATCH",
|
|
10300
|
-
"POST",
|
|
10301
|
-
"PUT"
|
|
10302
|
-
].includes(method)) || formats.some((format) => ![
|
|
10303
|
-
"form",
|
|
10304
|
-
"json",
|
|
10305
|
-
"multipart",
|
|
10306
|
-
"text"
|
|
10307
|
-
].includes(format)) || successStatus < 200 || successStatus > 299) return invalidResponse();
|
|
10308
|
-
return {
|
|
10309
|
-
...base,
|
|
10310
|
-
endpoint: {
|
|
10311
|
-
body: {
|
|
10312
|
-
allowArray: body.allowArray,
|
|
10313
|
-
allowEmpty: body.allowEmpty,
|
|
10314
|
-
formats
|
|
10315
|
-
},
|
|
10316
|
-
methods,
|
|
10317
|
-
successStatus
|
|
10318
|
-
},
|
|
10319
|
-
type: "integration"
|
|
10320
|
-
};
|
|
10321
|
-
}
|
|
10322
|
-
var triggerKinds = /* @__PURE__ */ new Set([
|
|
10323
|
-
"error",
|
|
10324
|
-
"cron",
|
|
10325
|
-
"integration",
|
|
10326
|
-
"poll",
|
|
10327
|
-
"webhook"
|
|
10328
|
-
]);
|
|
10329
|
-
var triggerHealth = /* @__PURE__ */ new Set([
|
|
10330
|
-
"failed",
|
|
10331
|
-
"healthy",
|
|
10332
|
-
"initializing",
|
|
10333
|
-
"needs_reauth",
|
|
10334
|
-
"suspended"
|
|
10335
|
-
]);
|
|
10336
|
-
var triggerActivityKinds = /* @__PURE__ */ new Set([
|
|
10337
|
-
"delivery.failed",
|
|
10338
|
-
"health.failed",
|
|
10339
|
-
"health.needs_reauth",
|
|
10340
|
-
"health.recovered",
|
|
10341
|
-
"health.suspended",
|
|
10342
|
-
"operator.paused",
|
|
10343
|
-
"operator.resumed"
|
|
10344
|
-
]);
|
|
10345
|
-
function triggerBinding(value) {
|
|
10346
|
-
const source = record(value);
|
|
10347
|
-
const health = source.health;
|
|
10348
|
-
const listener = source.listener == null ? void 0 : record(source.listener);
|
|
10349
|
-
if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
|
|
10350
|
-
const kind = source.kind;
|
|
10351
|
-
const operatorState = source.operatorState;
|
|
10352
|
-
const runtimeVersion = integer(source.runtimeVersion);
|
|
10353
|
-
if (source.version != 1 || typeof health != "string" || !triggerHealth.has(health)) return invalidResponse();
|
|
10354
|
-
if (typeof kind != "string" || !triggerKinds.has(kind)) return invalidResponse();
|
|
10355
|
-
if (operatorState != "active" && operatorState != "paused") return invalidResponse();
|
|
10356
|
-
if (runtimeVersion <= 0) return invalidResponse();
|
|
10357
|
-
return {
|
|
10358
|
-
...source.currentPublicationId == null ? {} : { currentPublicationId: string(source.currentPublicationId) },
|
|
10359
|
-
...source.currentRevisionId == null ? {} : { currentRevisionId: string(source.currentRevisionId) },
|
|
10360
|
-
...source.endpointUrl == null ? {} : { endpointUrl: string(source.endpointUrl) },
|
|
10361
|
-
...listener == null ? {} : { listener: {
|
|
10362
|
-
health: listener.health,
|
|
10363
|
-
...listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }
|
|
10364
|
-
} },
|
|
10365
|
-
flowId: string(source.flowId),
|
|
10366
|
-
health,
|
|
10367
|
-
kind,
|
|
10368
|
-
...source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) },
|
|
10369
|
-
operatorState,
|
|
10370
|
-
runtimeVersion,
|
|
10371
|
-
triggerNodeId: string(source.triggerNodeId),
|
|
10372
|
-
updatedAt: string(source.updatedAt),
|
|
10373
|
-
version: 1
|
|
10374
|
-
};
|
|
10375
|
-
}
|
|
10376
|
-
function triggerBindingDetail(value) {
|
|
10377
|
-
const source = record(value);
|
|
10378
|
-
if (source.version != 1) return invalidResponse();
|
|
10379
|
-
return {
|
|
10380
|
-
binding: triggerBinding(source.binding),
|
|
10381
|
-
version: 1
|
|
10382
|
-
};
|
|
10383
|
-
}
|
|
10384
|
-
function triggerActivity(value) {
|
|
10385
|
-
const source = record(value);
|
|
10386
|
-
const kind = source.kind;
|
|
10387
|
-
if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
|
|
10388
|
-
const errorCode = optionalString(source.errorCode);
|
|
10389
|
-
const errorMessage = optionalString(source.errorMessage);
|
|
10390
|
-
if (errorMessage != null && errorMessage.length > 512) return invalidResponse();
|
|
10391
|
-
return {
|
|
10392
|
-
activityId: string(source.activityId),
|
|
10393
|
-
createdAt: string(source.createdAt),
|
|
10394
|
-
...errorCode == null ? {} : { errorCode },
|
|
10395
|
-
...errorMessage == null ? {} : { errorMessage },
|
|
10396
|
-
kind
|
|
10397
|
-
};
|
|
10398
|
-
}
|
|
10399
|
-
function triggerActivityPage(value) {
|
|
10400
|
-
const source = record(value);
|
|
10401
|
-
const nextCursor = optionalString(source.nextCursor);
|
|
10402
|
-
if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
|
|
10403
|
-
return {
|
|
10404
|
-
activities: source.activities.map(triggerActivity),
|
|
10405
|
-
...nextCursor == null ? {} : { nextCursor },
|
|
10406
|
-
version: 1
|
|
10407
|
-
};
|
|
10408
|
-
}
|
|
10409
|
-
function pollTriggerTestResult(value) {
|
|
10410
|
-
const source = record(value);
|
|
10411
|
-
const filtered = integer(source.filtered);
|
|
10412
|
-
if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
|
|
10413
|
-
return {
|
|
10414
|
-
events: source.events.map((event) => {
|
|
10415
|
-
const object = record(event);
|
|
10416
|
-
return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
|
|
10417
|
-
}),
|
|
10418
|
-
filtered,
|
|
10419
|
-
hasMore: source.hasMore,
|
|
10420
|
-
version: 1
|
|
10421
|
-
};
|
|
10422
|
-
}
|
|
10423
|
-
//#endregion
|
|
10424
10472
|
//#region src/control/common/triggerCatalog.ts
|
|
10425
10473
|
function decodeTriggerCatalog(value) {
|
|
10426
10474
|
const source = record(value);
|
|
@@ -10747,6 +10795,56 @@ function errorListener(value) {
|
|
|
10747
10795
|
enabled: source.enabled
|
|
10748
10796
|
};
|
|
10749
10797
|
}
|
|
10798
|
+
function variableReferences(input) {
|
|
10799
|
+
const source = record(input);
|
|
10800
|
+
exact(source, [
|
|
10801
|
+
"version",
|
|
10802
|
+
"references",
|
|
10803
|
+
"unknown"
|
|
10804
|
+
]);
|
|
10805
|
+
if (source.version != 1 || !Array.isArray(source.references) || !Array.isArray(source.unknown)) return invalidResponse();
|
|
10806
|
+
return {
|
|
10807
|
+
version: 1,
|
|
10808
|
+
references: source.references.map((value) => {
|
|
10809
|
+
const item = record(value);
|
|
10810
|
+
exact(item, [
|
|
10811
|
+
"flowId",
|
|
10812
|
+
"flowName",
|
|
10813
|
+
"draft",
|
|
10814
|
+
"live"
|
|
10815
|
+
]);
|
|
10816
|
+
if (typeof item.draft != "boolean") return invalidResponse();
|
|
10817
|
+
const live = item.live === null ? null : record(item.live);
|
|
10818
|
+
if (live != null) {
|
|
10819
|
+
exact(live, ["publicationId", "enabled"]);
|
|
10820
|
+
if (typeof live.enabled != "boolean") return invalidResponse();
|
|
10821
|
+
}
|
|
10822
|
+
return {
|
|
10823
|
+
flowId: string(item.flowId),
|
|
10824
|
+
flowName: string(item.flowName),
|
|
10825
|
+
draft: item.draft,
|
|
10826
|
+
live: live == null ? null : {
|
|
10827
|
+
publicationId: string(live.publicationId),
|
|
10828
|
+
enabled: live.enabled
|
|
10829
|
+
}
|
|
10830
|
+
};
|
|
10831
|
+
}),
|
|
10832
|
+
unknown: source.unknown.map((value) => {
|
|
10833
|
+
const item = record(value);
|
|
10834
|
+
exact(item, [
|
|
10835
|
+
"flowId",
|
|
10836
|
+
"flowName",
|
|
10837
|
+
"scope"
|
|
10838
|
+
]);
|
|
10839
|
+
if (item.scope !== "draft" && item.scope !== "live") return invalidResponse();
|
|
10840
|
+
return {
|
|
10841
|
+
flowId: string(item.flowId),
|
|
10842
|
+
flowName: string(item.flowName),
|
|
10843
|
+
scope: item.scope
|
|
10844
|
+
};
|
|
10845
|
+
})
|
|
10846
|
+
};
|
|
10847
|
+
}
|
|
10750
10848
|
//#endregion
|
|
10751
10849
|
//#region src/control/common/publicationDecoders.ts
|
|
10752
10850
|
function publication(value) {
|
|
@@ -11441,6 +11539,9 @@ var ControlClient = class {
|
|
|
11441
11539
|
version: 1
|
|
11442
11540
|
};
|
|
11443
11541
|
}
|
|
11542
|
+
async getVariableReferences(name, signal) {
|
|
11543
|
+
return variableReferences(await this.request(`/v1/variables/${segment(name)}/references`, { signal }));
|
|
11544
|
+
}
|
|
11444
11545
|
async getVariable(name) {
|
|
11445
11546
|
return variable(await this.request(`/v1/variables/${segment(name)}`));
|
|
11446
11547
|
}
|
|
@@ -11553,18 +11654,6 @@ var ControlClient = class {
|
|
|
11553
11654
|
const query = parameters.size == 0 ? "" : `?${parameters}`;
|
|
11554
11655
|
return triggerActivityPage(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(triggerNodeId)}/activities${query}`));
|
|
11555
11656
|
}
|
|
11556
|
-
async pauseFlowTrigger(flowId, triggerNodeId) {
|
|
11557
|
-
return triggerBinding(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(triggerNodeId)}/pause`, {
|
|
11558
|
-
body: JSON.stringify({ version: 1 }),
|
|
11559
|
-
method: "POST"
|
|
11560
|
-
}));
|
|
11561
|
-
}
|
|
11562
|
-
async resumeFlowTrigger(flowId, triggerNodeId) {
|
|
11563
|
-
return triggerBinding(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(triggerNodeId)}/resume`, {
|
|
11564
|
-
body: JSON.stringify({ version: 1 }),
|
|
11565
|
-
method: "POST"
|
|
11566
|
-
}));
|
|
11567
|
-
}
|
|
11568
11657
|
async testFlowPollTrigger(flowId, triggerNodeId) {
|
|
11569
11658
|
return pollTriggerTestResult(await this.request(`/v1/flows/${segment(flowId)}/triggers/${segment(triggerNodeId)}/test`, {
|
|
11570
11659
|
body: JSON.stringify({ version: 1 }),
|
|
@@ -11823,6 +11912,18 @@ var ControlClient = class {
|
|
|
11823
11912
|
async getLive(flowId, signal) {
|
|
11824
11913
|
return live(await this.request(`/v1/flows/${segment(flowId)}/live`, { signal }));
|
|
11825
11914
|
}
|
|
11915
|
+
async listPublicationResources(flowId, publicationId) {
|
|
11916
|
+
const query = publicationId == null ? "" : `?publicationId=${encodeURIComponent(publicationId)}`;
|
|
11917
|
+
const result = decodePublicationResources(await this.request(`/v1/flows/${segment(flowId)}/resources${query}`));
|
|
11918
|
+
if (result.flowId != flowId || publicationId != null && result.publicationId != publicationId) return invalidResponse();
|
|
11919
|
+
return result;
|
|
11920
|
+
}
|
|
11921
|
+
async getPublicationResource(flowId, resourceId, publicationId) {
|
|
11922
|
+
const query = publicationId == null ? "" : `?publicationId=${encodeURIComponent(publicationId)}`;
|
|
11923
|
+
const result = decodePublicationResource(await this.request(`/v1/flows/${segment(flowId)}/resources/${segment(resourceId)}${query}`));
|
|
11924
|
+
if (result.flowId != flowId || result.resource.resourceId != resourceId || publicationId != null && result.publicationId != publicationId) return invalidResponse();
|
|
11925
|
+
return result;
|
|
11926
|
+
}
|
|
11826
11927
|
async listPublications(flowId, options = {}, signal) {
|
|
11827
11928
|
const parameters = new URLSearchParams();
|
|
11828
11929
|
if (options.cursor != null) parameters.set("cursor", options.cursor);
|
|
@@ -12184,6 +12285,15 @@ function tool(description, schema, readOnly) {
|
|
|
12184
12285
|
};
|
|
12185
12286
|
}
|
|
12186
12287
|
var mcpTools = {
|
|
12288
|
+
flow_resources: tool("List published resources, currently non-Manual Triggers. Defaults to current Live; supply publicationId for a fixed publication. Historical publications return configuration only. Live resources include current runtime state and Webhook URLs.", strictObject({
|
|
12289
|
+
flowId: flow,
|
|
12290
|
+
publicationId: id.optional()
|
|
12291
|
+
}), true),
|
|
12292
|
+
flow_resource_get: tool("Read a published resource by resourceId from flow_resources. Defaults to current Live; supply publicationId to keep the publication fixed. Historical resources have no current runtime state or callable URL.", strictObject({
|
|
12293
|
+
flowId: flow,
|
|
12294
|
+
resourceId: id,
|
|
12295
|
+
publicationId: id.optional()
|
|
12296
|
+
}), true),
|
|
12187
12297
|
flow_list: tool("List Flows in this deployment. Continue with nextCursor; cursors are compatible with the Control API.", strictObject({
|
|
12188
12298
|
cursor: id.optional(),
|
|
12189
12299
|
limit: pageLimit
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { JsonValue, RevisionContent } from '../browser/flow-change.js';
|
|
2
|
+
import type { TriggerBinding } from './control-api.js';
|
|
3
|
+
export interface PublicationResource {
|
|
4
|
+
readonly resourceId: string;
|
|
5
|
+
readonly kind: 'trigger';
|
|
6
|
+
readonly type: TriggerBinding['kind'];
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
readonly config: JsonValue;
|
|
10
|
+
readonly inputs: JsonValue;
|
|
11
|
+
readonly runtime?: TriggerBinding;
|
|
12
|
+
}
|
|
13
|
+
export interface PublicationResourceContext {
|
|
14
|
+
readonly flowId: string;
|
|
15
|
+
readonly publicationId: string;
|
|
16
|
+
readonly revisionId: string;
|
|
17
|
+
readonly status: 'live' | 'historical';
|
|
18
|
+
readonly enabled?: boolean;
|
|
19
|
+
readonly version: 1;
|
|
20
|
+
}
|
|
21
|
+
export interface PublicationResources extends PublicationResourceContext {
|
|
22
|
+
readonly resources: readonly PublicationResource[];
|
|
23
|
+
}
|
|
24
|
+
export interface PublicationResourceDetail extends PublicationResourceContext {
|
|
25
|
+
readonly resource: PublicationResource;
|
|
26
|
+
}
|
|
27
|
+
export declare function publicationResources(content: RevisionContent): readonly PublicationResource[];
|
|
28
|
+
export declare function decodePublicationResources(value: unknown): PublicationResources;
|
|
29
|
+
export declare function decodePublicationResource(value: unknown): PublicationResourceDetail;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oomol-lab/open-flow",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.61",
|
|
4
4
|
"description": "TypeScript contracts and Browser runtime for Open Flow.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
|
+
"./command": {
|
|
14
|
+
"types": "./dist/command/index.d.ts",
|
|
15
|
+
"import": "./dist/command/index.js"
|
|
16
|
+
},
|
|
13
17
|
"./package.json": "./package.json",
|
|
14
18
|
"./skills/open-flow/SKILL.md": "./skills/open-flow/SKILL.md",
|
|
15
19
|
"./skills/open-flow/references/flow-authoring.md": "./skills/open-flow/references/flow-authoring.md",
|