@bpmnkit/core 1.2.0 → 1.3.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.
Files changed (50) hide show
  1. package/README.md +26 -0
  2. package/dist/bpmn/bpmn-builder.d.ts +8 -0
  3. package/dist/bpmn/bpmn-builder.js +6 -2
  4. package/dist/bpmn/compact.d.ts +33 -5
  5. package/dist/bpmn/compact.js +138 -30
  6. package/dist/bpmn/connector-line.d.ts +46 -0
  7. package/dist/bpmn/connector-line.js +135 -0
  8. package/dist/bpmn/optimize/patterns.js +1 -3
  9. package/dist/bpmn/process-delta.d.ts +3 -0
  10. package/dist/bpmn/process-delta.js +23 -0
  11. package/dist/bpmn/process-text-writer.d.ts +12 -2
  12. package/dist/bpmn/process-text-writer.js +10 -1
  13. package/dist/bpmn/process-text.d.ts +26 -1
  14. package/dist/bpmn/process-text.js +329 -16
  15. package/dist/bpmn/rest-connector.d.ts +6 -0
  16. package/dist/bpmn/rest-connector.js +6 -0
  17. package/dist/bpmn/secrets.d.ts +15 -0
  18. package/dist/bpmn/secrets.js +59 -0
  19. package/dist/bpmn/utils.js +4 -0
  20. package/dist/bpmn/zeebe-extensions.d.ts +10 -0
  21. package/dist/bpmn/zeebe-extensions.js +7 -0
  22. package/dist/connectors/aliases.d.ts +21 -0
  23. package/dist/connectors/aliases.js +272 -0
  24. package/dist/connectors/api.d.ts +118 -0
  25. package/dist/connectors/api.js +280 -0
  26. package/dist/connectors/apply-element.d.ts +59 -0
  27. package/dist/connectors/apply-element.js +385 -0
  28. package/dist/connectors/apply.d.ts +136 -0
  29. package/dist/connectors/apply.js +352 -0
  30. package/dist/connectors/cards.d.ts +96 -0
  31. package/dist/connectors/cards.js +306 -0
  32. package/dist/connectors/catalog.d.ts +79 -0
  33. package/dist/connectors/catalog.js +209 -0
  34. package/dist/connectors/index.d.ts +33 -0
  35. package/dist/connectors/index.js +24 -0
  36. package/dist/connectors/lines.d.ts +108 -0
  37. package/dist/connectors/lines.js +568 -0
  38. package/dist/connectors/select.d.ts +85 -0
  39. package/dist/connectors/select.js +419 -0
  40. package/dist/connectors/template-types.d.ts +188 -0
  41. package/dist/connectors/template-types.js +6 -0
  42. package/dist/connectors/templates/bpmnkit.d.ts +12 -0
  43. package/dist/connectors/templates/bpmnkit.js +186 -0
  44. package/dist/connectors/templates/generated.d.ts +3 -0
  45. package/dist/connectors/templates/generated.js +95885 -0
  46. package/dist/connectors/validate.d.ts +66 -0
  47. package/dist/connectors/validate.js +271 -0
  48. package/dist/index.d.ts +7 -3
  49. package/dist/index.js +2 -0
  50. package/package.json +5 -1
