app_bridge 5.0.0-x86_64-linux → 6.0.0-x86_64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42a6e98398ec928fdd633a6062f47600331ddee76382366fafbc87b5fcecc2f4
4
- data.tar.gz: de9cb9e4c3169a3f9e70d57eff0a585dc7bc0620fb29e1cc7aa5aab412093728
3
+ metadata.gz: 478f0a1d4512c781f1c0c642ec76584ef75c42c04f5b5f14fafcc4e101c0dd99
4
+ data.tar.gz: a219fd3f5ebb2ac44b8041ca8669f700b2045f4a6e7e66327d2f8f4feb205d14
5
5
  SHA512:
6
- metadata.gz: 2dd0825cdcba66bd2862ba78937e8f5ccb58856f95c503a9fb25577c5c4f49540c3a6ff15e91c8c2a0e21a0d94062b6f60506070695d04a5cba75d8c5a55e675
7
- data.tar.gz: 0aff9c1d8fe5ac5c0f85303e50dc13df59848d11e5559b9cf86a197af01a93d74ddd813fa640d32a9959e65ab27efa01ce792827bbae23dfe8d47d4fceba25f9
6
+ metadata.gz: aa57efbe740fa830d1ce736f0c368716dfefccab695d62cef93ecb2c648b159fc1b7d73d4b1cb8807055830c62fd08857a081e9be53a3fd9357727e611b4ac3a
7
+ data.tar.gz: 3c1261a3df920129e967c376b753d185caec16afde942f84ebba0bc10fc6900ba3d927553557b99636d28d5e5588eae694c4baea2840a05fa0f876468b679bcb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [6.0.0]
4
+
5
+ - Read action and trigger schemas without a connection with WIT 6. For earlier binaries, schema reads try an empty in-memory connection and return `connection_required` if the call fails.
6
+
3
7
  ## [0.1.0] - 2025-01-27
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -316,7 +316,7 @@ Connectors embed `connection-config.json` via `include_str!` and export it throu
316
316
  To contribute or modify this gem, ensure you have the following dependencies installed:
317
317
 
318
318
  - **Ruby 3.3.0** (or later)
319
- - **Rust 1.84.0** (or later)
319
+ - **Rust 1.97.0** (or later)
320
320
 
321
321
  ### Setting Up the Development Environment
322
322
 
