@geonosis/oxlint-plugin-biological-architecture 1.3.0 → 2.0.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.
- package/README.md +1 -1
- package/corpus/.oxlintrc.json +97 -5
- package/corpus/domains/document/workflows/bad-per-kind-workflow.ts +5 -0
- package/corpus/domains/document/workflows/good-minted-workflow.ts +8 -0
- package/corpus/engine/bad-durable-free-read.ts +20 -0
- package/corpus/engine/bad-no-retry.ts +8 -0
- package/corpus/engine/good-durable-other-spelling.ts +10 -0
- package/corpus/engine/good-durable-read-is-a-step.ts +18 -0
- package/corpus/engine/good-durable-read-through-helper.ts +20 -0
- package/corpus/engine/good-inline-free-read.ts +7 -0
- package/corpus/engine/good-retry-budget.ts +9 -0
- package/corpus/floors/domains/alpha/src/good-downhill.ts +3 -0
- package/corpus/floors/domains/alpha/src/index.ts +1 -0
- package/corpus/floors/domains/alpha/src/reaches-own-ui.ts +3 -0
- package/corpus/floors/domains/alpha/src/reaches-sideways-type.ts +3 -0
- package/corpus/floors/domains/alpha/src/reaches-sideways.ts +3 -0
- package/corpus/floors/domains/alpha/src/ui/panel.ts +3 -0
- package/corpus/floors/domains/beta/src/index.ts +3 -0
- package/corpus/floors/foundations/above/src/good-downhill.ts +3 -0
- package/corpus/floors/foundations/base/src/good-downhill.ts +3 -0
- package/corpus/floors/foundations/base/src/index.ts +1 -0
- package/corpus/floors/foundations/base/src/reaches-sideways.ts +3 -0
- package/corpus/floors/foundations/base/src/reaches-up.ts +3 -0
- package/corpus/floors/packages/method/src/own.ts +1 -0
- package/corpus/floors/packages/method/src/reaches-up.ts +3 -0
- package/corpus/floors.oxlintrc.json +86 -0
- package/corpus/manifest.json +4 -0
- package/corpus/subpaths/bad-root-barrel.ts +5 -0
- package/corpus/subpaths/good-spans-two-subpaths.ts +5 -0
- package/corpus/subpaths/good-subpath.ts +4 -0
- package/corpus/subpaths/good-type-only.ts +4 -0
- package/corpus/time/bad-boundary-type.ts +3 -0
- package/corpus/time/bad-second-door.ts +6 -0
- package/corpus/time/door.ts +15 -0
- package/corpus/time/generated/from-openapi.ts +1 -0
- package/corpus/time/good-boundary-primitive.ts +3 -0
- package/corpus/todos/bad-unplanned.ts +2 -0
- package/corpus/todos/good-planned.ts +2 -0
- package/corpus/todos/good-string-not-a-comment.ts +2 -0
- package/corpus/workers/good-with-cells.ts +7 -0
- package/corpus/workers/good-with-connection.ts +7 -0
- package/corpus/workflows/bad-unscoped-host.ts +7 -0
- package/corpus/workflows/good-host-config-elsewhere.ts +6 -0
- package/corpus/workflows/good-scoped-entrypoint.ts +17 -0
- package/corpus/workflows/good-scoped-host.ts +11 -0
- package/dist/{chunk-UVENNNFM.js → chunk-LTDP2733.js} +36 -3
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1115 -370
- package/dist/presets.d.ts +31 -2
- package/dist/presets.js +5 -1
- package/package.json +2 -2
- /package/corpus/{packages/workflows/src → domains/document/workflows}/bad-per-kind-saga.ts +0 -0
- /package/corpus/{apps/api/src → workers}/bad-unscoped-worker.ts +0 -0
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ everything below the organelle is inert. A cell never composes another cell.
|
|
|
62
62
|
| `tenant-scoping` | 4 | every row placed, scoped and narrowed to one organisation |
|
|
63
63
|
| `backend-d1` | 2 | Cloudflare D1 facts — false on an engine with transactions |
|
|
64
64
|
| `backend-medusa` | 1 | the storefront route surface |
|
|
65
|
-
| `backend-
|
|
65
|
+
| `backend-workflows-cf` | 1 | durable runs on Cloudflare Workflows — false of an inline run |
|
|
66
66
|
| `tooling` | 1 | `layer-walls` — a repo's OWN layers, declared as data and walled |
|
|
67
67
|
| `comment-ceiling` | 1 | the comment posture, opt-in (+ oxlint's `capitalized-comments`) |
|
|
68
68
|
|
package/corpus/.oxlintrc.json
CHANGED
|
@@ -9,6 +9,18 @@
|
|
|
9
9
|
},
|
|
10
10
|
"rules": {
|
|
11
11
|
"biological-architecture/atom-no-deps": "error",
|
|
12
|
+
"biological-architecture/boundary-time-is-primitive": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
"doors": [
|
|
16
|
+
"(?:__fixtures__|corpus)/time/door\\.ts$"
|
|
17
|
+
],
|
|
18
|
+
"types": [
|
|
19
|
+
"Date",
|
|
20
|
+
"Dayjs"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
12
24
|
"biological-architecture/cell-must-be-stateful": "error",
|
|
13
25
|
"biological-architecture/cell-must-not-compose-cell": "error",
|
|
14
26
|
"biological-architecture/cell-no-cross-feature-organelles": [
|
|
@@ -30,7 +42,8 @@
|
|
|
30
42
|
{
|
|
31
43
|
"perKindPrefixes": [
|
|
32
44
|
"invoice"
|
|
33
|
-
]
|
|
45
|
+
],
|
|
46
|
+
"within": "(?:__fixtures__|corpus)/domains/[^/]+/workflows/"
|
|
34
47
|
}
|
|
35
48
|
],
|
|
36
49
|
"biological-architecture/documents-share-one-table": [
|
|
@@ -42,6 +55,15 @@
|
|
|
42
55
|
]
|
|
43
56
|
}
|
|
44
57
|
],
|
|
58
|
+
"biological-architecture/durable-body-reads-through-steps": [
|
|
59
|
+
"error",
|
|
60
|
+
{
|
|
61
|
+
"ports": [
|
|
62
|
+
"store",
|
|
63
|
+
"billing"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
],
|
|
45
67
|
"biological-architecture/effect-hook-naming": "error",
|
|
46
68
|
"biological-architecture/emit-declares-attempts": [
|
|
47
69
|
"error",
|
|
@@ -214,17 +236,72 @@
|
|
|
214
236
|
}
|
|
215
237
|
],
|
|
216
238
|
"biological-architecture/store-route-scopes-tenant-data": "error",
|
|
239
|
+
"biological-architecture/subpath-over-barrel": [
|
|
240
|
+
"error",
|
|
241
|
+
{
|
|
242
|
+
"packages": [
|
|
243
|
+
{
|
|
244
|
+
"name": "@corpus/domains",
|
|
245
|
+
"subpaths": {
|
|
246
|
+
"document": [
|
|
247
|
+
"Document",
|
|
248
|
+
"DocumentKind",
|
|
249
|
+
"documentOf"
|
|
250
|
+
],
|
|
251
|
+
"events": [
|
|
252
|
+
"DomainEvent",
|
|
253
|
+
"emit"
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
],
|
|
217
260
|
"biological-architecture/subscriber-declares-id": "error",
|
|
218
261
|
"biological-architecture/tables-declare-their-plane": "error",
|
|
219
262
|
"biological-architecture/tenant-tables-carry-org-id": "error",
|
|
220
|
-
"biological-architecture/time-through-the-door":
|
|
263
|
+
"biological-architecture/time-through-the-door": [
|
|
264
|
+
"error",
|
|
265
|
+
{
|
|
266
|
+
"door": "(?:__fixtures__|corpus)/time/door\\.ts$",
|
|
267
|
+
"exempt": [
|
|
268
|
+
"(?:__fixtures__|corpus)/time/generated/"
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
],
|
|
221
272
|
"biological-architecture/tissue-must-compose": "error",
|
|
273
|
+
"biological-architecture/todo-names-its-plan": [
|
|
274
|
+
"error",
|
|
275
|
+
{
|
|
276
|
+
"markers": [
|
|
277
|
+
"TODO",
|
|
278
|
+
"FIXME"
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
],
|
|
222
282
|
"biological-architecture/tissue-no-data-props": "error",
|
|
223
283
|
"biological-architecture/tissue-no-hooks": "error",
|
|
224
284
|
"biological-architecture/tissue-no-organelles": "error",
|
|
225
285
|
"biological-architecture/tissue-no-stores": "error",
|
|
226
|
-
"biological-architecture/unique-query-step-name":
|
|
227
|
-
|
|
286
|
+
"biological-architecture/unique-query-step-name": [
|
|
287
|
+
"error",
|
|
288
|
+
{
|
|
289
|
+
"queryStepCalls": [
|
|
290
|
+
"useQueryGraphStep",
|
|
291
|
+
"useRemoteQueryStep"
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"biological-architecture/worker-handles-are-scoped": [
|
|
296
|
+
"error",
|
|
297
|
+
{
|
|
298
|
+
"within": "(?:__fixtures__|corpus)/workers/",
|
|
299
|
+
"wrapper": [
|
|
300
|
+
"withCells",
|
|
301
|
+
"withConnection"
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
],
|
|
228
305
|
"biological-architecture/zustand-v5-best-practices": "error",
|
|
229
306
|
"biological-architecture/font-roles-only": [
|
|
230
307
|
"error",
|
|
@@ -250,5 +327,20 @@
|
|
|
250
327
|
]
|
|
251
328
|
}
|
|
252
329
|
]
|
|
253
|
-
}
|
|
330
|
+
},
|
|
331
|
+
"overrides": [
|
|
332
|
+
{
|
|
333
|
+
"files": [
|
|
334
|
+
"**/engine/**"
|
|
335
|
+
],
|
|
336
|
+
"rules": {
|
|
337
|
+
"biological-architecture/mutating-step-declares-retry": [
|
|
338
|
+
"error",
|
|
339
|
+
{
|
|
340
|
+
"retryKey": "retry"
|
|
341
|
+
}
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
]
|
|
254
346
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
// BREACH: the same hand-written fork under the other engine's factory. A plain string names ONE
|
|
4
|
+
// entity, which is what the generic base entity replaced.
|
|
5
|
+
export const createInvoice = createWorkflow('invoice.create', async (input) => input)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED: the generic factory. Every entity's create flow comes from one body, and the name is
|
|
4
|
+
// assembled from the entity — a template literal the rule cannot read, which is the point rather
|
|
5
|
+
// than a gap: what is minted is exactly what this rule is asking for.
|
|
6
|
+
export const documentWorkflows = (entity: string) => ({
|
|
7
|
+
create: createWorkflow(`${entity}.create`, async (input) => input),
|
|
8
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createStep, createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
const charge = createStep('charge', async (id: string, { billing }) => billing.charge(id))
|
|
4
|
+
|
|
5
|
+
const save = createStep('save', async (doc: { id: string }, { store }) => store.updateDocument(doc))
|
|
6
|
+
|
|
7
|
+
// BREACH: the free read gates a branch. The run crashes after `save` and before it closes; the
|
|
8
|
+
// replay answers `charge` from its record, re-reads, sees the status the FIRST invocation wrote,
|
|
9
|
+
// throws, and unwinds — refunding a charge for an invoice that is still sent. Traced in
|
|
10
|
+
// docs/design-026-document-workflows.md §8 and held as a test in the engine.
|
|
11
|
+
export const send = createWorkflow(
|
|
12
|
+
'invoice.send',
|
|
13
|
+
async (id: string, { store }) => {
|
|
14
|
+
await charge(id)
|
|
15
|
+
if (store.read(id).status !== 'draft') throw new Error('already sent')
|
|
16
|
+
|
|
17
|
+
return await save({ id })
|
|
18
|
+
},
|
|
19
|
+
{ execution: 'durable' },
|
|
20
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createStep } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
// BREACH: a step that writes and names no budget at all. The engine's default is one attempt, so
|
|
4
|
+
// the first dropped connection reverts the write — the same silence Medusa's `maxRetries: 0` keeps,
|
|
5
|
+
// spelled under this engine's own key.
|
|
6
|
+
export const save = createStep({ name: 'save' }, async (input, { store }) =>
|
|
7
|
+
store.createDocument(input),
|
|
8
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED under the DEFAULTS, and the reason the defaults moved (#210): `durable: true` is not a
|
|
4
|
+
// declaration the engine has — `WorkflowOptions` takes `execution`, and a repo whose own factory
|
|
5
|
+
// says it another way names `durableKey`/`durableValue` and gets that instead.
|
|
6
|
+
export const price = createWorkflow(
|
|
7
|
+
'invoice.price',
|
|
8
|
+
async (id: string, { store }) => store.read(id),
|
|
9
|
+
{ durable: true },
|
|
10
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createStep, createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
const ensureDraft = createStep('ensure-draft', async (id: string, { store }) => store.read(id))
|
|
4
|
+
|
|
5
|
+
const save = createStep('save', async (doc: { id: string }, { store }) => store.updateDocument(doc))
|
|
6
|
+
|
|
7
|
+
// ACCEPTED: the decision is a step, so the replay is handed the answer the first invocation got,
|
|
8
|
+
// takes the same branch and closes the same way both times.
|
|
9
|
+
export const send = createWorkflow(
|
|
10
|
+
'invoice.send',
|
|
11
|
+
async (id: string) => {
|
|
12
|
+
const doc = await ensureDraft(id)
|
|
13
|
+
if (doc.status !== 'draft') throw new Error('already sent')
|
|
14
|
+
|
|
15
|
+
return await save({ id })
|
|
16
|
+
},
|
|
17
|
+
{ durable: true },
|
|
18
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createStep, createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
const save = createStep('save', async (doc: { id: string }, { store }) => store.updateDocument(doc))
|
|
4
|
+
|
|
5
|
+
// The port, one function out. THE RULE IS SILENT HERE and #212 says so out loud: it reads a call on
|
|
6
|
+
// a name `ports` lists, and no single-file rule can follow a read through a helper. A repo that
|
|
7
|
+
// reaches the outside world this way names `readStatus` in `ports` — or makes it a step, which is
|
|
8
|
+
// what the run needs anyway.
|
|
9
|
+
const readStatus = (id: string, store: { read: (id: string) => { status: string } }): string =>
|
|
10
|
+
store.read(id).status
|
|
11
|
+
|
|
12
|
+
export const send = createWorkflow(
|
|
13
|
+
'invoice.send.helper',
|
|
14
|
+
async (id: string, { store }) => {
|
|
15
|
+
if (readStatus(id, store) !== 'draft') throw new Error('already sent')
|
|
16
|
+
|
|
17
|
+
return await save({ id })
|
|
18
|
+
},
|
|
19
|
+
{ execution: 'durable' },
|
|
20
|
+
)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createWorkflow } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED: an inline run is invoked once and never replayed, so a free read is read once. The
|
|
4
|
+
// law is about durability, not about ports.
|
|
5
|
+
export const price = createWorkflow('invoice.price', async (id: string, { store }) =>
|
|
6
|
+
store.read(id),
|
|
7
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createStep } from '@corpus/workflows'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED under `retryKey: 'retry'` — the budget this engine spells — and REPORTED under the
|
|
4
|
+
// default `maxRetries`, which is the whole of the option.
|
|
5
|
+
export const send = createStep(
|
|
6
|
+
{ name: 'send', retry: { backoff: 'exponential', limit: 3 } },
|
|
7
|
+
async (input, { store }) => store.updateDocument(input),
|
|
8
|
+
async ({ id }, { store }) => store.deleteDocument(id),
|
|
9
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const alphaThing = 'alpha'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const baseThing = 'base'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const methodThing = 'method'
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
|
|
3
|
+
"jsPlugins": [
|
|
4
|
+
"@geonosis/oxlint-plugin-biological-architecture"
|
|
5
|
+
],
|
|
6
|
+
"categories": {
|
|
7
|
+
"correctness": "off",
|
|
8
|
+
"suspicious": "off"
|
|
9
|
+
},
|
|
10
|
+
"rules": {
|
|
11
|
+
"biological-architecture/layer-walls": [
|
|
12
|
+
"error",
|
|
13
|
+
{
|
|
14
|
+
"typeOnly": "count",
|
|
15
|
+
"layers": [
|
|
16
|
+
{
|
|
17
|
+
"name": "domain-alpha-ui",
|
|
18
|
+
"paths": [
|
|
19
|
+
"(?:^|/)floors/domains/alpha/src/ui/",
|
|
20
|
+
"^@floor/domain-alpha/ui(/|$)"
|
|
21
|
+
],
|
|
22
|
+
"mayImport": [
|
|
23
|
+
"domain-alpha",
|
|
24
|
+
"foundation-above",
|
|
25
|
+
"foundation-base",
|
|
26
|
+
"method"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "domain-alpha",
|
|
31
|
+
"paths": [
|
|
32
|
+
"(?:^|/)floors/domains/alpha/src/",
|
|
33
|
+
"^@floor/domain-alpha(/|$)"
|
|
34
|
+
],
|
|
35
|
+
"mayImport": [
|
|
36
|
+
"foundation-above",
|
|
37
|
+
"foundation-base",
|
|
38
|
+
"method"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "domain-beta",
|
|
43
|
+
"paths": [
|
|
44
|
+
"(?:^|/)floors/domains/beta/src/",
|
|
45
|
+
"^@floor/domain-beta(/|$)"
|
|
46
|
+
],
|
|
47
|
+
"mayImport": [
|
|
48
|
+
"foundation-above",
|
|
49
|
+
"foundation-base",
|
|
50
|
+
"method"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "foundation-above",
|
|
55
|
+
"paths": [
|
|
56
|
+
"(?:^|/)floors/foundations/above/src/",
|
|
57
|
+
"^@floor/foundation-above(/|$)"
|
|
58
|
+
],
|
|
59
|
+
"mayImport": [
|
|
60
|
+
"foundation-base",
|
|
61
|
+
"method"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "foundation-base",
|
|
66
|
+
"paths": [
|
|
67
|
+
"(?:^|/)floors/foundations/base/src/",
|
|
68
|
+
"^@floor/foundation-base(/|$)"
|
|
69
|
+
],
|
|
70
|
+
"mayImport": [
|
|
71
|
+
"method"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "method",
|
|
76
|
+
"paths": [
|
|
77
|
+
"(?:^|/)floors/packages/[^/]+/src/",
|
|
78
|
+
"^@floor/method(/|$)"
|
|
79
|
+
],
|
|
80
|
+
"mayImport": []
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
package/corpus/manifest.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"plugin": "biological-architecture",
|
|
3
3
|
"rules": [
|
|
4
4
|
"biological-architecture/atom-no-deps",
|
|
5
|
+
"biological-architecture/boundary-time-is-primitive",
|
|
5
6
|
"biological-architecture/cell-must-be-stateful",
|
|
6
7
|
"biological-architecture/cell-must-not-compose-cell",
|
|
7
8
|
"biological-architecture/cell-no-cross-feature-organelles",
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
"biological-architecture/dialect-through-the-seam",
|
|
14
15
|
"biological-architecture/document-sagas-are-generic",
|
|
15
16
|
"biological-architecture/documents-share-one-table",
|
|
17
|
+
"biological-architecture/durable-body-reads-through-steps",
|
|
16
18
|
"biological-architecture/effect-hook-naming",
|
|
17
19
|
"biological-architecture/emit-declares-attempts",
|
|
18
20
|
"biological-architecture/font-roles-only",
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"biological-architecture/step-declares-compensation-or-none",
|
|
61
63
|
"biological-architecture/step-opens-its-own-cell",
|
|
62
64
|
"biological-architecture/store-route-scopes-tenant-data",
|
|
65
|
+
"biological-architecture/subpath-over-barrel",
|
|
63
66
|
"biological-architecture/subscriber-declares-id",
|
|
64
67
|
"biological-architecture/tables-declare-their-plane",
|
|
65
68
|
"biological-architecture/tenant-tables-carry-org-id",
|
|
@@ -69,6 +72,7 @@
|
|
|
69
72
|
"biological-architecture/tissue-no-hooks",
|
|
70
73
|
"biological-architecture/tissue-no-organelles",
|
|
71
74
|
"biological-architecture/tissue-no-stores",
|
|
75
|
+
"biological-architecture/todo-names-its-plan",
|
|
72
76
|
"biological-architecture/tokens-only-colors",
|
|
73
77
|
"biological-architecture/unique-query-step-name",
|
|
74
78
|
"biological-architecture/worker-handles-are-scoped",
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Document, documentOf } from '@corpus/domains'
|
|
2
|
+
|
|
3
|
+
// BREACH: every name here lives under one subpath, so this file names the root entry and takes the
|
|
4
|
+
// union of every subpath's module graph to reach one of them.
|
|
5
|
+
export const first = (kind: Document) => documentOf(kind)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Document, emit } from '@corpus/domains'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED: two subpaths in one import is what the root entry is for. Splitting it is a judgement
|
|
4
|
+
// about how many imports a file should carry, and this rule does not have one.
|
|
5
|
+
export const announce = (doc: Document) => emit(doc)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import dayjs from 'dayjs'
|
|
2
|
+
import utc from 'dayjs/plugin/utc'
|
|
3
|
+
|
|
4
|
+
dayjs.extend(utc)
|
|
5
|
+
|
|
6
|
+
const isoDateFormat = 'YYYY-MM-DD'
|
|
7
|
+
|
|
8
|
+
export const today = (nowMs: number = Date.now()): string => dayjs.utc(nowMs).format(isoDateFormat)
|
|
9
|
+
|
|
10
|
+
export const addDays = (date: string, days: number): string =>
|
|
11
|
+
dayjs.utc(date, isoDateFormat, true).add(days, 'day').format(isoDateFormat)
|
|
12
|
+
|
|
13
|
+
export const epochOf = (timestamp: string): number => Date.parse(timestamp)
|
|
14
|
+
|
|
15
|
+
export const toDate = (epochMs: number): Date => new Date(epochMs)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const generatedAt = new Date('2026-01-01T00:00:00.000Z').toISOString()
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { withCells } from '@corpus/cells'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED: the invocation runs inside the wrapper the options name, so the handle it opens is
|
|
4
|
+
// closed when the invocation ends.
|
|
5
|
+
export default {
|
|
6
|
+
queue: async (): Promise<void> => withCells(async () => undefined),
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { withConnection } from '@corpus/db'
|
|
2
|
+
|
|
3
|
+
// ACCEPTED: a second wrapper name, from the option. The rule shipped knowing only `withCells`, so a
|
|
4
|
+
// repo whose scope opener is called anything else read as unscoped for ever.
|
|
5
|
+
export default {
|
|
6
|
+
scheduled: async (): Promise<void> => withConnection(async () => undefined),
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRuntime } from '@geonosis/workflows'
|
|
2
|
+
|
|
3
|
+
import { journal } from './journal'
|
|
4
|
+
|
|
5
|
+
// BREACH: a durable host built with no `scope.perStep`. The instance hibernates between steps, so
|
|
6
|
+
// the handle this run opened once is closed by the time the second step reaches for it.
|
|
7
|
+
export const runtime = createRuntime({ journal, tenantId: 'acme' })
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { entrypointFor } from '@geonosis/workflows'
|
|
2
|
+
|
|
3
|
+
import { journal } from './journal'
|
|
4
|
+
import { withConnection } from './with-connection'
|
|
5
|
+
|
|
6
|
+
// ACCEPTED: the adapter's entry declares the scope one closure down, in the runtime it builds per
|
|
7
|
+
// run — which is where it has to be, because the handle belongs to the invocation that opened it.
|
|
8
|
+
export const Durable = entrypointFor({
|
|
9
|
+
base: WorkflowEntrypoint,
|
|
10
|
+
runtime: (env, params) =>
|
|
11
|
+
createRuntime({
|
|
12
|
+
journal: journal(env),
|
|
13
|
+
scope: { perStep: () => withConnection(env) },
|
|
14
|
+
tenantId: params.tenantId,
|
|
15
|
+
}),
|
|
16
|
+
workflows: [issue],
|
|
17
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRuntime } from '@geonosis/workflows'
|
|
2
|
+
|
|
3
|
+
import { journal } from './journal'
|
|
4
|
+
import { withConnection } from './with-connection'
|
|
5
|
+
|
|
6
|
+
// ACCEPTED: every step body and every undo is wrapped in a scope of its own.
|
|
7
|
+
export const runtime = createRuntime({
|
|
8
|
+
journal,
|
|
9
|
+
scope: { perStep: () => withConnection },
|
|
10
|
+
tenantId: 'acme',
|
|
11
|
+
})
|