@@ -0,0 +1,188 @@
1
+ /**
2
+ * TypeScript types matching the Camunda element template JSON schema.
3
+ * https://github.com/camunda/element-templates-json-schema
4
+ */
5
+ export interface ElementTemplate {
6
+ /** Unique template identifier (reverse-domain, e.g. "io.camunda.connectors.HttpJson.v2"). */
7
+ id: string;
8
+ /** Display name shown in the template catalog. */
9
+ name: string;
10
+ /** Short description. */
11
+ description?: string;
12
+ /** Integer version; templates with the same id + different version are distinct. */
13
+ version?: number;
14
+ /** BPMN element types this template applies to (e.g. "bpmn:ServiceTask", "bpmn:Task"). */
15
+ appliesTo: string[];
16
+ /**
17
+ * Forces the element to be converted to this type on apply. `eventDefinition`
18
+ * (e.g. `"bpmn:MessageEventDefinition"`) makes an event the matching kind.
19
+ */
20
+ elementType?: {
21
+ value: string;
22
+ eventDefinition?: string;
23
+ };
24
+ /** UI section definitions (collapsible groups). */
25
+ groups?: TemplateGroup[];
26
+ /** All property definitions. */
27
+ properties: TemplateProperty[];
28
+ /** Link to external documentation. */
29
+ documentationRef?: string;
30
+ /** Custom icon: { contents: "data:image/svg+xml;base64,..." } */
31
+ icon?: {
32
+ contents: string;
33
+ };
34
+ /** Groups the template with others of its kind in a template chooser. */
35
+ category?: {
36
+ id: string;
37
+ name: string;
38
+ };
39
+ }
40
+ export interface TemplateGroup {
41
+ id: string;
42
+ label: string;
43
+ tooltip?: string;
44
+ openByDefault?: boolean;
45
+ }
46
+ export interface TemplateProperty {
47
+ /** Unique key used in condition references. Falls back to binding name if absent. */
48
+ id?: string;
49
+ /** Label shown above the input. Hidden properties have no label. */
50
+ label?: string;
51
+ /** Hint text shown below the input. */
52
+ description?: string;
53
+ /**
54
+ * UI control type. `Configuration` (Camunda 8.10+) picks a reusable connection
55
+ * credential saved in the cluster; its value is a reference to it, bound like
56
+ * any other input, and {@link TemplateProperty.configurationTemplate} names
57
+ * the kind of credential.
58
+ */
59
+ type: "String" | "Text" | "Hidden" | "Dropdown" | "Boolean" | "Number" | "Configuration";
60
+ /** For a `Configuration` property: the kind of credential, e.g. `io.camunda:aws-credential:1`. */
61
+ configurationTemplate?: string;
62
+ /** Default value applied when the template is first used. */
63
+ value?: string | number | boolean;
64
+ /**
65
+ * A value generated once per element when none is given — inbound templates
66
+ * use it for a unique message name. `applyTemplateToElement` derives it from
67
+ * the template and element ids, so re-applying produces the same value.
68
+ */
69
+ generatedValue?: {
70
+ type: "uuid";
71
+ };
72
+ /** Placeholder text. */
73
+ placeholder?: string;
74
+ /** If true, empty values are not written to the BPMN XML. */
75
+ optional?: boolean;
76
+ /** FEEL expression mode (only relevant for String/Text). */
77
+ feel?: "optional" | "required" | "static";
78
+ /** Which template group this property belongs to. */
79
+ group?: string;
80
+ /** Tooltip text. */
81
+ tooltip?: string;
82
+ /** How this property maps to the BPMN XML. */
83
+ binding: TemplateBinding;
84
+ /** Conditional visibility. */
85
+ condition?: TemplateCondition;
86
+ /** Required for Dropdown type. */
87
+ choices?: Array<{
88
+ name: string;
89
+ value: string;
90
+ }>;
91
+ /** Validation constraints. */
92
+ constraints?: {
93
+ notEmpty?: boolean;
94
+ minLength?: number;
95
+ maxLength?: number;
96
+ pattern?: string | {
97
+ value: string;
98
+ message: string;
99
+ };
100
+ };
101
+ }
102
+ /** All supported binding types. */
103
+ export type TemplateBinding = {
104
+ type: "property";
105
+ name: string;
106
+ }
107
+ /**
108
+ * Camunda's legacy spelling of the binding below, superseded upstream by
109
+ * `{ type: "zeebe:taskDefinition", property: "type" }`.
110
+ *
111
+ * Not deprecated *here*, and not going anywhere: templates in the wild — the
112
+ * bundled catalogue included — still use it, and `apply`, `catalog` and
113
+ * `validate` all handle it. Under the stability policy a template that
114
+ * validates today does not stop validating, so this member stays in the union
115
+ * however long upstream keeps the form alive. Prefer the newer spelling when
116
+ * authoring; expect this one when reading.
117
+ */
118
+ | {
119
+ type: "zeebe:taskDefinition:type";
120
+ } | {
121
+ type: "zeebe:taskDefinition";
122
+ property: "type" | "retries";
123
+ } | {
124
+ type: "zeebe:input";
125
+ name: string;
126
+ } | {
127
+ type: "zeebe:output";
128
+ source: string;
129
+ } | {
130
+ type: "zeebe:taskHeader";
131
+ key: string;
132
+ } | {
133
+ type: "zeebe:property";
134
+ name: string;
135
+ } | {
136
+ type: "zeebe:adHoc";
137
+ property: "outputCollection" | "outputElement" | "activeElementsCollection";
138
+ }
139
+ /** `zeebe:agentDefinition` (Camunda 8.10+), used by the AI Agent v2 templates. */
140
+ | {
141
+ type: "zeebe:agentDefinition";
142
+ property: "agentType";
143
+ }
144
+ /**
145
+ * Inbound-connector bindings — the root `bpmn:Message` an event or receive
146
+ * task references, and that message's `zeebe:subscription` — and the
147
+ * `zeebe:linkedResources` binding used by RPA templates.
148
+ */
149
+ | {
150
+ type: "bpmn:Message#property";
151
+ name: string;
152
+ } | {
153
+ type: "bpmn:Message#zeebe:subscription#property";
154
+ name: string;
155
+ } | {
156
+ type: "zeebe:linkedResource";
157
+ property: string;
158
+ linkName: string;
159
+ };
160
+ /** Condition controlling whether a property is shown in the UI. */
161
+ export type TemplateCondition = {
162
+ property: string;
163
+ equals: string;
164
+ type?: string;
165
+ } | {
166
+ property: string;
167
+ oneOf: string[];
168
+ type?: string;
169
+ } | {
170
+ property: string;
171
+ isActive: boolean;
172
+ type?: string;
173
+ }
174
+ /** `true`: the property has no value. Used by Camunda 8.10 templates beside a saved credential. */
175
+ | {
176
+ property: string;
177
+ isEmpty: boolean;
178
+ type?: string;
179
+ } | {
180
+ allMatch: Array<{
181
+ property: string;
182
+ equals?: string;
183
+ oneOf?: string[];
184
+ isActive?: boolean;
185
+ isEmpty?: boolean;
186
+ }>;
187
+ };
188
+ //# sourceMappingURL=template-types.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * TypeScript types matching the Camunda element template JSON schema.
3
+ * https://github.com/camunda/element-templates-json-schema
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=template-types.js.map
@@ -0,0 +1,12 @@
1
+ import type { ElementTemplate } from "../template-types.js";
2
+ /**
3
+ * Element templates written and maintained in this repo, not mirrored from the
4
+ * Camunda marketplace.
5
+ *
6
+ * Kept apart from `generated.ts`, which `pnpm update-connectors` overwrites.
7
+ * Each one runs on a connector the Camunda runtime already ships (the REST
8
+ * connector, `io.camunda:http-json:1`), so a cluster needs no extra job worker
9
+ * to use it.
10
+ */
11
+ export declare const BPMNKIT_CONNECTOR_TEMPLATES: ElementTemplate[];
12
+ //# sourceMappingURL=bpmnkit.d.ts.map
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Element templates written and maintained in this repo, not mirrored from the
3
+ * Camunda marketplace.
4
+ *
5
+ * Kept apart from `generated.ts`, which `pnpm update-connectors` overwrites.
6
+ * Each one runs on a connector the Camunda runtime already ships (the REST
7
+ * connector, `io.camunda:http-json:1`), so a cluster needs no extra job worker
8
+ * to use it.
9
+ */
10
+ export const BPMNKIT_CONNECTOR_TEMPLATES = [
11
+ {
12
+ name: "Cloudflare Clef Decision",
13
+ id: "io.bpmnkit.connectors.CloudflareClef.v1",
14
+ version: 1,
15
+ description: "Classify process data with a Cloudflare Clef decision model — yes/no, choice and score answers with calibrated probabilities, for routing a gateway",
16
+ documentationRef: "https://bpmnkit.com/docs/guides/ai-decisions",
17
+ category: { id: "ai-decisions", name: "AI decisions" },
18
+ appliesTo: ["bpmn:Task"],
19
+ elementType: { value: "bpmn:ServiceTask" },
20
+ groups: [
21
+ { id: "authentication", label: "Authentication" },
22
+ { id: "model", label: "Model" },
23
+ { id: "decision", label: "Decision" },
24
+ { id: "timeout", label: "Connection timeout" },
25
+ { id: "output", label: "Output mapping" },
26
+ { id: "errors", label: "Error handling" },
27
+ { id: "retries", label: "Retries" },
28
+ ],
29
+ properties: [
30
+ {
31
+ type: "Hidden",
32
+ value: "io.camunda:http-json:1",
33
+ binding: { type: "zeebe:taskDefinition", property: "type" },
34
+ },
35
+ {
36
+ type: "Hidden",
37
+ value: "POST",
38
+ binding: { type: "zeebe:input", name: "method" },
39
+ },
40
+ {
41
+ type: "Hidden",
42
+ value: "bearer",
43
+ binding: { type: "zeebe:input", name: "authentication.type" },
44
+ },
45
+ {
46
+ id: "authentication.token",
47
+ label: "API token",
48
+ description: "A Cloudflare API token with Workers AI read permission",
49
+ type: "String",
50
+ group: "authentication",
51
+ value: "{{secrets.CLOUDFLARE_API_TOKEN}}",
52
+ feel: "optional",
53
+ binding: { type: "zeebe:input", name: "authentication.token" },
54
+ constraints: { notEmpty: true },
55
+ },
56
+ {
57
+ id: "accountId",
58
+ label: "Account ID",
59
+ description: "The Cloudflare account that runs the model",
60
+ type: "String",
61
+ group: "authentication",
62
+ value: "{{secrets.CLOUDFLARE_ACCOUNT_ID}}",
63
+ feel: "optional",
64
+ binding: { type: "zeebe:input", name: "cloudflareAccountId" },
65
+ constraints: { notEmpty: true },
66
+ },
67
+ {
68
+ id: "model",
69
+ label: "Model",
70
+ description: "Clef is the more accurate model and reads images; Clef-flash answers in a fraction of the time",
71
+ type: "Dropdown",
72
+ group: "model",
73
+ value: "clef",
74
+ choices: [
75
+ { name: "Clef", value: "clef" },
76
+ { name: "Clef-flash", value: "clef-flash" },
77
+ ],
78
+ binding: { type: "zeebe:input", name: "body.model" },
79
+ },
80
+ // The model id appears in the path as well as the body. One URL per
81
+ // choice keeps the two from drifting apart; the account id comes from
82
+ // the input mapping above, which Zeebe applies first.
83
+ {
84
+ id: "url.clef",
85
+ type: "Hidden",
86
+ value: '="https://api.cloudflare.com/client/v4/accounts/" + cloudflareAccountId + "/ai/run/@cf/cloudflare/clef"',
87
+ binding: { type: "zeebe:input", name: "url" },
88
+ condition: { property: "model", equals: "clef" },
89
+ },
90
+ {
91
+ id: "url.clefFlash",
92
+ type: "Hidden",
93
+ value: '="https://api.cloudflare.com/client/v4/accounts/" + cloudflareAccountId + "/ai/run/@cf/cloudflare/clef-flash"',
94
+ binding: { type: "zeebe:input", name: "url" },
95
+ condition: { property: "model", equals: "clef-flash" },
96
+ },
97
+ {
98
+ id: "body.state",
99
+ label: "State",
100
+ description: "What the model evaluates: text, or a context or list such as a ticket, a record or a chat log. Long text is truncated to the 64k-token context.",
101
+ type: "Text",
102
+ group: "decision",
103
+ feel: "required",
104
+ binding: { type: "zeebe:input", name: "body.state" },
105
+ constraints: { notEmpty: true },
106
+ },
107
+ {
108
+ id: "body.questions",
109
+ label: "Questions",
110
+ description: 'A context of 1 to 64 questions keyed by id. Each has a type — "noul" (yes/no), "choice" (one of the keys in criteria) or "score" (a list of levels, lowest first) — and instructions. Answers come back under the same ids.',
111
+ type: "Text",
112
+ group: "decision",
113
+ feel: "required",
114
+ binding: { type: "zeebe:input", name: "body.questions" },
115
+ constraints: { notEmpty: true },
116
+ },
117
+ {
118
+ id: "body.images",
119
+ label: "Images",
120
+ description: "Optional. Up to 4 base64 data URLs (PNG, JPEG or WebP), 4 MiB each and 8 MiB in total, placed before the state. Remote URLs are not accepted.",
121
+ type: "Text",
122
+ group: "decision",
123
+ feel: "required",
124
+ optional: true,
125
+ binding: { type: "zeebe:input", name: "body.images" },
126
+ },
127
+ {
128
+ label: "Connection timeout in seconds",
129
+ type: "Number",
130
+ group: "timeout",
131
+ value: "=20",
132
+ feel: "static",
133
+ binding: { type: "zeebe:input", name: "connectionTimeoutInSeconds" },
134
+ },
135
+ {
136
+ label: "Read timeout in seconds",
137
+ type: "Number",
138
+ group: "timeout",
139
+ value: "=20",
140
+ feel: "static",
141
+ binding: { type: "zeebe:input", name: "readTimeoutInSeconds" },
142
+ },
143
+ {
144
+ label: "Result variable",
145
+ description: "Stores the whole response (status, headers and body) in this variable",
146
+ type: "String",
147
+ group: "output",
148
+ binding: { type: "zeebe:taskHeader", key: "resultVariable" },
149
+ },
150
+ {
151
+ id: "resultExpression",
152
+ label: "Result expression",
153
+ description: "Workers AI wraps the model's answer in result. The default keeps the answers, keyed by question id, in the variable clef.",
154
+ type: "Text",
155
+ group: "output",
156
+ value: "={clef: response.body.result.answers}",
157
+ feel: "required",
158
+ binding: { type: "zeebe:taskHeader", key: "resultExpression" },
159
+ },
160
+ {
161
+ label: "Error expression",
162
+ description: "Raise a BPMN error or incident from the response",
163
+ type: "Text",
164
+ group: "errors",
165
+ feel: "required",
166
+ binding: { type: "zeebe:taskHeader", key: "errorExpression" },
167
+ },
168
+ {
169
+ label: "Retries",
170
+ type: "String",
171
+ group: "retries",
172
+ value: "3",
173
+ binding: { type: "zeebe:taskDefinition", property: "retries" },
174
+ },
175
+ {
176
+ label: "Retry backoff",
177
+ description: "ISO-8601 duration to wait between retries",
178
+ type: "String",
179
+ group: "retries",
180
+ value: "PT0S",
181
+ binding: { type: "zeebe:taskHeader", key: "retryBackoff" },
182
+ },
183
+ ],
184
+ },
185
+ ];
186
+ //# sourceMappingURL=bpmnkit.js.map
@@ -0,0 +1,3 @@
1
+ import type { ElementTemplate } from "../template-types.js";
2
+ export declare const BUNDLED_CONNECTOR_TEMPLATES: readonly ElementTemplate[];
3
+ //# sourceMappingURL=generated.d.ts.map