@prestack/thread 0.1.21 → 0.1.23
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/CHANGELOG.md +227 -0
- package/dist/core/attach.js +21 -0
- package/dist/core/descend.js +6 -3
- package/dist/core/generators/commit.js +55 -3
- package/dist/core/generators/dev.d.ts +1 -0
- package/dist/core/generators/dev.js +69 -0
- package/dist/derivation/generators/build.d.ts +3 -1
- package/dist/derivation/generators/build.js +104 -22
- package/dist/derivation/generators/release.js +74 -25
- package/dist/derivation/release.js +3 -3
- package/dist/integrations/cli.d.ts +0 -1
- package/dist/integrations/cli.js +69 -11
- package/dist/integrations/declared.d.ts +2 -0
- package/dist/integrations/declared.js +6 -1
- package/dist/integrations/pglite.js +13 -3
- package/dist/integrations/target.d.ts +3 -0
- package/dist/integrity/attach.js +1 -5
- package/dist/integrity/slopnators/sl_stale_path.js +10 -0
- package/dist/operations/access.js +3 -2
- package/dist/operations/capabilities.d.ts +2 -0
- package/dist/operations/capabilities.js +2 -0
- package/dist/operations/generators/capability.js +237 -24
- package/dist/operations/generators/compile.js +150 -50
- package/dist/operations/generators/seed.d.ts +3 -0
- package/dist/operations/generators/seed.js +25 -3
- package/dist/operations/nodes.d.ts +2 -2
- package/package.json +1 -1
- package/dist/core/actor.ts +0 -21
- package/dist/core/attach.ts +0 -613
- package/dist/core/chain.ts +0 -145
- package/dist/core/condition.ts +0 -227
- package/dist/core/descend.ts +0 -1185
- package/dist/core/errors/catalogue.ts +0 -314
- package/dist/core/errors/classes.ts +0 -51
- package/dist/core/errors/error.ts +0 -152
- package/dist/core/errors/namespaces.ts +0 -19
- package/dist/core/finding.ts +0 -37
- package/dist/core/generators/commit.ts +0 -157
- package/dist/core/init.ts +0 -222
- package/dist/core/invoked.ts +0 -52
- package/dist/core/round.ts +0 -74
- package/dist/core/rows.ts +0 -506
- package/dist/core/scope.ts +0 -20
- package/dist/core/thread.ts +0 -29
- package/dist/core/tree.ts +0 -90
- package/dist/core/types.ts +0 -351
- package/dist/derivation/attach.ts +0 -57
- package/dist/derivation/generators/build.ts +0 -371
- package/dist/derivation/generators/check.ts +0 -118
- package/dist/derivation/generators/determinism.ts +0 -145
- package/dist/derivation/generators/release.ts +0 -236
- package/dist/derivation/release.ts +0 -43
- package/dist/integrations/attach.ts +0 -187
- package/dist/integrations/cli.ts +0 -606
- package/dist/integrations/declared.ts +0 -34
- package/dist/integrations/disk.ts +0 -466
- package/dist/integrations/generators/read.ts +0 -127
- package/dist/integrations/generators/vault.ts +0 -210
- package/dist/integrations/https.ts +0 -216
- package/dist/integrations/pglite.ts +0 -206
- package/dist/integrations/secret.ts +0 -54
- package/dist/integrations/target.ts +0 -672
- package/dist/integrations/vault.ts +0 -148
- package/dist/integrity/attach.ts +0 -150
- package/dist/integrity/check-threads.ts +0 -166
- package/dist/integrity/constraint.ts +0 -1246
- package/dist/integrity/generators/compiler.ts +0 -138
- package/dist/integrity/generators/gate.ts +0 -227
- package/dist/integrity/generators/issues.ts +0 -160
- package/dist/integrity/generators/publish.ts +0 -233
- package/dist/integrity/generators/trial.ts +0 -359
- package/dist/integrity/lint.ts +0 -214
- package/dist/integrity/lsp/bin.ts +0 -44
- package/dist/integrity/lsp/diagnostics.ts +0 -92
- package/dist/integrity/lsp/findings.ts +0 -63
- package/dist/integrity/lsp/lint.ts +0 -124
- package/dist/integrity/lsp/protocol.ts +0 -78
- package/dist/integrity/lsp/server.ts +0 -224
- package/dist/integrity/slopnator.ts +0 -324
- package/dist/integrity/slopnators/sl_broken_lineage.ts +0 -38
- package/dist/integrity/slopnators/sl_declared_elsewhere.ts +0 -60
- package/dist/integrity/slopnators/sl_derived_drift.ts +0 -101
- package/dist/integrity/slopnators/sl_door_in_a_node.ts +0 -250
- package/dist/integrity/slopnators/sl_hardcoded_style.ts +0 -55
- package/dist/integrity/slopnators/sl_inert_island.ts +0 -84
- package/dist/integrity/slopnators/sl_inert_slopnator.ts +0 -93
- package/dist/integrity/slopnators/sl_missing_row.ts +0 -140
- package/dist/integrity/slopnators/sl_no_barrel.ts +0 -48
- package/dist/integrity/slopnators/sl_no_child_process.ts +0 -100
- package/dist/integrity/slopnators/sl_no_comment.ts +0 -43
- package/dist/integrity/slopnators/sl_no_dispatch_bypass.ts +0 -276
- package/dist/integrity/slopnators/sl_no_import_cycle.ts +0 -66
- package/dist/integrity/slopnators/sl_no_such_command.ts +0 -81
- package/dist/integrity/slopnators/sl_only_takes_a_literal.ts +0 -63
- package/dist/integrity/slopnators/sl_outside_an_operation.ts +0 -25
- package/dist/integrity/slopnators/sl_screen_holds_only_declared.ts +0 -70
- package/dist/integrity/slopnators/sl_secret_literal.ts +0 -68
- package/dist/integrity/slopnators/sl_stale_path.ts +0 -178
- package/dist/integrity/slopnators/sl_twice_meant.ts +0 -57
- package/dist/integrity/slopnators/sl_twice_parented.ts +0 -82
- package/dist/integrity/slopnators/sl_undeclared_crossing.ts +0 -481
- package/dist/integrity/slopnators/sl_undeclared_destination.ts +0 -113
- package/dist/integrity/slopnators/sl_undeclared_element.ts +0 -44
- package/dist/integrity/slopnators/sl_undeclared_list.ts +0 -358
- package/dist/integrity/slopnators/sl_undeclared_node.ts +0 -75
- package/dist/integrity/slopnators/sl_undeclared_operation.ts +0 -257
- package/dist/integrity/slopnators/sl_undeclared_variant.ts +0 -152
- package/dist/integrity/slopnators/sl_undeclared_webhook.ts +0 -108
- package/dist/integrity/slopnators/sl_underived_route.ts +0 -72
- package/dist/integrity/slopnators/sl_undescribed.ts +0 -65
- package/dist/integrity/slopnators/sl_ungoverned_island.ts +0 -60
- package/dist/integrity/slopnators/sl_unlisted_program.ts +0 -46
- package/dist/integrity/slopnators/sl_unnamed_island.ts +0 -41
- package/dist/integrity/slopnators/sl_unpaired_member.ts +0 -139
- package/dist/integrity/slopnators/sl_unpaired_slopnator.ts +0 -71
- package/dist/integrity/slopnators/sl_unprefixed_member.ts +0 -110
- package/dist/integrity/slopnators/sl_unthreaded.ts +0 -421
- package/dist/integrity/slopnators/sl_untranslated_key.ts +0 -140
- package/dist/integrity/slopnators/sl_unvaulted_secret.ts +0 -132
- package/dist/integrity/slopnators/sl_unversioned.ts +0 -52
- package/dist/integrity/sweep.ts +0 -395
- package/dist/knowledge/attach.ts +0 -327
- package/dist/knowledge/generators/docsgen.ts +0 -186
- package/dist/knowledge/generators/glossary.ts +0 -73
- package/dist/knowledge/glossary.ts +0 -6
- package/dist/operations/access.ts +0 -131
- package/dist/operations/attach.ts +0 -408
- package/dist/operations/capabilities.ts +0 -88
- package/dist/operations/dispatch.ts +0 -294
- package/dist/operations/error-results.ts +0 -31
- package/dist/operations/generators/capability.ts +0 -1054
- package/dist/operations/generators/compile.ts +0 -701
- package/dist/operations/generators/permits.ts +0 -229
- package/dist/operations/generators/seed.ts +0 -359
- package/dist/operations/generators/trial.ts +0 -666
- package/dist/operations/nodes.ts +0 -53
- package/dist/operations/operations.ts +0 -91
- package/dist/operations/result.ts +0 -28
package/dist/operations/nodes.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { Threaded } from '../core/thread.ts'
|
|
2
|
-
|
|
3
|
-
import type { Opened, Operation, Reads } from './operations.ts'
|
|
4
|
-
|
|
5
|
-
export interface Node extends Threaded {
|
|
6
|
-
readonly version: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type Held<I = unknown> = Parameters<Operation<I>['run']>[1]
|
|
10
|
-
|
|
11
|
-
export const STOPPED = Symbol.for('thread.operation.stopped')
|
|
12
|
-
|
|
13
|
-
export function stopped(thrown: unknown): { readonly value: unknown } | undefined {
|
|
14
|
-
if (typeof thrown !== 'object' || thrown === null) return undefined
|
|
15
|
-
if ((thrown as Record<symbol, unknown>)[STOPPED] !== true) return undefined
|
|
16
|
-
return { value: (thrown as { readonly value?: unknown }).value }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const nd_read = <I, R extends string = never>(
|
|
20
|
-
block: (opened: Reads<Opened<R>>, held: Held<I>) => Promise<unknown>,
|
|
21
|
-
) => ({ type: 'nd_read' as const })
|
|
22
|
-
|
|
23
|
-
export const nd_action = <I, R extends string = never>(
|
|
24
|
-
block: (opened: Opened<R>, held: Held<I>) => Promise<unknown>,
|
|
25
|
-
) => ({ type: 'nd_action' as const })
|
|
26
|
-
|
|
27
|
-
export const nd_branch = <I, R extends string = never>(
|
|
28
|
-
choose: (opened: Reads<Opened<R>>, held: Held<I>) => Promise<string>,
|
|
29
|
-
ways: Readonly<Record<string, (opened: Opened<R>, held: Held<I>) => Promise<unknown>>>,
|
|
30
|
-
) => ({ type: 'nd_branch' as const })
|
|
31
|
-
|
|
32
|
-
export const nd_each = <I, R extends string = never>(
|
|
33
|
-
over: (held: Held<I>) => readonly unknown[],
|
|
34
|
-
block: (item: unknown, opened: Opened<R>, held: Held<I>) => Promise<unknown>,
|
|
35
|
-
) => ({ type: 'nd_each' as const })
|
|
36
|
-
|
|
37
|
-
export const nd_parallel = <I, R extends string = never>(
|
|
38
|
-
blocks: readonly ((opened: Opened<R>, held: Held<I>) => Promise<unknown>)[],
|
|
39
|
-
) => ({ type: 'nd_parallel' as const })
|
|
40
|
-
|
|
41
|
-
export const nd_repeat = <I, R extends string = never>(
|
|
42
|
-
ceiling: number,
|
|
43
|
-
block: (
|
|
44
|
-
pass: number,
|
|
45
|
-
carried: unknown,
|
|
46
|
-
opened: Opened<R>,
|
|
47
|
-
held: Held<I>,
|
|
48
|
-
) => Promise<{ readonly done: boolean; readonly value: unknown }>,
|
|
49
|
-
) => ({ type: 'nd_repeat' as const })
|
|
50
|
-
|
|
51
|
-
export const nd_stop = <I, R extends string = never>(
|
|
52
|
-
block: (opened: Reads<Opened<R>>, held: Held<I>) => Promise<unknown>,
|
|
53
|
-
) => ({ type: 'nd_stop' as const })
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
import type { Actor } from '../core/actor.ts'
|
|
4
|
-
import type { Member } from '../core/thread.ts'
|
|
5
|
-
import { REACH, type Answering, type Calling, type HttpResponse, type Row, type Running, type Store } from '../integrations/target.ts'
|
|
6
|
-
|
|
7
|
-
import type { Surface } from './capabilities.ts'
|
|
8
|
-
|
|
9
|
-
export const OPERATIONS_FILE = 'operations.ts'
|
|
10
|
-
|
|
11
|
-
export const TRIALS_AT = 'operations/_trials.json'
|
|
12
|
-
|
|
13
|
-
export const NODES_FILE = 'nodes.ts'
|
|
14
|
-
|
|
15
|
-
export const MEMBERS_LIST = 'MEMBERS'
|
|
16
|
-
|
|
17
|
-
export interface Reaching {}
|
|
18
|
-
|
|
19
|
-
type CallsOf<K extends string> = K extends keyof Reaching ? (Reaching[K] extends string ? Reaching[K] : string) : string
|
|
20
|
-
|
|
21
|
-
export type Opened<R extends string = never> = { readonly actor: Actor; readonly tell: (said: unknown) => void } & {
|
|
22
|
-
readonly [K in R]: K extends `${typeof REACH.disk}${string}`
|
|
23
|
-
? Answering
|
|
24
|
-
: K extends `${typeof REACH.cli}${string}`
|
|
25
|
-
? Running<CallsOf<K>>
|
|
26
|
-
: K extends `${typeof REACH.postgres}${string}` | `${typeof REACH.pglite}${string}` | `${typeof REACH.browser}${string}`
|
|
27
|
-
? Store
|
|
28
|
-
: K extends `${typeof REACH.sdk}${string}`
|
|
29
|
-
? Calling<CallsOf<K>>
|
|
30
|
-
: Readonly<
|
|
31
|
-
Record<
|
|
32
|
-
CallsOf<K>,
|
|
33
|
-
(given?: {
|
|
34
|
-
readonly fills?: Readonly<Record<string, string | number>>
|
|
35
|
-
readonly json?: unknown
|
|
36
|
-
readonly body?: Uint8Array
|
|
37
|
-
readonly contentType?: string
|
|
38
|
-
readonly told?: (said: unknown) => void
|
|
39
|
-
}) => Promise<HttpResponse>
|
|
40
|
-
>
|
|
41
|
-
>
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type Reads<H> = { readonly [K in keyof H]: H[K] extends Store ? Pick<Store, 'get' | 'list'> : H[K] }
|
|
45
|
-
|
|
46
|
-
export const WINDOWS = ['second', 'minute', 'hour', 'day', 'week', 'month'] as const
|
|
47
|
-
|
|
48
|
-
export type Window = (typeof WINDOWS)[number]
|
|
49
|
-
|
|
50
|
-
export interface Allowance {
|
|
51
|
-
readonly runs: number
|
|
52
|
-
|
|
53
|
-
readonly per: Window
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface Counting {
|
|
57
|
-
readonly seen: (key: string, per: Window) => Promise<number>
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface Operation<I = unknown, R extends string = never> {
|
|
61
|
-
readonly id: string
|
|
62
|
-
|
|
63
|
-
readonly input: z.ZodType<I>
|
|
64
|
-
|
|
65
|
-
readonly requires: readonly string[]
|
|
66
|
-
|
|
67
|
-
readonly webhooks?: readonly string[]
|
|
68
|
-
|
|
69
|
-
readonly off?: readonly Surface[]
|
|
70
|
-
|
|
71
|
-
readonly signed?: boolean
|
|
72
|
-
|
|
73
|
-
readonly entitled?: string
|
|
74
|
-
|
|
75
|
-
readonly rate?: Allowance
|
|
76
|
-
|
|
77
|
-
readonly quota?: Allowance
|
|
78
|
-
|
|
79
|
-
readonly run: (
|
|
80
|
-
opened: Opened<R>,
|
|
81
|
-
held: { readonly input: I } & Readonly<Record<string, unknown>>,
|
|
82
|
-
) => Promise<unknown>
|
|
83
|
-
|
|
84
|
-
readonly timeout: number
|
|
85
|
-
|
|
86
|
-
readonly resource: (input: I) => Row | null
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export type OperationMember = Member & Pick<Operation, 'timeout' | 'webhooks' | 'off' | 'signed' | 'entitled' | 'rate' | 'quota'>
|
|
90
|
-
|
|
91
|
-
export const OPERATIONS: readonly Member[] = []
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ErrorCode, ErrorDef } from '../core/errors/error.ts'
|
|
2
|
-
import type { ErrorClass } from '../core/errors/classes.ts'
|
|
3
|
-
|
|
4
|
-
export type ResultCode = 'denied' | 'invalid' | 'rate_limited' | 'feature_denied' | 'quota_exceeded' | 'error'
|
|
5
|
-
|
|
6
|
-
export type FailureIdentity = Pick<ErrorDef, 'code' | 'class'>
|
|
7
|
-
|
|
8
|
-
export type Result<O> =
|
|
9
|
-
| { ok: true; value: O }
|
|
10
|
-
| {
|
|
11
|
-
ok: false
|
|
12
|
-
code: ResultCode
|
|
13
|
-
error: string
|
|
14
|
-
because?: string
|
|
15
|
-
errorCode?: ErrorCode
|
|
16
|
-
errorClass?: ErrorClass
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const ok = <O>(value: O): Result<O> => ({ ok: true, value })
|
|
20
|
-
export const fail = <O>(code: ResultCode, error: string, because?: string, identity?: FailureIdentity): Result<O> => ({
|
|
21
|
-
ok: false,
|
|
22
|
-
code,
|
|
23
|
-
error,
|
|
24
|
-
because,
|
|
25
|
-
...(identity === undefined ? {} : { errorCode: identity.code, errorClass: identity.class }),
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export class ValidationError extends Error {}
|