@plurnk/plurnk-schemes 0.3.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 +8 -8
- package/SPEC.md +27 -18
- package/dist/index.d.ts +6 -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 +1 -1
package/README.md
CHANGED
|
@@ -15,14 +15,14 @@ Framework + contract for `@plurnk/plurnk-schemes-*` URI handler packages. Consum
|
|
|
15
15
|
- Result families: `SchemeResult` / `EntryResult` / `ProposalResult` / `PassthroughResult` / `SchemeResultBase` / `TelemetryEvent`.
|
|
16
16
|
- Capability ctx: `SchemeCtx` + `EntryCaps` / `ChannelCaps` / `VisibilityCaps` / `TagCaps` / `NotifyCaps` / `SubscriptionCaps` / `CrossSchemeCaps`, plus `EntryData` / `ChannelState` / `SubscriptionHandle` / `ProposalAware`.
|
|
17
17
|
|
|
18
|
-
### Helpers
|
|
19
|
-
|
|
20
|
-
- `
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `matchAgainstContent(body, content, mimetype, mimetypes, baseLine?)` — body-matcher dispatch
|
|
25
|
-
-
|
|
18
|
+
### Helpers (`export default class`, static methods)
|
|
19
|
+
|
|
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.
|
|
26
26
|
|
|
27
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.
|
|
28
28
|
|
package/SPEC.md
CHANGED
|
@@ -81,33 +81,42 @@ Result-type definitions (`EditResult`, `ReadResult`, etc.) live in plurnk-servic
|
|
|
81
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
82
|
- Capability ctx (PR-2, see §3.bis): `SchemeCtx` + `EntryCaps` / `ChannelCaps` / `VisibilityCaps` / `TagCaps` / `NotifyCaps` / `SubscriptionCaps` / `CrossSchemeCaps`, plus `EntryData`, `ChannelState`, `SubscriptionHandle`, `ProposalAware`.
|
|
83
83
|
|
|
84
|
-
|
|
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.
|
|
85
85
|
|
|
86
|
-
-
|
|
86
|
+
### Active-scheme resolution — `SchemeResolver`
|
|
87
87
|
|
|
88
|
-
|
|
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.
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
- `isJsonMimetype(mimetype)` — `application/json` plus `+json` variants. Used by `<L>` dispatch.
|
|
92
|
-
- `isLineNavigableMimetype(mimetype)` — render-layer decides whether to prefix lines with `N:\t`.
|
|
93
|
-
- `normalizeAutoTextMimetype(mimetype)` — `text/plain` / null / undefined → `TEXT_PRIMITIVE_MIMETYPE` (`text/markdown`).
|
|
94
|
-
- `TEXT_PRIMITIVE_MIMETYPE` — `"text/markdown"`.
|
|
90
|
+
### Mimetype classification — `MimetypeClassifier`
|
|
95
91
|
|
|
96
|
-
|
|
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).
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
- `sliceLinesRaw(content, marker)` — same shape; no `N:\t` prefix.
|
|
100
|
-
- `sliceJsonItems(content, marker)` — JSON-source item slice. Returns `{ status, body?, error? }`.
|
|
101
|
-
- `applyLineMarkerEdit(content, marker, body)` — line-navigable EDIT.
|
|
102
|
-
- `applyJsonItemEdit(content, marker, body)` — structural JSON EDIT.
|
|
98
|
+
### `<L>` slicing — `Slicer`
|
|
103
99
|
|
|
104
|
-
|
|
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.
|
|
105
105
|
|
|
106
|
-
-
|
|
106
|
+
### Path-extension mimetype — `PathMimetype`
|
|
107
107
|
|
|
108
|
-
|
|
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.
|
|
109
109
|
|
|
110
|
-
|
|
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:
|
|
111
120
|
- `UnsupportedDialectError` → status 415
|
|
112
121
|
- `InvalidExpressionError` → status 400
|
|
113
122
|
- `QueryParseFailureError` → status 203 (soft fallback: raw content as text/markdown with `reason`)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +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
12
|
export type { ChannelCaps, ChannelState, CrossSchemeCaps, EntryCaps, EntryData, NotifyCaps, ProposalAware, SchemeCtx, SubscriptionCaps, SubscriptionHandle, TagCaps, VisibilityCaps, } from "./ctx.ts";
|
|
13
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"}
|