@toa.io/userland 1.0.0-alpha.34 → 1.0.0-alpha.340

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 (57) hide show
  1. package/CHANGELOG.md +430 -0
  2. package/example/components/echo/manifest.toa.yaml +15 -5
  3. package/example/components/echo/operations/get.js +1 -5
  4. package/example/components/echo/operations/resolve.js +1 -5
  5. package/example/components/echo/operations/signal.js +3 -7
  6. package/example/components/math.calculations/manifest.toa.yaml +19 -6
  7. package/example/components/math.calculations/operations/add.js +1 -5
  8. package/example/components/math.calculations/operations/increment.js +1 -5
  9. package/example/components/math.proxy/manifest.toa.yaml +8 -3
  10. package/example/components/math.proxy/operations/add.js +1 -5
  11. package/example/components/tea.pots/manifest.toa.yaml +29 -9
  12. package/example/components/tea.pots/operations/same.js +1 -5
  13. package/example/components/tea.pots/receivers/store.orders.created.js +1 -5
  14. package/example/components/web/manifest.toa.yaml +2 -4
  15. package/example/components/web/operations/get.js +3 -8
  16. package/example/context.toa.yaml +2 -7
  17. package/example/stage/call.test.js +17 -10
  18. package/example/stage/events.test.js +63 -16
  19. package/example/stage/invoke.test.js +12 -9
  20. package/package.json +19 -13
  21. package/readme.md +58 -1
  22. package/stage/package.json +1 -0
  23. package/stage/src/component.js +3 -7
  24. package/stage/src/composition.js +3 -7
  25. package/stage/src/index.js +9 -16
  26. package/stage/src/manifest.js +2 -6
  27. package/stage/src/map.js +15 -0
  28. package/stage/src/quiescence.js +16 -0
  29. package/stage/src/remote.js +11 -8
  30. package/stage/src/service.js +11 -10
  31. package/stage/src/shutdown.js +16 -6
  32. package/stage/src/state.js +2 -4
  33. package/stage/src/workload.js +53 -0
  34. package/stage/test/boot.mock.js +10 -11
  35. package/stage/test/component.test.js +20 -10
  36. package/stage/test/composition.test.js +11 -9
  37. package/stage/test/manifest.test.js +15 -8
  38. package/stage/test/remote.test.js +14 -12
  39. package/stage/test/shutdown.test.js +28 -15
  40. package/stage/test/state.mock.js +5 -6
  41. package/stage/test/state.test.js +13 -12
  42. package/stage/types/index.d.ts +21 -8
  43. package/stage/types/state.d.ts +3 -4
  44. package/template/_gitignore +3 -0
  45. package/template/components/hello/manifest.toa.yaml +22 -0
  46. package/template/components/hello/operations/greet.ts +5 -0
  47. package/template/components/notes/manifest.toa.yaml +25 -0
  48. package/template/context.toa.yaml +29 -0
  49. package/template/cucumber.js +4 -0
  50. package/template/docker-compose.yaml +62 -0
  51. package/template/ecosystem.config.js +29 -0
  52. package/template/features/hello.feature +14 -0
  53. package/template/features/notes.feature +29 -0
  54. package/template/features/steps/application.ts +22 -0
  55. package/template/features/steps/http.ts +19 -0
  56. package/template/package.json +28 -0
  57. package/template/tsconfig.json +15 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,430 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.0.0-alpha.340](https://github.com/toa-io/toa/compare/v1.0.0-alpha.339...v1.0.0-alpha.340) (2026-10-28)
7
+
8
+ **Note:** Version bump only for package @toa.io/userland
9
+
10
+
11
+
12
+
13
+
14
+ # [1.0.0-alpha.339](https://github.com/toa-io/toa/compare/v1.0.0-alpha.338...v1.0.0-alpha.339) (2026-10-28)
15
+
16
+ **Note:** Version bump only for package @toa.io/userland
17
+
18
+
19
+
20
+
21
+
22
+ # [1.0.0-alpha.338](https://github.com/toa-io/toa/compare/v1.0.0-alpha.337...v1.0.0-alpha.338) (2026-10-28)
23
+
24
+ **Note:** Version bump only for package @toa.io/userland
25
+
26
+
27
+
28
+
29
+
30
+ # [1.0.0-alpha.337](https://github.com/toa-io/toa/compare/v1.0.0-alpha.336...v1.0.0-alpha.337) (2026-10-28)
31
+
32
+ **Note:** Version bump only for package @toa.io/userland
33
+
34
+
35
+
36
+
37
+
38
+ # [1.0.0-alpha.336](https://github.com/toa-io/toa/compare/v1.0.0-alpha.335...v1.0.0-alpha.336) (2026-10-26)
39
+
40
+ **Note:** Version bump only for package @toa.io/userland
41
+
42
+
43
+
44
+
45
+
46
+ # [1.0.0-alpha.335](https://github.com/toa-io/toa/compare/v1.0.0-alpha.334...v1.0.0-alpha.335) (2026-10-26)
47
+
48
+ **Note:** Version bump only for package @toa.io/userland
49
+
50
+
51
+
52
+
53
+
54
+ # [1.0.0-alpha.334](https://github.com/toa-io/toa/compare/v1.0.0-alpha.333...v1.0.0-alpha.334) (2026-10-26)
55
+
56
+ **Note:** Version bump only for package @toa.io/userland
57
+
58
+
59
+
60
+
61
+
62
+ # [1.0.0-alpha.333](https://github.com/toa-io/toa/compare/v1.0.0-alpha.332...v1.0.0-alpha.333) (2026-10-26)
63
+
64
+ **Note:** Version bump only for package @toa.io/userland
65
+
66
+
67
+
68
+
69
+
70
+ # [1.0.0-alpha.332](https://github.com/toa-io/toa/compare/v1.0.0-alpha.331...v1.0.0-alpha.332) (2026-10-23)
71
+
72
+ **Note:** Version bump only for package @toa.io/userland
73
+
74
+
75
+
76
+
77
+
78
+ # [1.0.0-alpha.331](https://github.com/toa-io/toa/compare/v1.0.0-alpha.330...v1.0.0-alpha.331) (2026-10-16)
79
+
80
+ **Note:** Version bump only for package @toa.io/userland
81
+
82
+
83
+
84
+
85
+
86
+ # [1.0.0-alpha.330](https://github.com/toa-io/toa/compare/v1.0.0-alpha.329...v1.0.0-alpha.330) (2026-10-15)
87
+
88
+ **Note:** Version bump only for package @toa.io/userland
89
+
90
+
91
+
92
+
93
+
94
+ # [1.0.0-alpha.329](https://github.com/toa-io/toa/compare/v1.0.0-alpha.328...v1.0.0-alpha.329) (2026-10-11)
95
+
96
+ **Note:** Version bump only for package @toa.io/userland
97
+
98
+
99
+
100
+
101
+
102
+ # [1.0.0-alpha.328](https://github.com/toa-io/toa/compare/v1.0.0-alpha.327...v1.0.0-alpha.328) (2026-10-10)
103
+
104
+ **Note:** Version bump only for package @toa.io/userland
105
+
106
+
107
+
108
+
109
+
110
+ # [1.0.0-alpha.327](https://github.com/toa-io/toa/compare/v1.0.0-alpha.326...v1.0.0-alpha.327) (2026-10-10)
111
+
112
+ ### Features
113
+
114
+ * **cli:** create an application in the working directory ([6d44704](https://github.com/toa-io/toa/commit/6d44704ce27e12e796448d9db9b55390ef0a6196))
115
+ * **userland:** install what the declarations require with the packages ([52a99da](https://github.com/toa-io/toa/commit/52a99da800e37117250377ae87245634cfba4a85))
116
+ * **userland:** run what is created as two processes under PM2 ([fe37a05](https://github.com/toa-io/toa/commit/fe37a0583cdccb0f4fdcaf5ae9f73bb1cc10e843))
117
+
118
+
119
+ # [1.0.0-alpha.326](https://github.com/toa-io/toa/compare/v1.0.0-alpha.325...v1.0.0-alpha.326) (2026-10-06)
120
+
121
+ **Note:** Version bump only for package @toa.io/userland
122
+
123
+
124
+
125
+
126
+
127
+ # [1.0.0-alpha.325](https://github.com/toa-io/toa/compare/v1.0.0-alpha.324...v1.0.0-alpha.325) (2026-10-02)
128
+
129
+ **Note:** Version bump only for package @toa.io/userland
130
+
131
+
132
+
133
+
134
+
135
+ # [1.0.0-alpha.324](https://github.com/toa-io/toa/compare/v1.0.0-alpha.323...v1.0.0-alpha.324) (2026-10-02)
136
+
137
+ **Note:** Version bump only for package @toa.io/userland
138
+
139
+
140
+
141
+
142
+
143
+ # [1.0.0-alpha.323](https://github.com/toa-io/toa/compare/v1.0.0-alpha.322...v1.0.0-alpha.323) (2026-10-01)
144
+
145
+ **Note:** Version bump only for package @toa.io/userland
146
+
147
+
148
+
149
+
150
+
151
+ # [1.0.0-alpha.322](https://github.com/toa-io/toa/compare/v1.0.0-alpha.321...v1.0.0-alpha.322) (2026-09-29)
152
+
153
+ **Note:** Version bump only for package @toa.io/userland
154
+
155
+
156
+
157
+
158
+
159
+ # [1.0.0-alpha.321](https://github.com/toa-io/toa/compare/v1.0.0-alpha.320...v1.0.0-alpha.321) (2026-09-28)
160
+
161
+ **Note:** Version bump only for package @toa.io/userland
162
+
163
+
164
+
165
+
166
+
167
+ # [1.0.0-alpha.320](https://github.com/toa-io/toa/compare/v1.0.0-alpha.319...v1.0.0-alpha.320) (2026-09-28)
168
+
169
+ **Note:** Version bump only for package @toa.io/userland
170
+
171
+
172
+
173
+
174
+
175
+ # [1.0.0-alpha.319](https://github.com/toa-io/toa/compare/v1.0.0-alpha.318...v1.0.0-alpha.319) (2026-09-27)
176
+
177
+ **Note:** Version bump only for package @toa.io/userland
178
+
179
+
180
+
181
+
182
+
183
+ # [1.0.0-alpha.318](https://github.com/toa-io/toa/compare/v1.0.0-alpha.317...v1.0.0-alpha.318) (2026-09-23)
184
+
185
+ **Note:** Version bump only for package @toa.io/userland
186
+
187
+
188
+
189
+
190
+
191
+ # [1.0.0-alpha.317](https://github.com/toa-io/toa/compare/v1.0.0-alpha.316...v1.0.0-alpha.317) (2026-09-23)
192
+
193
+ **Note:** Version bump only for package @toa.io/userland
194
+
195
+
196
+
197
+
198
+
199
+ # [1.0.0-alpha.316](https://github.com/toa-io/toa/compare/v1.0.0-alpha.315...v1.0.0-alpha.316) (2026-09-23)
200
+
201
+ **Note:** Version bump only for package @toa.io/userland
202
+
203
+
204
+
205
+
206
+
207
+ # [1.0.0-alpha.315](https://github.com/toa-io/toa/compare/v1.0.0-alpha.314...v1.0.0-alpha.315) (2026-09-23)
208
+
209
+ **Note:** Version bump only for package @toa.io/userland
210
+
211
+
212
+
213
+
214
+
215
+ # [1.0.0-alpha.314](https://github.com/toa-io/toa/compare/v1.0.0-alpha.313...v1.0.0-alpha.314) (2026-09-19)
216
+
217
+ **Note:** Version bump only for package @toa.io/userland
218
+
219
+
220
+
221
+
222
+
223
+ # [1.0.0-alpha.313](https://github.com/toa-io/toa/compare/v1.0.0-alpha.312...v1.0.0-alpha.313) (2026-09-18)
224
+
225
+ **Note:** Version bump only for package @toa.io/userland
226
+
227
+
228
+
229
+
230
+
231
+ # [1.0.0-alpha.312](https://github.com/toa-io/toa/compare/v1.0.0-alpha.311...v1.0.0-alpha.312) (2026-09-18)
232
+
233
+ **Note:** Version bump only for package @toa.io/userland
234
+
235
+
236
+
237
+
238
+
239
+ # [1.0.0-alpha.311](https://github.com/toa-io/toa/compare/v1.0.0-alpha.310...v1.0.0-alpha.311) (2026-09-17)
240
+
241
+ **Note:** Version bump only for package @toa.io/userland
242
+
243
+
244
+
245
+
246
+
247
+ # [1.0.0-alpha.310](https://github.com/toa-io/toa/compare/v1.0.0-alpha.309...v1.0.0-alpha.310) (2026-09-16)
248
+
249
+ **Note:** Version bump only for package @toa.io/userland
250
+
251
+
252
+
253
+
254
+
255
+ # [1.0.0-alpha.309](https://github.com/toa-io/toa/compare/v1.0.0-alpha.308...v1.0.0-alpha.309) (2026-09-16)
256
+
257
+ **Note:** Version bump only for package @toa.io/userland
258
+
259
+
260
+
261
+
262
+
263
+ # [1.0.0-alpha.308](https://github.com/toa-io/toa/compare/v1.0.0-alpha.307...v1.0.0-alpha.308) (2026-09-15)
264
+
265
+ **Note:** Version bump only for package @toa.io/userland
266
+
267
+
268
+
269
+
270
+
271
+ # [1.0.0-alpha.307](https://github.com/toa-io/toa/compare/v1.0.0-alpha.306...v1.0.0-alpha.307) (2026-09-15)
272
+
273
+ **Note:** Version bump only for package @toa.io/userland
274
+
275
+
276
+
277
+
278
+
279
+ # [1.0.0-alpha.306](https://github.com/toa-io/toa/compare/v1.0.0-alpha.305...v1.0.0-alpha.306) (2026-09-14)
280
+
281
+ * feat(boot)!: a process can be halted and come back ([7196fa5](https://github.com/toa-io/toa/commit/7196fa51a9c882e84c3767a4fdd329fd2df319f5))
282
+
283
+ ### BREAKING CHANGES
284
+
285
+ * `Host` gains `gate` and `halt`, and `Factory.service` may answer a gate. An
286
+ extension that gates nothing keeps its connections through a halt.
287
+
288
+
289
+ # [1.0.0-alpha.305](https://github.com/toa-io/toa/compare/v1.0.0-alpha.304...v1.0.0-alpha.305) (2026-09-13)
290
+
291
+ **Note:** Version bump only for package @toa.io/userland
292
+
293
+
294
+
295
+
296
+
297
+ # [1.0.0-alpha.304](https://github.com/toa-io/toa/compare/v1.0.0-alpha.303...v1.0.0-alpha.304) (2026-09-13)
298
+
299
+ **Note:** Version bump only for package @toa.io/userland
300
+
301
+
302
+
303
+
304
+
305
+ # [1.0.0-alpha.303](https://github.com/toa-io/toa/compare/v1.0.0-alpha.302...v1.0.0-alpha.303) (2026-09-12)
306
+
307
+ **Note:** Version bump only for package @toa.io/userland
308
+
309
+
310
+
311
+
312
+
313
+ # [1.0.0-alpha.302](https://github.com/toa-io/toa/compare/v1.0.0-alpha.301...v1.0.0-alpha.302) (2026-09-11)
314
+
315
+ **Note:** Version bump only for package @toa.io/userland
316
+
317
+
318
+
319
+
320
+
321
+ # [1.0.0-alpha.301](https://github.com/toa-io/toa/compare/v1.0.0-alpha.300...v1.0.0-alpha.301) (2026-09-11)
322
+
323
+ **Note:** Version bump only for package @toa.io/userland
324
+
325
+
326
+
327
+
328
+
329
+ # [1.0.0-alpha.300](https://github.com/toa-io/toa/compare/v1.0.0-alpha.299...v1.0.0-alpha.300) (2026-09-11)
330
+
331
+ * feat(boot)!: a process is a thing, and an extension may keep something in one ([528d6cd](https://github.com/toa-io/toa/commit/528d6cdd307b45a6c30b6a184d7e06b3328cecf8))
332
+
333
+ ### BREAKING CHANGES
334
+
335
+ * a composition booted directly has no readiness probe. Readiness is
336
+ the process's, and a composition is not a process. `stage.workload` boots one where a
337
+ suite needs it.
338
+
339
+
340
+ # [1.0.0-alpha.299](https://github.com/toa-io/toa/compare/v1.0.0-alpha.298...v1.0.0-alpha.299) (2026-09-10)
341
+
342
+ **Note:** Version bump only for package @toa.io/userland
343
+
344
+
345
+
346
+
347
+
348
+ # [1.0.0-alpha.298](https://github.com/toa-io/toa/compare/v1.0.0-alpha.297...v1.0.0-alpha.298) (2026-09-08)
349
+
350
+ **Note:** Version bump only for package @toa.io/userland
351
+
352
+
353
+
354
+
355
+
356
+ # [1.0.0-alpha.297](https://github.com/toa-io/toa/compare/v1.0.0-alpha.296...v1.0.0-alpha.297) (2026-09-08)
357
+
358
+ **Note:** Version bump only for package @toa.io/userland
359
+
360
+
361
+
362
+
363
+
364
+ # [1.0.0-alpha.296](https://github.com/toa-io/toa/compare/v1.0.0-alpha.295...v1.0.0-alpha.296) (2026-09-08)
365
+
366
+ **Note:** Version bump only for package @toa.io/userland
367
+
368
+
369
+
370
+
371
+
372
+ # [1.0.0-alpha.295](https://github.com/toa-io/toa/compare/v1.0.0-alpha.294...v1.0.0-alpha.295) (2026-09-07)
373
+
374
+ **Note:** Version bump only for package @toa.io/userland
375
+
376
+
377
+
378
+
379
+
380
+ # [1.0.0-alpha.294](https://github.com/toa-io/toa/compare/v1.0.0-alpha.293...v1.0.0-alpha.294) (2026-09-07)
381
+
382
+ **Note:** Version bump only for package @toa.io/userland
383
+
384
+
385
+
386
+
387
+
388
+ # [1.0.0-alpha.293](https://github.com/toa-io/toa/compare/v1.0.0-alpha.292...v1.0.0-alpha.293) (2026-09-07)
389
+
390
+ **Note:** Version bump only for package @toa.io/userland
391
+
392
+
393
+
394
+
395
+
396
+ # [1.0.0-alpha.292](https://github.com/toa-io/toa/compare/v1.0.0-alpha.291...v1.0.0-alpha.292) (2026-09-07)
397
+
398
+ **Note:** Version bump only for package @toa.io/userland
399
+
400
+
401
+
402
+
403
+
404
+ # [1.0.0-alpha.291](https://github.com/toa-io/toa/compare/v1.0.0-alpha.290...v1.0.0-alpha.291) (2026-09-07)
405
+
406
+ **Note:** Version bump only for package @toa.io/userland
407
+
408
+
409
+
410
+
411
+
412
+ # [1.0.0-alpha.289](https://github.com/toa-io/toa/compare/v1.0.0-alpha.288...v1.0.0-alpha.289) (2026-09-07)
413
+
414
+ **Note:** Version bump only for package @toa.io/userland
415
+
416
+
417
+
418
+
419
+
420
+ # [1.0.0-alpha.288](https://github.com/toa-io/toa/compare/v1.0.0-alpha.287...v1.0.0-alpha.288) (2026-09-06)
421
+
422
+ **Note:** Version bump only for package @toa.io/userland
423
+
424
+
425
+
426
+
427
+
428
+ # [1.0.0-alpha.287](https://github.com/toa-io/toa/compare/v1.0.0-alpha.286...v1.0.0-alpha.287) (2026-09-06)
429
+
430
+ **Note:** Version bump only for package @toa.io/userland
@@ -2,14 +2,24 @@ name: echo
2
2
 
3
3
  operations:
4
4
  signal:
5
- output: string
5
+ output:
6
+ type: string
6
7
  get:
7
- output: string
8
+ output:
9
+ type: string
8
10
  resolve:
9
- input: string
10
- output: string
11
+ input:
12
+ type: string
13
+ output:
14
+ type: string
11
15
 
12
16
  configuration:
13
- signal: quack
17
+ schema:
18
+ type: object
19
+ properties:
20
+ signal:
21
+ type: string
22
+ defaults:
23
+ signal: quack
14
24
 
15
25
  state: ~
@@ -1,7 +1,3 @@
1
- 'use strict'
2
-
3
- async function computation (_, context) {
1
+ export async function computation(_, context) {
4
2
  return context.state.value
5
3
  }
6
-
7
- exports.computation = computation
@@ -1,7 +1,3 @@
1
- 'use strict'
2
-
3
- async function computation (key, context) {
1
+ export async function computation(key, context) {
4
2
  return context.state.values.get(key)
5
3
  }
6
-
7
- exports.computation = computation
@@ -1,15 +1,11 @@
1
- 'use strict'
2
-
3
- class Computation {
1
+ export class Computation {
4
2
  #context
5
3
 
6
- async mount (context) {
4
+ async mount(context) {
7
5
  this.#context = context
8
6
  }
9
7
 
10
- async execute () {
8
+ async execute() {
11
9
  return this.#context.configuration.signal
12
10
  }
13
11
  }
14
-
15
- exports.Computation = Computation
@@ -4,11 +4,24 @@ namespace: math
4
4
  operations:
5
5
  add:
6
6
  input:
7
- a: number
8
- b: number
9
- output: number
7
+ properties:
8
+ a:
9
+ type: number
10
+ b:
11
+ type: number
12
+ type: object
13
+ output:
14
+ type: number
10
15
  increment:
11
16
  input:
12
- value: number
13
- times: 1
14
- output: number
17
+ properties:
18
+ value:
19
+ type: number
20
+ times:
21
+ type: number
22
+ type: object
23
+ required:
24
+ - value
25
+ - times
26
+ output:
27
+ type: number
@@ -1,7 +1,3 @@
1
- 'use strict'
2
-
3
- async function computation (input) {
1
+ export async function computation(input) {
4
2
  return input.a + input.b
5
3
  }
6
-
7
- exports.computation = computation
@@ -1,6 +1,4 @@
1
- 'use strict'
2
-
3
- async function computation (input, context) {
1
+ export async function computation(input, context) {
4
2
  let value = input.value
5
3
 
6
4
  for (let i = 0; i < input.times; i++) {
@@ -9,5 +7,3 @@ async function computation (input, context) {
9
7
 
10
8
  return value
11
9
  }
12
-
13
- exports.computation = computation
@@ -4,6 +4,11 @@ namespace: math
4
4
  operations:
5
5
  add:
6
6
  input:
7
- a: number
8
- b: number
9
- output: number
7
+ properties:
8
+ a:
9
+ type: number
10
+ b:
11
+ type: number
12
+ type: object
13
+ output:
14
+ type: number
@@ -1,10 +1,6 @@
1
- 'use strict'
2
-
3
- async function computation (input, context) {
1
+ export async function computation(input, context) {
4
2
  const request = { input }
5
3
 
6
4
  // noinspection JSUnresolvedVariable
7
5
  return context.remote.math.calculations.add(request)
8
6
  }
9
-
10
- exports.computation = computation
@@ -3,21 +3,35 @@ namespace: tea
3
3
 
4
4
  entity:
5
5
  storage: mongodb
6
- schema:
7
- material*: [ glass, ceramic, steel ]
8
- volume: number
6
+ properties:
7
+ volume: &volume
8
+ type: number
9
+ booked: &booked
10
+ type: boolean
11
+ material: &material
12
+ type: string
13
+ enum:
14
+ - glass
15
+ - ceramic
16
+ - steel
17
+ required:
18
+ - material
19
+ blank:
9
20
  booked: false
10
21
 
11
22
  operations:
12
23
  transit:
13
24
  concurrency: none
14
25
  input:
15
- material: .
16
- volume: .
17
- booked: .
26
+ properties:
27
+ material: *material
28
+ volume: *volume
29
+ booked: *booked
30
+ type: object
18
31
  same:
19
- input: .material
20
- output: array
32
+ input: *material
33
+ output:
34
+ type: array
21
35
 
22
36
  receivers:
23
37
  store.orders.created:
@@ -25,4 +39,10 @@ receivers:
25
39
  binding: amqp # avoid discovery
26
40
 
27
41
  configuration:
28
- step: 0.5
42
+ schema:
43
+ type: object
44
+ properties:
45
+ step:
46
+ type: number
47
+ defaults:
48
+ step: 0.5
@@ -1,6 +1,4 @@
1
- 'use strict'
2
-
3
- async function computation (input, context) {
1
+ export async function computation(input, context) {
4
2
  const criteria = `material==${input}`
5
3
  const query = { criteria, limit }
6
4
 
@@ -9,5 +7,3 @@ async function computation (input, context) {
9
7
  }
10
8
 
11
9
  const limit = 10
12
-
13
- exports.computation = computation
@@ -1,8 +1,4 @@
1
- 'use strict'
2
-
3
- const request = async (payload) => ({
1
+ export const request = async (payload) => ({
4
2
  input: { booked: true },
5
3
  query: { id: payload.pot }
6
4
  })
7
-
8
- exports.request = request
@@ -2,7 +2,5 @@ name: web
2
2
 
3
3
  operations:
4
4
  get:
5
- output: object
6
-
7
- origins:
8
- dev: http://api.example.com
5
+ output:
6
+ type: object
@@ -1,15 +1,10 @@
1
- 'use strict'
2
-
3
- async function computation (_, context) {
4
- const response = await context.http.dev.path.to.resource.get()
1
+ export async function computation(_, context) {
2
+ const response = await context.fetch('http://api.example.com/path/to/resource')
5
3
  const type = response.headers.get('content-type')
6
4
 
7
- if (type !== 'application/json')
8
- return ERR_UNSUPPORTED_MEDIA_TYPE
5
+ if (type !== 'application/json') return ERR_UNSUPPORTED_MEDIA_TYPE
9
6
 
10
7
  return await response.json()
11
8
  }
12
9
 
13
10
  const ERR_UNSUPPORTED_MEDIA_TYPE = new Error('UNSUPPORTED_MEDIA_TYPE')
14
-
15
- exports.computation = computation