@@ -0,0 +1,385 @@
1
+ package standout:app@6.0.0;
2
+
3
+ interface types {
4
+ // The trigger-store is a string that is used to store data between trigger
5
+ // invocations. It is unique per trigger instance and is persisted between
6
+ // invocations.
7
+ //
8
+ // You can store any string here. We suggest that you use a serialized
9
+ // JSON object or similar since that will give you some flexibility if you
10
+ // need to add more data to the store.
11
+ type trigger-store = string;
12
+
13
+ record connection {
14
+ id: string,
15
+ name: string,
16
+ // The connection data is a JSON object serialized into a string. The JSON root
17
+ // will always be an object.
18
+ serialized-data: string,
19
+ }
20
+
21
+ record trigger-context {
22
+ // Trigger ID is a unique identifier for the trigger that is requested to be
23
+ // invoked.
24
+ trigger-id: string,
25
+
26
+ // The connection that the trigger is invoked for.
27
+ // Connection is required for all trigger operations.
28
+ connection: connection,
29
+
30
+ // The store will contain the data that was stored in the trigger store the
31
+ // last time the trigger was invoked.
32
+ store: trigger-store,
33
+
34
+ // The input data for the trigger, serialized as a JSON object string.
35
+ // This contains the input data from the trigger configuration form.
36
+ serialized-input: string,
37
+ }
38
+
39
+ record action-context {
40
+ // Action ID is a unique identifier for the action that is requested to be
41
+ // invoked.
42
+ action-id: string,
43
+
44
+ // The connection that the action is invoked for.
45
+ // Connection is required for all action operations.
46
+ connection: connection,
47
+
48
+ // The input data for the action, serialized as a JSON object string.
49
+ // This contains the data passed from the previous step in the workflow.
50
+ serialized-input: string,
51
+
52
+ // Optional reference information when the platform retries an action.
53
+ reference-object: option<reference-object>,
54
+ }
55
+
56
+ /// JSON Schema Draft 2020-12, independently for each direction.
57
+ variant schema-response {
58
+ complete(string),
59
+ /// Known fields; choosing a connection may reveal additional fields.
60
+ partial(string),
61
+ connection-required,
62
+ }
63
+
64
+ record action-schema-context {
65
+ action-id: string,
66
+ connection: option<connection>,
67
+ serialized-input: string,
68
+ reference-object: option<reference-object>,
69
+ }
70
+
71
+ record trigger-schema-context {
72
+ trigger-id: string,
73
+ connection: option<connection>,
74
+ store: trigger-store,
75
+ serialized-input: string,
76
+ }
77
+
78
+ record trigger-response {
79
+ // The trigger events, each event will be used to spawn a new workflow
80
+ // execution in Standouts integration platform.
81
+ events: list<trigger-event>,
82
+
83
+ // The updated store will be stored and used the next time the trigger is
84
+ // invoked.
85
+ store: trigger-store,
86
+ }
87
+
88
+ record action-response {
89
+ // The output data from the action, serialized as a JSON object string.
90
+ // This contains the data that will be passed to the next step in the workflow.
91
+ // The data must be a valid JSON object (not an array or primitive).
92
+ serialized-output: string
93
+ }
94
+
95
+ record trigger-event {
96
+ // The ID of the trigger event
97
+ //
98
+ // If the connection used for the given instance of the trigger is the same,
99
+ // as seen before. Then the event will be ignored.
100
+ //
101
+ // A scheduler could therefore use a timestamp as the ID, to ensure that
102
+ // the event is only triggered once per given time.
103
+ //
104
+ // A trigger that acts on created orders in a e-commerce system could use
105
+ // the order ID as the ID, to ensure that the event is only triggered once
106
+ // per order.
107
+ //
108
+ // A trigger that acts on updated orders in a e-commerce system could use
109
+ // the order ID in combination with an updated at timestamp as the ID, to
110
+ // ensure that the event is only triggered once per order update.
111
+ id: string,
112
+
113
+ // Serialized data must be a JSON object serialized into a string
114
+ // Note that it is important that the root is an object, not an array,
115
+ // or another primitive type.
116
+ serialized-data: string,
117
+ }
118
+
119
+ /// Retry reference payload returned with error-code.retry-with-reference.
120
+ record reference-object {
121
+ /// Reference ID provided for retrying this request later.
122
+ reference: string,
123
+
124
+ /// Status describing the retry state.
125
+ status: string,
126
+ }
127
+
128
+ record app-error {
129
+ /// The error code identifying the type of failure.
130
+ code: error-code,
131
+
132
+ /// A human-readable message describing the error in more detail.
133
+ message: string,
134
+ }
135
+
136
+ /// An enumeration of error codes that can be returned by a trigger implementation.
137
+ /// These codes help the platform and plugin developers distinguish between different types of failures.
138
+ variant error-code {
139
+ /// Authentication failed. Typically due to an invalid or expired API key or token.
140
+ unauthenticated,
141
+
142
+ /// Authorization failed. The connection is valid but does not have the necessary permissions.
143
+ forbidden,
144
+
145
+ /// The trigger is misconfigured. For example, a required setting is missing or invalid.
146
+ misconfigured,
147
+
148
+ /// The target system does not support a required feature or endpoint.
149
+ unsupported,
150
+
151
+ /// The target system is rate-limiting requests. Try again later.
152
+ rate-limit,
153
+
154
+ /// The request timed out. The target system did not respond in time.
155
+ timeout,
156
+
157
+ /// The target system is currently unavailable or unreachable.
158
+ unavailable,
159
+
160
+ /// An unexpected internal error occurred in the plugin.
161
+ internal-error,
162
+
163
+ /// The response from the external system could not be parsed or was in an invalid format.
164
+ malformed-response,
165
+
166
+ /// A catch-all for all other types of errors. Should include a descriptive message.
167
+ other,
168
+
169
+ /// Retry the request using a reference identifier.
170
+ retry-with-reference(reference-object),
171
+
172
+ /// Complete the current workflow execution.
173
+ complete-workflow,
174
+
175
+ /// Complete the parent step execution.
176
+ complete-parent,
177
+ }
178
+ }
179
+
180
+
181
+ interface triggers {
182
+ use types.{trigger-schema-context, schema-response, trigger-context, trigger-event, trigger-response, app-error};
183
+
184
+ trigger-ids: func() -> result<list<string>, app-error>;
185
+
186
+ // Get the input schema for a specific trigger
187
+ // Returns a JSON Schema Draft 2020-12 schema as a string
188
+ // The schema may vary based on the connection in the context
189
+ // The trigger-id is extracted from the context
190
+ input-schema: func(context: trigger-schema-context) -> result<schema-response, app-error>;
191
+
192
+ // Get the output schema for a specific trigger
193
+ // Returns a JSON Schema Draft 2020-12 schema as a string
194
+ // The schema may vary based on the connection in the context
195
+ // The trigger-id is extracted from the context
196
+ output-schema: func(context: trigger-schema-context) -> result<schema-response, app-error>;
197
+
198
+ // Fetch events
199
+ //
200
+ // There are some limitations to the function:
201
+ // - It must return a `trigger-response` within 30 seconds
202
+ // - It must return less than or equal to 100 `trigger-response.events`
203
+ // - It must not return more than 64 kB of data in the `trigger-response.store`
204
+ //
205
+ // If you need to fetch more events, you can return up to 100 events and then
206
+ // store the data needed for you to remember where you left off in the store.
207
+ // The next time the trigger is invoked, you can use the store to continue
208
+ // where you left off.
209
+ //
210
+ // If you do not pass the limitations the return value will be ignored. We
211
+ // will not handle any events and we persist the store that was returned in
212
+ // the response.
213
+ //
214
+ // That also means that you should implement your fetch event function in a
215
+ // way that it can be called multiple times using the same context and return
216
+ // the same events. That will ensure that the user that is building an
217
+ // integration with your trigger will not miss any events if your system is
218
+ // down for a short period of time.
219
+ fetch-events: func(context: trigger-context) -> result<trigger-response, app-error>;
220
+ }
221
+
222
+ interface actions {
223
+ use types.{action-schema-context, schema-response, action-context, action-response, app-error};
224
+
225
+ action-ids: func() -> result<list<string>, app-error>;
226
+
227
+ // Get the input schema for a specific action
228
+ // Returns a JSON Schema Draft 2020-12 schema as a string
229
+ // The schema may vary based on the connection in the context
230
+ // The action-id is extracted from the context
231
+ input-schema: func(context: action-schema-context) -> result<schema-response, app-error>;
232
+
233
+ // Get the output schema for a specific action
234
+ // Returns a JSON Schema Draft 2020-12 schema as a string
235
+ // The schema may vary based on the connection in the context
236
+ // The action-id is extracted from the context
237
+ output-schema: func(context: action-schema-context) -> result<schema-response, app-error>;
238
+
239
+ // Execute an action
240
+ //
241
+ // There are some limitations to the function:
242
+ // - It must return an `action-response` within 30 seconds
243
+ // - The serialized-output must be a valid JSON object serialized as a string
244
+ //
245
+ // Actions can perform various operations such as:
246
+ // - Making HTTP requests to external APIs
247
+ // - Processing and transforming data
248
+ // - Storing data for future use
249
+ // - Triggering other systems or workflows
250
+ //
251
+ // The action receives input data from the previous step and can return
252
+ // serialized output data to be passed to the next step in the workflow.
253
+ execute: func(context: action-context) -> result<action-response, app-error>;
254
+ }
255
+
256
+ interface environment {
257
+ // Get all environment variables
258
+ env-vars: func() -> list<tuple<string, string>>;
259
+ // Get a specific environment variable by name
260
+ env-var: func(name: string) -> option<string>;
261
+ }
262
+
263
+ interface http {
264
+ record response {
265
+ status: u16,
266
+ headers: headers,
267
+ body: string,
268
+ /// Raw response payload for binary responses.
269
+ body-bytes: option<list<u8>>,
270
+ }
271
+
272
+ record request {
273
+ method: method,
274
+ url: string,
275
+ headers: headers,
276
+ body: string,
277
+ }
278
+
279
+ variant request-error {
280
+ other(string)
281
+ }
282
+
283
+ type headers = list<tuple<string, string>>;
284
+
285
+ resource request-builder {
286
+ constructor();
287
+
288
+ method: func(method: method) -> request-builder;
289
+ url: func(url: string) -> request-builder;
290
+
291
+ // Add a header to the request
292
+ header: func(key: string, value: string) -> request-builder;
293
+ headers: func(headers: list<tuple<string, string>>) -> request-builder;
294
+
295
+ // Add a body to the request
296
+ body: func(body: string) -> request-builder;
297
+ // Add a binary body to the request
298
+ body-bytes: func(body: list<u8>) -> request-builder;
299
+
300
+ object: func() -> request;
301
+
302
+ // Send the request
303
+ send: func() -> result<response, request-error>;
304
+ }
305
+
306
+ variant method {
307
+ get,
308
+ post,
309
+ put,
310
+ delete,
311
+ patch,
312
+ options,
313
+ head,
314
+ }
315
+ }
316
+
317
+ interface file {
318
+ // HTTP headers for file requests (same as http interface)
319
+ type headers = list<tuple<string, string>>;
320
+
321
+ // Normalized file data
322
+ record file-data {
323
+ // Base64-encoded file content
324
+ base64: string,
325
+ // MIME type (e.g., "application/pdf")
326
+ content-type: string,
327
+ // Filename
328
+ filename: string,
329
+ }
330
+
331
+ variant file-error {
332
+ // Failed to fetch file from URL
333
+ fetch-failed(string),
334
+ // Invalid input format (not a valid URL, data URI, or base64)
335
+ invalid-input(string),
336
+ // Request timed out
337
+ timeout(string),
338
+ // Any other error
339
+ other(string),
340
+ }
341
+
342
+ // Normalize any file source to FileData
343
+ //
344
+ // The source is automatically detected:
345
+ // - URL: "https://example.com/file.pdf" - fetched with optional headers
346
+ // - Data URI: "data:application/pdf;base64,JVBERi0..." - parsed and extracted
347
+ // - Base64: Any other string is treated as raw base64 - decoded to detect type
348
+ //
349
+ // Parameters:
350
+ // - source: URL, data URI, or base64-encoded content
351
+ // - headers: Optional HTTP headers for URL requests (e.g., Authorization)
352
+ // - filename: Optional filename override (auto-detected if not provided)
353
+ //
354
+ // Returns file-data which will be processed by the platform:
355
+ // 1. Fields with format: "file-output" in the output schema are identified
356
+ // 2. File data is uploaded using the configured file_uploader
357
+ // 3. The file-data is replaced with the blob ID in the response
358
+ normalize: func(source: string, headers: option<headers>, filename: option<string>) -> result<file-data, file-error>;
359
+ }
360
+
361
+ // Connection configuration for app-defined connectors.
362
+ //
363
+ // The connector is stateless. It declares how users connect and what runtime
364
+ // data actions/triggers receive. The platform stores credentials and handles
365
+ // OAuth flows, token refresh, and building serialized-data for execution.
366
+ //
367
+ // connection-config returns a JSON string.
368
+ // It is not validated in WASM. app_bridge validates exported JSON against
369
+ // connection-config-schema.json (see ext/app_bridge/docs/) using AppBridge::ConnectionConfigValidator.
370
+ // Connector authors can run the same validator on JSON in CI without loading WASM.
371
+ // integrationer persists connection_config_data,
372
+ // and reads stored JSON at runtime — not a live WASM call.
373
+ interface connections {
374
+ // Returns the embedded connection-config JSON document as a string.
375
+ connection-config: func() -> string;
376
+ }
377
+
378
+ world bridge {
379
+ import http;
380
+ import environment;
381
+ import file;
382
+ export triggers;
383
+ export actions;
384
+ export connections;
385
+ }
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: data/lib/app_bridge/3.3/app_bridge.so
3
- size: 41665600 bytes
4
- sha256: 12f2a463d1e0328b5e0c41ebdafca488b4bd92598173c0f74bba135d9a7b2bd1
3
+ size: 41351616 bytes
4
+ sha256: 8b4640e11d8d5d6eae58459173875b64a65da6d7fc9c014c8ee1415b7b04f36d
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: data/lib/app_bridge/3.4/app_bridge.so
3
- size: 41660784 bytes
4
- sha256: 84fee6913bd25d5d9efabb1b75ba53a839f33ed930c6eaf1c456f8a09af8741e
3
+ size: 41351320 bytes
4
+ sha256: ac7ea70cc0a2ba0743b6365774360c0cfe05ada226ab2ac6686f8f619fd1799e
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: data/lib/app_bridge/4.0/app_bridge.so
3
- size: 41660352 bytes
4
- sha256: 20f0612d230a6acbdf96a578179123623ff98a43c3d792d85b81de8fd5ec3b4c
3
+ size: 41351408 bytes
4
+ sha256: e3ba7e260c6643b49d937c110453eb85044f9c88131fb5da8c5db34e8089a208
@@ -14,6 +14,17 @@ module AppBridge
14
14
  raise InternalError, "Incompatible WASM file version"
