@toa.io/extensions.cadence 1.0.0-alpha.326 → 1.0.0-alpha.327

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.
@@ -7,7 +7,10 @@ import { row } from '@toa.io/extensions.cadence'
7
7
  export function transition(input, entry) {
8
8
  const { endpoint, interval, overdue, request, trail } = input
9
9
 
10
- Object.assign(entry, row({ endpoint, due: Date.now() + interval, overdue, request, trail }))
10
+ Object.assign(
11
+ entry,
12
+ row({ endpoint, due: Date.now() + interval, overdue, request, trail })
13
+ )
11
14
 
12
15
  return entry.id
13
16
  }
@@ -43,7 +43,7 @@ export interface Component {
43
43
  delay: (request: { input: DelayInput, task?: boolean }) => Promise<DelayOutput>
44
44
  settle: (request: { input?: null, query: Query<Entity>, task?: boolean }) => Promise<unknown>
45
45
  assign: (request: { input?: null, query?: Query<Entity>, task?: boolean }) => Promise<Entity>
46
- ensure: (request: { input?: null, query?: Query<Entity>, task?: boolean }) => Promise<Entity>
46
+ ensure: (request: { input?: null, query?: Query<Entity>, entity?: Partial<Entity>, task?: boolean }) => Promise<Entity>
47
47
  enumerate: (request: { input?: null, query?: Query<Entity>, task?: boolean }) => Promise<Entity[]>
48
48
  observe: (request: { input?: null, query?: Query<Entity>, task?: boolean }) => Promise<Entity | null>
49
49
  stream: (request: { input?: null, query?: Query<Entity>, task?: boolean }) => Promise<Readable>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/extensions.cadence",
3
- "version": "1.0.0-alpha.326",
3
+ "version": "1.0.0-alpha.327",
4
4
  "type": "module",
5
5
  "description": "Toa Schedule",
6
6
  "author": "temich <tema.gurtovoy@gmail.com>",
@@ -26,14 +26,14 @@
26
26
  "!**/.env*"
27
27
  ],
28
28
  "dependencies": {
29
- "@toa.io/core": "1.0.0-alpha.326",
30
- "@toa.io/definitions": "1.0.0-alpha.326",
29
+ "@toa.io/core": "1.0.0-alpha.327",
30
+ "@toa.io/definitions": "1.0.0-alpha.327",
31
31
  "@toa.io/generic": "1.0.0-alpha.311",
32
32
  "@toa.io/schemas": "1.0.0-alpha.326",
33
- "openspan": "1.0.0-alpha.323"
33
+ "openspan": "1.0.0-alpha.327"
34
34
  },
35
35
  "scripts": {
36
36
  "transpile": "tsc"
37
37
  },
38
- "gitHead": "60f11bdc805d0c39bcb06064b2218b11114a35ad"
38
+ "gitHead": "cd6d6d77f19fbae5d7ff85d18005ca8deb9c77f3"
39
39
  }
package/readme.md CHANGED
@@ -140,12 +140,12 @@ cadence:
140
140
  poll: '*/5 * * * *' # every five minutes
141
141
  ```
142
142
 
143
- | | |
144
- | ---------- | ----------------------------------------------------------------------------- |
145
- | `schedule` | the cron expression |
143
+ | | |
144
+ | ---------- | -------------------------------------------------------------------------------- |
145
+ | `schedule` | the cron expression |
146
146
  | `zone` | the [time zone](https://www.iana.org/time-zones) it is read in, `UTC` by default |
147
- | `overdue` | seconds a call may be late and still be made; until the next one by default |
148
- | `region` | the region that makes it; see [Regions](#in-one-region-or-in-every-one) |
147
+ | `overdue` | seconds a call may be late and still be made; until the next one by default |
148
+ | `region` | the region that makes it; see [Regions](#in-one-region-or-in-every-one) |
149
149
 
150
150
  The operation is called with the moment the call was scheduled for:
151
151
 
@@ -254,6 +254,9 @@ await context.delay.cancel(id)
254
254
  | `overdue` | milliseconds the call may be late and still be made, or `null` for no bound |
255
255
  | `unchained` | whether the call begins a chain of its own; see below |
256
256
 
257
+ The endpoint is `namespace.component.operation`, or `component.operation` for a component that
258
+ declares no namespace.
259
+
257
260
  The call is made once the delay has passed, and waits for the target where it is not there to
258
261
  take it. The id it answers cancels it, and `cancel` raises where the id was never issued.
259
262
 
@@ -277,7 +280,7 @@ is running in:
277
280
 
278
281
  ```javascript
279
282
  // billing.dunning.chase — arms the next chase as it finishes this one
280
- export async function effect (input, context) {
283
+ export async function effect(input, context) {
281
284
  await chase(input.invoice)
282
285
 
283
286
  await context.delay(
@@ -427,4 +430,3 @@ once and deployed everywhere.
427
430
  **A cancellation crosses regions.** `cancel` is a write like any other, so it reaches the region
428
431
  that owns the call by convergence — bounded by the link, on top of the `discreteness` race that
429
432
  is there anyway.
430
-
@@ -37,6 +37,9 @@ export class Aspect extends Connector {
37
37
  */
38
38
  if (request !== null && request !== undefined && 'instance' in request)
39
39
  throw new exceptions.RequestContractException('A delayed call names no `instance`');
40
+ // a component that declares no namespace is named by its name, and called by its id
41
+ if (endpoint.split('.').length === 2)
42
+ endpoint = `default.${endpoint}`;
40
43
  const input = {
41
44
  endpoint,
42
45
  interval: options.interval,
@@ -1 +1 @@
1
- {"version":3,"file":"Aspect.js","sourceRoot":"","sources":["../source/Aspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAG3D,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAU5C;;;;;;;;GAQG;AACH,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnB,IAAI,GAAG,OAAO,CAAA;IAEb,SAAS,CAAO;IAEjC,YAAmB,SAAgB;QACjC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAE1B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAED,0FAA0F;IAC1F,4DAA4D;IACrD,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,GAAG,IAAW;QAChD,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,OAAO;gBACV,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;YACpD,KAAK,QAAQ;gBACX,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;YACnC;gBACE,MAAM,IAAI,KAAK,CAAC,wBAAwB,MAAM,UAA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