@plurnk/plurnk-schemes 0.2.0 → 0.4.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 +11 -8
- package/SPEC.md +47 -19
- package/dist/ctx.d.ts +90 -0
- package/dist/ctx.d.ts.map +1 -0
- package/dist/ctx.js +34 -0
- package/dist/ctx.js.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/line-marker.d.ts +8 -5
- package/dist/line-marker.d.ts.map +1 -1
- package/dist/line-marker.js +282 -280
- package/dist/line-marker.js.map +1 -1
- package/dist/matcher.d.ts +4 -1
- package/dist/matcher.d.ts.map +1 -1
- package/dist/matcher.js +52 -48
- package/dist/matcher.js.map +1 -1
- package/dist/mimetype-binary.d.ts +6 -4
- package/dist/mimetype-binary.d.ts.map +1 -1
- package/dist/mimetype-binary.js +46 -41
- package/dist/mimetype-binary.js.map +1 -1
- package/dist/path-mimetype.d.ts +4 -1
- package/dist/path-mimetype.d.ts.map +1 -1
- package/dist/path-mimetype.js +27 -25
- package/dist/path-mimetype.js.map +1 -1
- package/dist/resolveForLoop.d.ts +12 -10
- package/dist/resolveForLoop.d.ts.map +1 -1
- package/dist/resolveForLoop.js +28 -26
- package/dist/resolveForLoop.js.map +1 -1
- package/dist/results.d.ts +8 -6
- package/dist/results.d.ts.map +1 -1
- package/dist/results.js +39 -25
- package/dist/results.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -11,17 +11,20 @@ Framework + contract for `@plurnk/plurnk-schemes-*` URI handler packages. Consum
|
|
|
11
11
|
|
|
12
12
|
### Types
|
|
13
13
|
|
|
14
|
-
`SchemeManifest`, `SchemeFlagAffinity`, `WriterTier`, `LoopFlags`, `DEFAULT_LOOP_FLAGS`.
|
|
14
|
+
- Manifest/flags: `SchemeManifest`, `SchemeFlagAffinity`, `WriterTier`, `LoopFlags`, `DEFAULT_LOOP_FLAGS`.
|
|
15
|
+
- Result families: `SchemeResult` / `EntryResult` / `ProposalResult` / `PassthroughResult` / `SchemeResultBase` / `TelemetryEvent`.
|
|
16
|
+
- Capability ctx: `SchemeCtx` + `EntryCaps` / `ChannelCaps` / `VisibilityCaps` / `TagCaps` / `NotifyCaps` / `SubscriptionCaps` / `CrossSchemeCaps`, plus `EntryData` / `ChannelState` / `SubscriptionHandle` / `ProposalAware`.
|
|
15
17
|
|
|
16
|
-
### Helpers
|
|
18
|
+
### Helpers (`export default class`, static methods)
|
|
17
19
|
|
|
18
|
-
- `
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
21
|
-
- `
|
|
22
|
-
- `matchAgainstContent(body, content, mimetype, mimetypes, baseLine?)` — body-matcher dispatch
|
|
20
|
+
- `SchemeResolver.forLoop(handlers, flags)` — active-scheme resolution under loop flags.
|
|
21
|
+
- `MimetypeClassifier.isBinary` / `.isLineNavigable` / `.isJson` / `.normalizeAutoText` (+ `TEXT_PRIMITIVE_MIMETYPE` named export) — mimetype classification.
|
|
22
|
+
- `Slicer.lines` / `.linesRaw` / `.jsonItems` / `.lineMarkerEdit` / `.jsonItemEdit` — `<L>` slicing + structural EDIT.
|
|
23
|
+
- `PathMimetype.resolve(pathname, default, mimetypes)` — path-extension mimetype resolver.
|
|
24
|
+
- `Matcher.matchAgainstContent(body, content, mimetype, mimetypes, baseLine?)` — body-matcher dispatch over `Mimetypes.query` (glob/regex/jsonpath/xpath).
|
|
25
|
+
- `Results.error` / `.logCoordinate` / `.isEntry` / `.isProposal` / `.isPassthrough` / `.isErrorStatus` — result builders + guards.
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
The **capability ctx** (`SchemeCtx`) is the DB-free authoring surface for siblings — interfaces only; plurnk-service injects the db-backed impl (see SPEC §3.bis). The db-backed implementations themselves (CRUD primitives, entry-op handlers, channel writes, subscription registry) stay in plurnk-service.
|
|
25
28
|
|
|
26
29
|
## Tests
|
|
27
30
|
|
package/SPEC.md
CHANGED
|
@@ -77,41 +77,69 @@ Result-type definitions (`EditResult`, `ReadResult`, etc.) live in plurnk-servic
|
|
|
77
77
|
|
|
78
78
|
### Types
|
|
79
79
|
|
|
80
|
-
- `SchemeManifest`, `SchemeFlagAffinity`, `WriterTier`, `LoopFlags`, `DEFAULT_LOOP_FLAGS`.
|
|
80
|
+
- Manifest/flags: `SchemeManifest`, `SchemeFlagAffinity`, `WriterTier`, `LoopFlags`, `DEFAULT_LOOP_FLAGS`.
|
|
81
|
+
- Result families: `SchemeResult` (`EntryResult` | `ProposalResult` | `PassthroughResult`), `SchemeResultBase`, `TelemetryEvent`. Keyed on scheme-shape, not op. `error` is a grammar `TelemetryEvent`, present iff `status >= 400`. Guards `isEntryResult` / `isProposalResult` / `isPassthroughResult` / `isErrorStatus`; builders `schemeError(scheme, kind, message?, position?)`, `logCoordinate(coordinate, op?)`.
|
|
82
|
+
- Capability ctx (PR-2, see §3.bis): `SchemeCtx` + `EntryCaps` / `ChannelCaps` / `VisibilityCaps` / `TagCaps` / `NotifyCaps` / `SubscriptionCaps` / `CrossSchemeCaps`, plus `EntryData`, `ChannelState`, `SubscriptionHandle`, `ProposalAware`.
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
Behavior ships as `export default class` (one class per file, static methods) — the ecosystem class paradigm. Type-only modules, the barrel, and the frozen `DEFAULT_LOOP_FLAGS` constant are the only non-class files.
|
|
83
85
|
|
|
84
|
-
-
|
|
86
|
+
### Active-scheme resolution — `SchemeResolver`
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
- `SchemeResolver.forLoop(handlers: ReadonlyMap<string, object>, flags: LoopFlags): Set<string>` — applies `manifest.flags` affinity to each handler and returns names of schemes active under the loop's flags.
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
- `isJsonMimetype(mimetype)` — `application/json` plus `+json` variants. Used by `<L>` dispatch.
|
|
90
|
-
- `isLineNavigableMimetype(mimetype)` — render-layer decides whether to prefix lines with `N:\t`.
|
|
91
|
-
- `normalizeAutoTextMimetype(mimetype)` — `text/plain` / null / undefined → `TEXT_PRIMITIVE_MIMETYPE` (`text/markdown`).
|
|
92
|
-
- `TEXT_PRIMITIVE_MIMETYPE` — `"text/markdown"`.
|
|
90
|
+
### Mimetype classification — `MimetypeClassifier`
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
- `MimetypeClassifier.isBinary(mimetype)` — enforces 415 boundary on binary entries (text/* is text; application/{json,yaml,toml,xml,javascript,typescript,sql} is text; `+json`/`+xml`/`+yaml` suffix variants are text; everything else with a slash is binary).
|
|
93
|
+
- `MimetypeClassifier.isJson(mimetype)` — `application/json` plus `+json` variants. Used by `<L>` dispatch.
|
|
94
|
+
- `MimetypeClassifier.isLineNavigable(mimetype)` — render-layer decides whether to prefix lines with `N:\t`.
|
|
95
|
+
- `MimetypeClassifier.normalizeAutoText(mimetype)` — `text/plain` / null / undefined → `TEXT_PRIMITIVE_MIMETYPE` (`text/markdown`).
|
|
96
|
+
- `TEXT_PRIMITIVE_MIMETYPE` — `"text/markdown"` (named export from the same module).
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
- `sliceLinesRaw(content, marker)` — same shape; no `N:\t` prefix.
|
|
98
|
-
- `sliceJsonItems(content, marker)` — JSON-source item slice. Returns `{ status, body?, error? }`.
|
|
99
|
-
- `applyLineMarkerEdit(content, marker, body)` — line-navigable EDIT.
|
|
100
|
-
- `applyJsonItemEdit(content, marker, body)` — structural JSON EDIT.
|
|
98
|
+
### `<L>` slicing — `Slicer`
|
|
101
99
|
|
|
102
|
-
|
|
100
|
+
- `Slicer.lines(content, marker)` — line-navigable slice. Returns `{ status, text?, startLine?, error? }`.
|
|
101
|
+
- `Slicer.linesRaw(content, marker)` — same shape; no `N:\t` prefix.
|
|
102
|
+
- `Slicer.jsonItems(content, marker)` — JSON-source item slice. Returns `{ status, body?, error? }`.
|
|
103
|
+
- `Slicer.lineMarkerEdit(content, marker, body)` — line-navigable EDIT.
|
|
104
|
+
- `Slicer.jsonItemEdit(content, marker, body)` — structural JSON EDIT.
|
|
103
105
|
|
|
104
|
-
-
|
|
106
|
+
### Path-extension mimetype — `PathMimetype`
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
- `PathMimetype.resolve(pathname, defaultMimetype, mimetypes)` — pathname extension → `Mimetypes.detect({ ext })`; falls back to `defaultMimetype` when no extension. text/plain auto-normalizes to text/markdown.
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
### Result families — `Results`
|
|
111
|
+
|
|
112
|
+
- `Results.isEntry` / `Results.isProposal` / `Results.isPassthrough` — `shape` discriminator guards over `SchemeResult`.
|
|
113
|
+
- `Results.isErrorStatus(status)` — `status >= 400`.
|
|
114
|
+
- `Results.error(scheme, kind, message?, position?)` — build a scheme-sourced `TelemetryEvent` (`source: "scheme:<name>"`).
|
|
115
|
+
- `Results.logCoordinate(coordinate, op?)` — build a `LogCoordinate` position.
|
|
116
|
+
|
|
117
|
+
### Matcher dispatch — `Matcher`
|
|
118
|
+
|
|
119
|
+
- `Matcher.matchAgainstContent(body, content, mimetype, mimetypes, baseLine?)` — body-matcher adapter over `Mimetypes.query` (glob/regex/jsonpath/xpath, all served by the framework). Maps framework errors:
|
|
109
120
|
- `UnsupportedDialectError` → status 415
|
|
110
121
|
- `InvalidExpressionError` → status 400
|
|
111
122
|
- `QueryParseFailureError` → status 203 (soft fallback: raw content as text/markdown with `reason`)
|
|
112
123
|
- Empty match array → status 204
|
|
113
124
|
- Match array → status 200
|
|
114
125
|
|
|
126
|
+
### §3.bis Capability ctx — the DB-free authoring surface
|
|
127
|
+
|
|
128
|
+
The contract that lets a third-party `@plurnk/plurnk-schemes-*` sibling be authored without importing `@plurnk/plurnk-service` or touching a raw DB handle (forbidden by §5). **Interfaces only**: this repo exports the shapes; plurnk-service injects a db-backed implementation behind them (the `scheme-types.ts` seam, widened). In-tree schemes keep using `db` directly during transition and cut over scheme-by-scheme. Design converged on [plurnk-service#180](https://github.com/plurnk/plurnk-service/issues/180).
|
|
129
|
+
|
|
130
|
+
`SchemeCtx` carries per-dispatch identity (`sessionId`/`runId`/`loopId`/`turnId`/`writer`/`signal`) plus **six live capability namespaces** replacing raw `db`:
|
|
131
|
+
|
|
132
|
+
- `entries` — CRUD over the scheme's own namespace (`read`/`write`/`delete`).
|
|
133
|
+
- `channels` — content writes + state (`append`/`replace`/`setState`).
|
|
134
|
+
- `visibility` — the per-(run, entry, channel) index bit (`show`/`hide`, channel optional).
|
|
135
|
+
- `tags` — entry tags (`add`/`remove`/`list`).
|
|
136
|
+
- `notify` — between-turn client/engine signals (`streamEvent`, `wakeRun`); not model-facing.
|
|
137
|
+
- `subscriptions` — streaming lifecycle: `open(pathname, handle)` returns a run+teardown-composed `AbortSignal` and takes a force-cancel `SubscriptionHandle`; `notifyChunk(channel, chunk)` is **fused** (append + stream/event in one call); `close(reason, outcome?)` composites channel state + registry close + run wake. Designed against Exec (two-channel, cancel-tested).
|
|
138
|
+
|
|
139
|
+
`crossScheme` is a **deferred** placeholder — no FROM/TO methods committed until the first real cross-scheme COPY/MOVE forces the shape.
|
|
140
|
+
|
|
141
|
+
**Proposals are not a capability.** A side-effecting scheme proposes by *returning* a `ProposalResult` (status 202); the engine owns the resolution lifecycle (await/accept/reject, YOLO/noProposals auto-resolve, timeout) and it is invisible to the sibling. The only sibling-side surface is the optional `ProposalAware.applyResolution(pathname, proposal, ctx)` hook the engine calls on accept.
|
|
142
|
+
|
|
115
143
|
## §4 What's NOT in this repo
|
|
116
144
|
|
|
117
145
|
DB-coupled helpers stay in plurnk-service for v0:
|
package/dist/ctx.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { WriterTier } from "./types.ts";
|
|
2
|
+
import type { ProposalResult, SchemeResult } from "./results.ts";
|
|
3
|
+
export type ChannelState = "static" | "active" | "closed" | "errored";
|
|
4
|
+
export interface EntryData {
|
|
5
|
+
readonly channels: Record<string, {
|
|
6
|
+
content: string;
|
|
7
|
+
mimetype: string;
|
|
8
|
+
state?: ChannelState;
|
|
9
|
+
}>;
|
|
10
|
+
readonly tags: ReadonlyArray<string>;
|
|
11
|
+
}
|
|
12
|
+
export interface EntryCaps {
|
|
13
|
+
read(pathname: string): Promise<{
|
|
14
|
+
status: number;
|
|
15
|
+
entry: EntryData | null;
|
|
16
|
+
}>;
|
|
17
|
+
write(pathname: string, entry: EntryData): Promise<{
|
|
18
|
+
status: number;
|
|
19
|
+
created: boolean;
|
|
20
|
+
entryId: number | null;
|
|
21
|
+
}>;
|
|
22
|
+
delete(pathname: string): Promise<{
|
|
23
|
+
status: number;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface ChannelCaps {
|
|
27
|
+
append(pathname: string, channel: string, content: string): Promise<{
|
|
28
|
+
status: number;
|
|
29
|
+
}>;
|
|
30
|
+
replace(pathname: string, channel: string, content: string): Promise<{
|
|
31
|
+
status: number;
|
|
32
|
+
}>;
|
|
33
|
+
setState(pathname: string, channel: string, state: ChannelState): Promise<{
|
|
34
|
+
status: number;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export interface VisibilityCaps {
|
|
38
|
+
show(pathname: string, channel?: string): Promise<{
|
|
39
|
+
status: number;
|
|
40
|
+
}>;
|
|
41
|
+
hide(pathname: string, channel?: string): Promise<{
|
|
42
|
+
status: number;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export interface TagCaps {
|
|
46
|
+
add(pathname: string, tags: ReadonlyArray<string>): Promise<{
|
|
47
|
+
status: number;
|
|
48
|
+
}>;
|
|
49
|
+
remove(pathname: string, tags: ReadonlyArray<string>): Promise<{
|
|
50
|
+
status: number;
|
|
51
|
+
}>;
|
|
52
|
+
list(pathname: string): Promise<{
|
|
53
|
+
status: number;
|
|
54
|
+
tags: ReadonlyArray<string>;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
export interface NotifyCaps {
|
|
58
|
+
streamEvent(pathname: string, channel: string, state: ChannelState, contentLength: number): void;
|
|
59
|
+
wakeRun(): void;
|
|
60
|
+
}
|
|
61
|
+
export interface SubscriptionCaps {
|
|
62
|
+
open(pathname: string, handle: SubscriptionHandle): Promise<AbortSignal>;
|
|
63
|
+
notifyChunk(channel: string, chunk: string): Promise<void>;
|
|
64
|
+
close(reason: "done" | "error", outcome?: string): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export interface SubscriptionHandle {
|
|
67
|
+
cancel(): void | Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export interface CrossSchemeCaps {
|
|
70
|
+
readonly _deferred: "see plurnk-service#180 — designed when first cross-scheme COPY/MOVE forces the FROM/TO shape";
|
|
71
|
+
}
|
|
72
|
+
export interface SchemeCtx {
|
|
73
|
+
readonly sessionId: number;
|
|
74
|
+
readonly runId: number;
|
|
75
|
+
readonly loopId: number;
|
|
76
|
+
readonly turnId: number;
|
|
77
|
+
readonly writer: WriterTier;
|
|
78
|
+
readonly signal: AbortSignal | undefined;
|
|
79
|
+
readonly entries: EntryCaps;
|
|
80
|
+
readonly channels: ChannelCaps;
|
|
81
|
+
readonly visibility: VisibilityCaps;
|
|
82
|
+
readonly tags: TagCaps;
|
|
83
|
+
readonly notify: NotifyCaps;
|
|
84
|
+
readonly subscriptions: SubscriptionCaps;
|
|
85
|
+
readonly crossScheme: CrossSchemeCaps;
|
|
86
|
+
}
|
|
87
|
+
export interface ProposalAware {
|
|
88
|
+
applyResolution(pathname: string, proposal: ProposalResult, ctx: SchemeCtx): Promise<SchemeResult>;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ctx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctx.d.ts","sourceRoot":"","sources":["../src/ctx.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,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@plurnk/plurnk-schemes-*` siblings (keystone PR-2; design converged on
|
|
3
|
+
// plurnk-service#180).
|
|
4
|
+
//
|
|
5
|
+
// PROBLEM this replaces: today a sibling receives plurnk-service's raw `Db`
|
|
6
|
+
// handle on `ctx.db` and reaches straight through it. SPEC §5 forbids a
|
|
7
|
+
// third-party scheme from importing `@plurnk/plurnk-service/*` or touching
|
|
8
|
+
// the database — so `ctx.db` is the contract, and it's an illegal one. A
|
|
9
|
+
// real sibling is therefore unbuildable.
|
|
10
|
+
//
|
|
11
|
+
// SHAPE: this module exports INTERFACES only. plurnk-service injects a
|
|
12
|
+
// db-backed implementation behind them (the existing `scheme-types.ts` seam,
|
|
13
|
+
// widened — not new machinery). In-tree schemes keep using `db` directly
|
|
14
|
+
// during transition; the cap impl is a thin adapter over the same
|
|
15
|
+
// `_entry-*.ts` / `ChannelWrite` helpers, cut over scheme-by-scheme.
|
|
16
|
+
//
|
|
17
|
+
// SIX live namespaces decompose what `ctx.db` is used for today:
|
|
18
|
+
// entries / channels / visibility / tags / notify — map 1:1 onto the
|
|
19
|
+
// `_entry-*.ts` + `ChannelWrite` helpers; wrap cleanly.
|
|
20
|
+
// subscriptions — the streaming
|
|
21
|
+
// lifecycle (open/notifyChunk/close); design against Exec, the proven
|
|
22
|
+
// two-channel cancel-tested case.
|
|
23
|
+
//
|
|
24
|
+
// NOT a namespace:
|
|
25
|
+
// proposals — collapses to "return a ProposalResult (202) + implement
|
|
26
|
+
// applyResolution"; the lifecycle (await/accept/reject, YOLO/noProposals
|
|
27
|
+
// auto-resolvers, timeout) is engine-owned and invisible to the sibling.
|
|
28
|
+
// Lives in the result family ([[results]]) + the optional handler hook
|
|
29
|
+
// below, not as an injected capability.
|
|
30
|
+
// crossScheme — deferred hard. Zero working cross-scheme COPY/MOVE exist
|
|
31
|
+
// to derive the FROM-vs-TO shape from; the first real `known://x` →
|
|
32
|
+
// `file://x.json` forces it. Stubbed as a named placeholder.
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=ctx.js.map
|
package/dist/ctx.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctx.js","sourceRoot":"","sources":["../src/ctx.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,0EAA0E;AAC1E,uBAAuB;AACvB,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,yEAAyE;AACzE,yCAAyC;AACzC,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,yEAAyE;AACzE,kEAAkE;AAClE,qEAAqE;AACrE,EAAE;AACF,iEAAiE;AACjE,wEAAwE;AACxE,4DAA4D;AAC5D,sEAAsE;AACtE,0EAA0E;AAC1E,sCAAsC;AACtC,EAAE;AACF,mBAAmB;AACnB,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,4CAA4C;AAC5C,2EAA2E;AAC3E,wEAAwE;AACxE,iEAAiE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export type { LoopFlags, SchemeFlagAffinity, SchemeManifest, WriterTier, } from "./types.ts";
|
|
2
2
|
export { DEFAULT_LOOP_FLAGS } from "./types.ts";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
3
|
+
export { default as SchemeResolver } from "./resolveForLoop.ts";
|
|
4
|
+
export { default as MimetypeClassifier, TEXT_PRIMITIVE_MIMETYPE } from "./mimetype-binary.ts";
|
|
5
|
+
export { default as Slicer } from "./line-marker.ts";
|
|
6
6
|
export type { EditResult as LineEditResult, JsonSliceResult, SliceResult } from "./line-marker.ts";
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
7
|
+
export { default as PathMimetype } from "./path-mimetype.ts";
|
|
8
|
+
export { default as Matcher } from "./matcher.ts";
|
|
9
9
|
export type { MatchResult } from "./matcher.ts";
|
|
10
|
-
export {
|
|
10
|
+
export { default as Results } from "./results.ts";
|
|
11
11
|
export type { EntryResult, PassthroughResult, ProposalResult, SchemeResult, SchemeResultBase, TelemetryEvent, } from "./results.ts";
|
|
12
|
+
export type { ChannelCaps, ChannelState, CrossSchemeCaps, EntryCaps, EntryData, NotifyCaps, ProposalAware, SchemeCtx, SubscriptionCaps, SubscriptionHandle, TagCaps, VisibilityCaps, } from "./ctx.ts";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,YAAY,EACR,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,UAAU,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,UAAU,IAAI,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EACR,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACjB,MAAM,cAAc,CAAC;AAItB,YAAY,EACR,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,SAAS,EACT,UAAU,EACV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,cAAc,GACjB,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
// Public API barrel for @plurnk/plurnk-schemes.
|
|
2
|
+
//
|
|
3
|
+
// Behavior ships as `export default class` (one class per file, static
|
|
4
|
+
// methods) per the ecosystem class paradigm. Type-only modules (types.ts,
|
|
5
|
+
// ctx.ts), the frozen constant (DEFAULT_LOOP_FLAGS), and this barrel are
|
|
6
|
+
// the only non-class files.
|
|
1
7
|
export { DEFAULT_LOOP_FLAGS } from "./types.js";
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
+
// ── Behavior classes ─────────────────────────────────────────────────────
|
|
9
|
+
export { default as SchemeResolver } from "./resolveForLoop.js";
|
|
10
|
+
export { default as MimetypeClassifier, TEXT_PRIMITIVE_MIMETYPE } from "./mimetype-binary.js";
|
|
11
|
+
export { default as Slicer } from "./line-marker.js";
|
|
12
|
+
export { default as PathMimetype } from "./path-mimetype.js";
|
|
13
|
+
export { default as Matcher } from "./matcher.js";
|
|
14
|
+
export { default as Results } from "./results.js";
|
|
8
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,4BAA4B;AAS5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,4EAA4E;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/line-marker.d.ts
CHANGED
|
@@ -5,19 +5,22 @@ export interface SliceResult {
|
|
|
5
5
|
startLine?: number;
|
|
6
6
|
error?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const sliceLines: (content: string, marker: LineMarker) => SliceResult;
|
|
9
8
|
export interface JsonSliceResult {
|
|
10
9
|
status: number;
|
|
11
10
|
body?: string;
|
|
12
11
|
error?: string;
|
|
13
12
|
}
|
|
14
|
-
export declare const sliceJsonItems: (content: string, marker: LineMarker) => JsonSliceResult;
|
|
15
|
-
export declare const applyJsonItemEdit: (content: string, marker: LineMarker, body: string) => EditResult;
|
|
16
|
-
export declare const sliceLinesRaw: (content: string, marker: LineMarker) => SliceResult;
|
|
17
13
|
export interface EditResult {
|
|
18
14
|
status: number;
|
|
19
15
|
result?: string;
|
|
20
16
|
error?: string;
|
|
21
17
|
}
|
|
22
|
-
export
|
|
18
|
+
export default class Slicer {
|
|
19
|
+
#private;
|
|
20
|
+
static lines(content: string, marker: LineMarker): SliceResult;
|
|
21
|
+
static jsonItems(content: string, marker: LineMarker): JsonSliceResult;
|
|
22
|
+
static jsonItemEdit(content: string, marker: LineMarker, body: string): EditResult;
|
|
23
|
+
static linesRaw(content: string, marker: LineMarker): SliceResult;
|
|
24
|
+
static lineMarkerEdit(content: string, marker: LineMarker, body: string): EditResult;
|
|
25
|
+
}
|
|
23
26
|
//# sourceMappingURL=line-marker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-marker.d.ts","sourceRoot":"","sources":["../src/line-marker.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"line-marker.d.ts","sourceRoot":"","sources":["../src/line-marker.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAQzD,MAAM,WAAW,WAAW;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AAClG,MAAM,WAAW,eAAe;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AAClF,MAAM,WAAW,UAAU;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AAE/E,MAAM,CAAC,OAAO,OAAO,MAAM;;IAoCvB,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,WAAW;IA+B9D,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,eAAe;IAgItE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU;IAsBlF,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,WAAW;IAiBjE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU;CAkBvF"}
|