15
15
  end
16
16
 
17
+ # Returns [status, serialized JSON Schema or nil].
18
+ def schema_result(kind, direction, key:, connection: nil, **context)
19
+ raise ArgumentError, "Unknown schema direction" unless %i[input output].include?(direction)
20
+
21
+ case kind
22
+ when :action then action_schema_result(direction, key, connection, **context)
23
+ when :trigger then trigger_schema_result(direction, key, connection, **context)
24
+ else raise ArgumentError, "Unknown definition kind"
25
+ end
26
+ end
27
+
17
28
  def fetch_events(context)
18
29
  response = request_events_with_timeout(context)
19
30
 
@@ -51,6 +62,34 @@ module AppBridge
51
62
 
52
63
  private
53
64
 
65
+ def action_schema_result(direction, key, connection, input: "{}", reference_object: nil)
66
+ if wit_version == "6.0.0"
67
+ return _action_schema_result(direction == :output, key, connection, input,
68
+ reference_object)
69
+ end
70
+ legacy_schema(connection) do |credential|
71
+ context = ActionContext.new(key, credential, input, reference_object)
72
+ public_send("action_#{direction}_schema", context)
73
+ end
74
+ end
75
+
76
+ def trigger_schema_result(direction, key, connection, input: "{}", store: "")
77
+ return _trigger_schema_result(direction == :output, key, connection, input, store) if wit_version == "6.0.0"
78
+
79
+ legacy_schema(connection) do |credential|
80
+ context = TriggerContext.new(key, credential, store, input)
81
+ public_send("trigger_#{direction}_schema", context)
82
+ end
83
+ end
84
+
85
+ def legacy_schema(connection)
86
+ ["complete", yield(connection || Connection.new("", "", "{}"))]
87
+ rescue AppBridge::Error, RuntimeError
88
+ raise if connection
89
+
90
+ ["connection_required", nil]
91
+ end
92
+
54
93
  def validate_number_of_events!(events)
55
94
  return if events.size <= 100
56
95
 
@@ -4,5 +4,5 @@
4
4
  # ext/app_bridge/Cargo.toml file to keep them in sync.
5
5
 
6
6
  module AppBridge
7
- VERSION = "5.0.0"
7
+ VERSION = "6.0.0"
8
8
  end
data/sig/app_bridge.rbs CHANGED
@@ -9,6 +9,9 @@ module AppBridge
9
9
 
10
10
  def actions: () -> Array[String]
11
11
 
12
+ def schema_result: (:action, :input | :output, key: String, ?connection: Connection?, ?input: String, ?reference_object: Hash[String, String]?) -> [String, String?]
13
+ | (:trigger, :input | :output, key: String, ?connection: Connection?, ?input: String, ?store: String) -> [String, String?]
14
+
12
15
  def fetch_events: (TriggerContext) -> TriggerResponse
13
16
 
14
17
  def execute_action: (ActionContext) -> ActionResponse
data/tasks/fixtures.rake CHANGED
@@ -55,6 +55,13 @@ namespace :fixtures do
55
55
  Process.wait(move_pid)
56
56
  end
57
57
 
58
+ desc "Compile the optional connection schema fixture"
59
+ task :compile_rust_v6 do
60
+ dir = "spec/fixtures/components/rust_app_v6"
61
+ Dir.chdir(dir) { sh "cargo build --locked --release --target wasm32-wasip2 --target-dir target" }
62
+ cp "#{dir}/target/wasm32-wasip2/release/rust_app_v6.wasm", "#{dir}.wasm"
63
+ end
64
+
58
65
  desc "Compile the v5 fixture app (connections interface)"
59
66
  task :compile_rust_v5 do
60
67
  pwd = "spec/fixtures/components/rust_app_v5"
@@ -76,4 +83,4 @@ end
76
83
 
77
84
  desc "Build all fixtures"
78
85
  task fixtures: %i[fixtures:apps:clean fixtures:apps:compile_rust fixtures:apps:compile_js fixtures:apps:compile_rust_v3
79
- fixtures:apps:compile_rust_v5]
86
+ fixtures:apps:compile_rust_v5 fixtures:apps:compile_rust_v6]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 6.0.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Alexander Ross
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-08-28 00:00:00.000000000 Z
11
+ date: 2026-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_schemer
@@ -45,6 +45,7 @@ files:
45
45
  - ext/app_bridge/wit/v4/world.wit
46
46
  - ext/app_bridge/wit/v4_1/world.wit
47
47
  - ext/app_bridge/wit/v5/world.wit
48
+ - ext/app_bridge/wit/v6/world.wit
48
49
  - lib/app_bridge.rb
49
50
  - lib/app_bridge/3.3/app_bridge.so
50
51
  - lib/app_bridge/3.4/app_bridge.so