@astrale-os/kernel-client 0.2.4 → 0.3.1
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/dist/auth/addressing.d.ts +32 -0
- package/dist/auth/addressing.d.ts.map +1 -0
- package/dist/auth/addressing.js +36 -0
- package/dist/auth/addressing.js.map +1 -0
- package/dist/auth/api.d.ts +69 -0
- package/dist/auth/api.d.ts.map +1 -0
- package/dist/auth/api.js +24 -0
- package/dist/auth/api.js.map +1 -0
- package/dist/auth/batch.d.ts +18 -0
- package/dist/auth/batch.d.ts.map +1 -0
- package/dist/auth/batch.js +25 -0
- package/dist/auth/batch.js.map +1 -0
- package/dist/auth/composition.d.ts +27 -0
- package/dist/auth/composition.d.ts.map +1 -0
- package/dist/auth/composition.js +83 -0
- package/dist/auth/composition.js.map +1 -0
- package/dist/auth/index.d.ts +14 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +9 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/minting.d.ts +35 -0
- package/dist/auth/minting.d.ts.map +1 -0
- package/dist/auth/minting.js +35 -0
- package/dist/auth/minting.js.map +1 -0
- package/dist/auth/permissions.d.ts +55 -0
- package/dist/auth/permissions.d.ts.map +1 -0
- package/dist/auth/permissions.js +47 -0
- package/dist/auth/permissions.js.map +1 -0
- package/dist/auth/principal.d.ts +19 -0
- package/dist/auth/principal.d.ts.map +1 -0
- package/dist/auth/principal.js +46 -0
- package/dist/auth/principal.js.map +1 -0
- package/dist/errors/errors.d.ts +53 -0
- package/dist/errors/errors.d.ts.map +1 -1
- package/dist/errors/errors.js +69 -1
- package/dist/errors/errors.js.map +1 -1
- package/dist/errors/guards.d.ts +39 -0
- package/dist/errors/guards.d.ts.map +1 -0
- package/dist/errors/guards.js +127 -0
- package/dist/errors/guards.js.map +1 -0
- package/dist/errors/index.d.ts +4 -2
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/graph/api.d.ts +82 -0
- package/dist/graph/api.d.ts.map +1 -0
- package/dist/graph/api.js +64 -0
- package/dist/graph/api.js.map +1 -0
- package/dist/graph/index.d.ts +24 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +20 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/mutate/builder.d.ts +108 -0
- package/dist/graph/mutate/builder.d.ts.map +1 -0
- package/dist/graph/mutate/builder.js +127 -0
- package/dist/graph/mutate/builder.js.map +1 -0
- package/dist/graph/mutate/index.d.ts +5 -0
- package/dist/graph/mutate/index.d.ts.map +1 -0
- package/dist/graph/mutate/index.js +3 -0
- package/dist/graph/mutate/index.js.map +1 -0
- package/dist/graph/mutate/shorthands.d.ts +42 -0
- package/dist/graph/mutate/shorthands.d.ts.map +1 -0
- package/dist/graph/mutate/shorthands.js +65 -0
- package/dist/graph/mutate/shorthands.js.map +1 -0
- package/dist/graph/named.d.ts +38 -0
- package/dist/graph/named.d.ts.map +1 -0
- package/dist/graph/named.js +47 -0
- package/dist/graph/named.js.map +1 -0
- package/dist/graph/query/builder.d.ts +116 -0
- package/dist/graph/query/builder.d.ts.map +1 -0
- package/dist/graph/query/builder.js +136 -0
- package/dist/graph/query/builder.js.map +1 -0
- package/dist/graph/query/edge-ref.d.ts +13 -0
- package/dist/graph/query/edge-ref.d.ts.map +1 -0
- package/dist/graph/query/edge-ref.js +56 -0
- package/dist/graph/query/edge-ref.js.map +1 -0
- package/dist/graph/query/edges.d.ts +10 -0
- package/dist/graph/query/edges.d.ts.map +1 -0
- package/dist/graph/query/edges.js +11 -0
- package/dist/graph/query/edges.js.map +1 -0
- package/dist/graph/query/errors.d.ts +31 -0
- package/dist/graph/query/errors.d.ts.map +1 -0
- package/dist/graph/query/errors.js +28 -0
- package/dist/graph/query/errors.js.map +1 -0
- package/dist/graph/query/filter.d.ts +50 -0
- package/dist/graph/query/filter.d.ts.map +1 -0
- package/dist/graph/query/filter.js +32 -0
- package/dist/graph/query/filter.js.map +1 -0
- package/dist/graph/query/index.d.ts +12 -0
- package/dist/graph/query/index.d.ts.map +1 -0
- package/dist/graph/query/index.js +7 -0
- package/dist/graph/query/index.js.map +1 -0
- package/dist/graph/query/lower.d.ts +30 -0
- package/dist/graph/query/lower.d.ts.map +1 -0
- package/dist/graph/query/lower.js +171 -0
- package/dist/graph/query/lower.js.map +1 -0
- package/dist/graph/query/shorthands.d.ts +34 -0
- package/dist/graph/query/shorthands.d.ts.map +1 -0
- package/dist/graph/query/shorthands.js +71 -0
- package/dist/graph/query/shorthands.js.map +1 -0
- package/dist/graph/query/traverse.d.ts +59 -0
- package/dist/graph/query/traverse.d.ts.map +1 -0
- package/dist/graph/query/traverse.js +144 -0
- package/dist/graph/query/traverse.js.map +1 -0
- package/dist/graph/result/envelope.d.ts +37 -0
- package/dist/graph/result/envelope.d.ts.map +1 -0
- package/dist/graph/result/envelope.js +59 -0
- package/dist/graph/result/envelope.js.map +1 -0
- package/dist/graph/result/index.d.ts +6 -0
- package/dist/graph/result/index.d.ts.map +1 -0
- package/dist/graph/result/index.js +4 -0
- package/dist/graph/result/index.js.map +1 -0
- package/dist/graph/result/next.d.ts +16 -0
- package/dist/graph/result/next.d.ts.map +1 -0
- package/dist/graph/result/next.js +77 -0
- package/dist/graph/result/next.js.map +1 -0
- package/dist/graph/result/paged.d.ts +30 -0
- package/dist/graph/result/paged.d.ts.map +1 -0
- package/dist/graph/result/paged.js +41 -0
- package/dist/graph/result/paged.js.map +1 -0
- package/dist/graph/wire.d.ts +33 -0
- package/dist/graph/wire.d.ts.map +1 -0
- package/dist/graph/wire.js +16 -0
- package/dist/graph/wire.js.map +1 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/schema/bound/binder.d.ts +49 -0
- package/dist/schema/bound/binder.d.ts.map +1 -0
- package/dist/schema/bound/binder.js +192 -0
- package/dist/schema/bound/binder.js.map +1 -0
- package/dist/schema/bound/bound-node.d.ts +89 -0
- package/dist/schema/bound/bound-node.d.ts.map +1 -0
- package/dist/schema/bound/bound-node.js +77 -0
- package/dist/schema/bound/bound-node.js.map +1 -0
- package/dist/schema/bound/index.d.ts +10 -0
- package/dist/schema/bound/index.d.ts.map +1 -0
- package/dist/schema/bound/index.js +5 -0
- package/dist/schema/bound/index.js.map +1 -0
- package/dist/schema/bound/view.d.ts +48 -0
- package/dist/schema/bound/view.d.ts.map +1 -0
- package/dist/schema/bound/view.js +90 -0
- package/dist/schema/bound/view.js.map +1 -0
- package/dist/schema/bound/write-props.d.ts +38 -0
- package/dist/schema/bound/write-props.d.ts.map +1 -0
- package/dist/schema/bound/write-props.js +2 -0
- package/dist/schema/bound/write-props.js.map +1 -0
- package/dist/schema/extract.d.ts +12 -0
- package/dist/schema/extract.d.ts.map +1 -1
- package/dist/schema/extract.js +16 -0
- package/dist/schema/extract.js.map +1 -1
- package/dist/schema/index.d.ts +7 -3
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -2
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/node-proxy.d.ts +9 -0
- package/dist/schema/node-proxy.d.ts.map +1 -1
- package/dist/schema/node-proxy.js +31 -1
- package/dist/schema/node-proxy.js.map +1 -1
- package/dist/{persistence → schema}/persistence.d.ts +1 -22
- package/dist/schema/persistence.d.ts.map +1 -0
- package/dist/schema/persistence.js +2 -0
- package/dist/schema/persistence.js.map +1 -0
- package/dist/schema/proxy-types.d.ts +28 -22
- package/dist/schema/proxy-types.d.ts.map +1 -1
- package/dist/schema/registry.d.ts +1 -2
- package/dist/schema/registry.d.ts.map +1 -1
- package/dist/schema/registry.js +1 -2
- package/dist/schema/registry.js.map +1 -1
- package/dist/session/bound.d.ts.map +1 -1
- package/dist/session/bound.js +15 -2
- package/dist/session/bound.js.map +1 -1
- package/dist/session/client-session.d.ts +1 -1
- package/dist/session/client-session.d.ts.map +1 -1
- package/dist/session/client-session.js +5 -5
- package/dist/session/client-session.js.map +1 -1
- package/dist/session/config.d.ts +8 -4
- package/dist/session/config.d.ts.map +1 -1
- package/dist/{delegation → session/delegation}/cache.d.ts +3 -4
- package/dist/session/delegation/cache.d.ts.map +1 -0
- package/dist/session/delegation/cache.js.map +1 -0
- package/dist/{delegation → session/delegation}/errors.d.ts +1 -1
- package/dist/session/delegation/errors.d.ts.map +1 -0
- package/dist/{delegation → session/delegation}/errors.js +1 -1
- package/dist/session/delegation/errors.js.map +1 -0
- package/dist/session/delegation/policy.d.ts.map +1 -0
- package/dist/{delegation → session/delegation}/policy.js +1 -1
- package/dist/session/delegation/policy.js.map +1 -0
- package/dist/session/delegation-mint.d.ts +13 -0
- package/dist/session/delegation-mint.d.ts.map +1 -0
- package/dist/session/delegation-mint.js +31 -0
- package/dist/session/delegation-mint.js.map +1 -0
- package/dist/session/errors/index.d.ts +2 -2
- package/dist/session/errors/index.d.ts.map +1 -1
- package/dist/session/errors/index.js +2 -2
- package/dist/session/errors/index.js.map +1 -1
- package/dist/session/helpers.js +2 -2
- package/dist/session/helpers.js.map +1 -1
- package/dist/session/index.d.ts +9 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +6 -1
- package/dist/session/index.js.map +1 -1
- package/dist/{redirect → session/redirect}/errors.d.ts +1 -1
- package/dist/session/redirect/errors.d.ts.map +1 -0
- package/dist/{redirect → session/redirect}/errors.js +1 -1
- package/dist/session/redirect/errors.js.map +1 -0
- package/dist/session/redirect/policy.d.ts.map +1 -0
- package/dist/{redirect → session/redirect}/policy.js +1 -1
- package/dist/session/redirect/policy.js.map +1 -0
- package/dist/session/types.d.ts +13 -2
- package/dist/session/types.d.ts.map +1 -1
- package/dist/store/canonicalize.d.ts +44 -0
- package/dist/store/canonicalize.d.ts.map +1 -0
- package/dist/store/canonicalize.js +0 -0
- package/dist/store/canonicalize.js.map +1 -0
- package/dist/store/entities.d.ts +81 -0
- package/dist/store/entities.d.ts.map +1 -0
- package/dist/store/entities.js +202 -0
- package/dist/store/entities.js.map +1 -0
- package/dist/store/index.d.ts +26 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +19 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/invalidate.d.ts +66 -0
- package/dist/store/invalidate.d.ts.map +1 -0
- package/dist/store/invalidate.js +117 -0
- package/dist/store/invalidate.js.map +1 -0
- package/dist/store/memory.d.ts +97 -0
- package/dist/store/memory.d.ts.map +1 -0
- package/dist/store/memory.js +790 -0
- package/dist/store/memory.js.map +1 -0
- package/dist/store/overlay.d.ts +118 -0
- package/dist/store/overlay.d.ts.map +1 -0
- package/dist/store/overlay.js +237 -0
- package/dist/store/overlay.js.map +1 -0
- package/dist/store/schedule.d.ts +31 -0
- package/dist/store/schedule.d.ts.map +1 -0
- package/dist/store/schedule.js +76 -0
- package/dist/store/schedule.js.map +1 -0
- package/dist/store/shapes.d.ts +92 -0
- package/dist/store/shapes.d.ts.map +1 -0
- package/dist/store/shapes.js +369 -0
- package/dist/store/shapes.js.map +1 -0
- package/dist/store/types.d.ts +168 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +7 -0
- package/dist/store/types.js.map +1 -0
- package/dist/transport/fetch.d.ts +1 -1
- package/dist/transport/fetch.js +1 -1
- package/package.json +17 -33
- package/dist/delegation/cache.d.ts.map +0 -1
- package/dist/delegation/cache.js.map +0 -1
- package/dist/delegation/errors.d.ts.map +0 -1
- package/dist/delegation/errors.js.map +0 -1
- package/dist/delegation/index.d.ts +0 -6
- package/dist/delegation/index.d.ts.map +0 -1
- package/dist/delegation/index.js +0 -4
- package/dist/delegation/index.js.map +0 -1
- package/dist/delegation/policy.d.ts.map +0 -1
- package/dist/delegation/policy.js.map +0 -1
- package/dist/persistence/index.d.ts +0 -3
- package/dist/persistence/index.d.ts.map +0 -1
- package/dist/persistence/index.js +0 -2
- package/dist/persistence/index.js.map +0 -1
- package/dist/persistence/persistence.d.ts.map +0 -1
- package/dist/persistence/persistence.js +0 -32
- package/dist/persistence/persistence.js.map +0 -1
- package/dist/redirect/errors.d.ts.map +0 -1
- package/dist/redirect/errors.js.map +0 -1
- package/dist/redirect/index.d.ts +0 -4
- package/dist/redirect/index.d.ts.map +0 -1
- package/dist/redirect/index.js +0 -3
- package/dist/redirect/index.js.map +0 -1
- package/dist/redirect/policy.d.ts.map +0 -1
- package/dist/redirect/policy.js.map +0 -1
- /package/dist/{delegation → session/delegation}/cache.js +0 -0
- /package/dist/{delegation → session/delegation}/policy.d.ts +0 -0
- /package/dist/{redirect → session/redirect}/policy.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/graph/api.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAO3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,8EAA8E;AAC9E,8EAA8E;AAC9E,uEAAuE;AACvE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAA;AAC3D,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAA;AA2DjE,mDAAmD;AACnD,MAAM,UAAU,WAAW,CAAC,IAAe,EAAE,IAAsB;IACjE,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,I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0B,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;IAEpF,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAkB,EAAwB,EAAE,CAClE,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAEjD,MAAM,cAAc,GAAG,KAAK,EAAE,GAAkB,EAAwB,EAAE;QACxE,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;QAC/E,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1C,OAAO,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9D,CAAC,CAAA;IAED,MAAM,KAAK,GAAG,CAAC,CAAC,GAAwD,EAAE,EAAE,CAC1E,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAY,CAAA;IAExF,OAAO;QACL,KAAK;QACL,MAAM;QACN,GAAG,kBAAkB,CAAC,MAAM,CAAC;QAC7B,GAAG,mBAAmB,CAAC,MAAM,CAAC;KAC/B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph sugar over the two batch syscalls (`function.get`/`function.mutate`).
|
|
3
|
+
*
|
|
4
|
+
* One implementation, bound per context: the shell exposes it as
|
|
5
|
+
* `shell.kernel.graph`, the SDK as the handler's `ctx.graph`, and a bound
|
|
6
|
+
* client session flattens it directly onto the view (`session.as(cred).get`,
|
|
7
|
+
* `.query`, `.mutate`, …). Pure over a `GraphCall`
|
|
8
|
+
* capability — no client state, no transport opinion.
|
|
9
|
+
*
|
|
10
|
+
* Layout: `api.ts`, `query/`, `result/`, `mutate/`, `wire.ts`, and `named.ts`.
|
|
11
|
+
*/
|
|
12
|
+
export { createGraph, KERNEL_GET_PATH, KERNEL_MUTATE_PATH } from './api';
|
|
13
|
+
export type { CreateGraphOpts, GraphApi, GraphCall, MutateFn, QueryFn } from './api';
|
|
14
|
+
export type { EdgeBuilderInput, NodeRef, PatchBuilder, PatchInput, Ref, WriteShorthands, } from './mutate';
|
|
15
|
+
export { F, InvalidQueryError, lowerToGet, makeReadShorthands, Q, resolveNeighbors, UnsupportedQueryError, } from './query';
|
|
16
|
+
export type { ChildrenOpts, EdgeInput, ExpandInput, FilterInput, GatherBuilder, HopOpts, LoweringCapability, LoweringPhase, NeighborsRead, OrderInput, QueryBuilder, QuerySource, ReadShorthands, TraverseCtx, TraverseNode, WalkOpts, } from './query';
|
|
17
|
+
export { makeGraphResult, makePaged, nextQuery, NotImplementedError } from './result';
|
|
18
|
+
export type { Content, GraphResult, Page, Paged } from './result';
|
|
19
|
+
export { DESCRIPTION_KEY, NAME_KEY, STATUS_KEY, descriptionOf, nameOf, statusOf } from './named';
|
|
20
|
+
export type { NamedNodeLike } from './named';
|
|
21
|
+
export { edgeKey, prop, rawOf } from './wire';
|
|
22
|
+
export type { EdgeIdentity, GetNextCursors, GetResultWire, GraphEdgeWire, GraphNodeWire, MutationResultWire, } from './wire';
|
|
23
|
+
export type { ChildrenSelectorInput, EdgeKey, EdgeMatch, EdgeRef, EdgeSelectorInput, EdgeWire, Expand, Filter, GetInput, GetOutput, GetOutputWire, GraphData, GraphDataWire, MutationResult, NodeWire, PatchData, PatchDataInput, PathLike, PermName, Properties, PropertyValue, QueryAST, QueryASTInput, QueryDir, QueryOrder, QueryPage, QueryRoot, QueryStep, Wire, } from '@astrale-os/kernel-core';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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AIf,YAAY,EACV,qBAAqB,EACrB,OAAO,EACP,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,aAAa,EACb,SAAS,EACT,aAAa,EACb,cAAc,EACd,QAAQ,EACR,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,EACb,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,IAAI,GACL,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph sugar over the two batch syscalls (`function.get`/`function.mutate`).
|
|
3
|
+
*
|
|
4
|
+
* One implementation, bound per context: the shell exposes it as
|
|
5
|
+
* `shell.kernel.graph`, the SDK as the handler's `ctx.graph`, and a bound
|
|
6
|
+
* client session flattens it directly onto the view (`session.as(cred).get`,
|
|
7
|
+
* `.query`, `.mutate`, …). Pure over a `GraphCall`
|
|
8
|
+
* capability — no client state, no transport opinion.
|
|
9
|
+
*
|
|
10
|
+
* Layout: `api.ts`, `query/`, `result/`, `mutate/`, `wire.ts`, and `named.ts`.
|
|
11
|
+
*/
|
|
12
|
+
export { createGraph, KERNEL_GET_PATH, KERNEL_MUTATE_PATH } from './api';
|
|
13
|
+
// ─── Query tier — builder, filter kit, lowering ──────────────────────────────
|
|
14
|
+
export { F, InvalidQueryError, lowerToGet, makeReadShorthands, Q, resolveNeighbors, UnsupportedQueryError, } from './query';
|
|
15
|
+
// ─── Result tier — live reads, pagers, cursor folds ──────────────────────────
|
|
16
|
+
export { makeGraphResult, makePaged, nextQuery, NotImplementedError } from './result';
|
|
17
|
+
// ─── Universal-prop helpers (blessed; single-sourced from K) ─────────────────
|
|
18
|
+
export { DESCRIPTION_KEY, NAME_KEY, STATUS_KEY, descriptionOf, nameOf, statusOf } from './named';
|
|
19
|
+
export { edgeKey, prop, rawOf } from './wire';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAWxE,gFAAgF;AAChF,OAAO,EACL,CAAC,EACD,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,CAAC,EACD,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,SAAS,CAAA;AAoBhB,gFAAgF;AAChF,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAGrF,gFAAgF;AAChF,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGhG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fluent patch builder handed to `graph.mutate((m) => …)`.
|
|
3
|
+
*
|
|
4
|
+
* String-first: it accumulates a wire `PatchDataInput` (raw path strings);
|
|
5
|
+
* path resolution happens server-side in the `function.mutate` resolver.
|
|
6
|
+
* Lifetime is the builder callback — nothing is sent until it returns, the
|
|
7
|
+
* accumulated patch commits as ONE atomic `function.mutate`, and a throw
|
|
8
|
+
* inside the callback writes nothing. Reads done while building are not part
|
|
9
|
+
* of the atom.
|
|
10
|
+
*/
|
|
11
|
+
import type { PatchDataInput, PathLike, Properties } from '@astrale-os/kernel-core';
|
|
12
|
+
/**
|
|
13
|
+
* Patch accepted by `build()` and by `mutate` — the input side of the server's
|
|
14
|
+
* own `patchDataSchema`: arms optional, path fields accept strings or `Path`s,
|
|
15
|
+
* `props` REQUIRED on create/update arms (an explicit `{}` is the contract).
|
|
16
|
+
*/
|
|
17
|
+
export type PatchInput = PatchDataInput;
|
|
18
|
+
/**
|
|
19
|
+
* Anything addressable inside the builder: a raw wire string, a typed `Path`,
|
|
20
|
+
* or a {@link NodeRef} handed back by an earlier `createNode`. All three expose
|
|
21
|
+
* a raw form, so they normalize identically.
|
|
22
|
+
*/
|
|
23
|
+
export type Ref = PathLike | NodeRef;
|
|
24
|
+
/**
|
|
25
|
+
* A handle to a node the builder is creating. Usable anywhere a {@link Ref} is
|
|
26
|
+
* accepted (as another op's `at`, `source`, or `target`) — the server resolves
|
|
27
|
+
* it by path, so no client-minted id is needed. `.id` is the minted id, back-
|
|
28
|
+
* filled after the mutate commits; reading it before then throws.
|
|
29
|
+
*/
|
|
30
|
+
export interface NodeRef {
|
|
31
|
+
/** The node's `at` path (raw). Makes the ref usable as a {@link Ref}. */
|
|
32
|
+
readonly raw: string;
|
|
33
|
+
/** Friendly alias of {@link raw}. */
|
|
34
|
+
readonly path: string;
|
|
35
|
+
/** Address a descendant that will be created under this node. */
|
|
36
|
+
child(slug: string): NodeRef;
|
|
37
|
+
/**
|
|
38
|
+
* The minted node id. Available only AFTER `await graph.mutate(...)` resolves;
|
|
39
|
+
* reading it inside the builder (or for a path this builder didn't create)
|
|
40
|
+
* throws.
|
|
41
|
+
*/
|
|
42
|
+
readonly id: string;
|
|
43
|
+
toString(): string;
|
|
44
|
+
}
|
|
45
|
+
/** Edge shape accepted by the builder — {@link Ref} endpoints, optional props. */
|
|
46
|
+
export interface EdgeBuilderInput {
|
|
47
|
+
readonly class: Ref;
|
|
48
|
+
readonly source: Ref;
|
|
49
|
+
readonly slug?: string;
|
|
50
|
+
readonly target: Ref;
|
|
51
|
+
readonly props?: Properties;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Fluent, chainable patch builder. Mirrors the six `function.mutate` arms with
|
|
55
|
+
* full semantic verbs, plus `link` / `unlink` sugar over edge create / delete.
|
|
56
|
+
* `createNode` returns a {@link NodeRef}; every other method returns `this`.
|
|
57
|
+
*/
|
|
58
|
+
export interface PatchBuilder {
|
|
59
|
+
createNode(cls: Ref, at: Ref, props?: Properties): NodeRef;
|
|
60
|
+
updateNode(cls: Ref, path: Ref, props: Properties): this;
|
|
61
|
+
deleteNode(cls: Ref, path: Ref): this;
|
|
62
|
+
createEdge(edge: EdgeBuilderInput): this;
|
|
63
|
+
updateEdge(edge: EdgeBuilderInput & {
|
|
64
|
+
props: Properties;
|
|
65
|
+
}): this;
|
|
66
|
+
deleteEdge(edge: Omit<EdgeBuilderInput, 'props'>): this;
|
|
67
|
+
/** Sugar over `createEdge`, sentence-order: `link(source, class, target)`. */
|
|
68
|
+
link(source: Ref, cls: Ref, target: Ref, opts?: {
|
|
69
|
+
slug?: string;
|
|
70
|
+
props?: Properties;
|
|
71
|
+
}): this;
|
|
72
|
+
/** Sugar over `deleteEdge`, sentence-order: `unlink(source, class, target)`. */
|
|
73
|
+
unlink(source: Ref, cls: Ref, target: Ref, opts?: {
|
|
74
|
+
slug?: string;
|
|
75
|
+
}): this;
|
|
76
|
+
}
|
|
77
|
+
/** Normalize any {@link Ref} to its raw string — string, `Path`, or `NodeRef`. */
|
|
78
|
+
export declare function refRaw(x: Ref): string;
|
|
79
|
+
/**
|
|
80
|
+
* The concrete builder. Internal to the graph module: `createGraph`
|
|
81
|
+
* instantiates one per `mutate(callback)`, runs the callback, `build()`s the
|
|
82
|
+
* wire patch, commits it, then `resolve()`s the minted ids into the refs.
|
|
83
|
+
*/
|
|
84
|
+
export declare class PatchBuilderImpl implements PatchBuilder {
|
|
85
|
+
private readonly _nodes;
|
|
86
|
+
private readonly _edges;
|
|
87
|
+
private readonly _res;
|
|
88
|
+
createNode(cls: Ref, at: Ref, props?: Properties): NodeRef;
|
|
89
|
+
updateNode(cls: Ref, path: Ref, props: Properties): this;
|
|
90
|
+
deleteNode(cls: Ref, path: Ref): this;
|
|
91
|
+
createEdge(edge: EdgeBuilderInput): this;
|
|
92
|
+
updateEdge(edge: EdgeBuilderInput & {
|
|
93
|
+
props: Properties;
|
|
94
|
+
}): this;
|
|
95
|
+
deleteEdge(edge: Omit<EdgeBuilderInput, 'props'>): this;
|
|
96
|
+
link(source: Ref, cls: Ref, target: Ref, opts?: {
|
|
97
|
+
slug?: string;
|
|
98
|
+
props?: Properties;
|
|
99
|
+
}): this;
|
|
100
|
+
unlink(source: Ref, cls: Ref, target: Ref, opts?: {
|
|
101
|
+
slug?: string;
|
|
102
|
+
}): this;
|
|
103
|
+
/** The accumulated wire patch — all six arms present (empty when unused). */
|
|
104
|
+
build(): PatchInput;
|
|
105
|
+
/** Back-fill minted node ids so returned `NodeRef.id` resolves. */
|
|
106
|
+
resolve(minted: Record<string, string>): void;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/graph/mutate/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEnF;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,CAAA;AAEvC;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,iEAAiE;IACjE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,IAAI,MAAM,CAAA;CACnB;AAED,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,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AAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAE5C;CACF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fluent patch builder handed to `graph.mutate((m) => …)`.
|
|
3
|
+
*
|
|
4
|
+
* String-first: it accumulates a wire `PatchDataInput` (raw path strings);
|
|
5
|
+
* path resolution happens server-side in the `function.mutate` resolver.
|
|
6
|
+
* Lifetime is the builder callback — nothing is sent until it returns, the
|
|
7
|
+
* accumulated patch commits as ONE atomic `function.mutate`, and a throw
|
|
8
|
+
* inside the callback writes nothing. Reads done while building are not part
|
|
9
|
+
* of the atom.
|
|
10
|
+
*/
|
|
11
|
+
/** Normalize any {@link Ref} to its raw string — string, `Path`, or `NodeRef`. */
|
|
12
|
+
export function refRaw(x) {
|
|
13
|
+
return typeof x === 'string' ? x : x.raw;
|
|
14
|
+
}
|
|
15
|
+
class NodeRefImpl {
|
|
16
|
+
raw;
|
|
17
|
+
res;
|
|
18
|
+
constructor(raw, res) {
|
|
19
|
+
this.raw = raw;
|
|
20
|
+
this.res = res;
|
|
21
|
+
}
|
|
22
|
+
get path() {
|
|
23
|
+
return this.raw;
|
|
24
|
+
}
|
|
25
|
+
child(slug) {
|
|
26
|
+
const base = this.raw === '/' ? '' : this.raw;
|
|
27
|
+
return new NodeRefImpl(`${base}/${slug}`, this.res);
|
|
28
|
+
}
|
|
29
|
+
get id() {
|
|
30
|
+
if (!this.res.minted) {
|
|
31
|
+
throw new Error(`NodeRef.id for "${this.raw}" is available only after the mutate commits — ` +
|
|
32
|
+
'read it after `await graph.mutate(...)`, not inside the builder callback.');
|
|
33
|
+
}
|
|
34
|
+
const id = this.res.minted[this.raw];
|
|
35
|
+
if (id === undefined) {
|
|
36
|
+
throw new Error(`NodeRef.id: no node was created at "${this.raw}" in this mutate — ` +
|
|
37
|
+
'.id is defined only for paths this builder created.');
|
|
38
|
+
}
|
|
39
|
+
return id;
|
|
40
|
+
}
|
|
41
|
+
toString() {
|
|
42
|
+
return this.raw;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The concrete builder. Internal to the graph module: `createGraph`
|
|
47
|
+
* instantiates one per `mutate(callback)`, runs the callback, `build()`s the
|
|
48
|
+
* wire patch, commits it, then `resolve()`s the minted ids into the refs.
|
|
49
|
+
*/
|
|
50
|
+
export class PatchBuilderImpl {
|
|
51
|
+
_nodes = {
|
|
52
|
+
create: [],
|
|
53
|
+
update: [],
|
|
54
|
+
delete: [],
|
|
55
|
+
};
|
|
56
|
+
_edges = {
|
|
57
|
+
create: [],
|
|
58
|
+
update: [],
|
|
59
|
+
delete: [],
|
|
60
|
+
};
|
|
61
|
+
_res = {};
|
|
62
|
+
createNode(cls, at, props) {
|
|
63
|
+
const atRaw = refRaw(at);
|
|
64
|
+
this._nodes.create.push({ class: refRaw(cls), at: atRaw, props: props ?? {} });
|
|
65
|
+
return new NodeRefImpl(atRaw, this._res);
|
|
66
|
+
}
|
|
67
|
+
updateNode(cls, path, props) {
|
|
68
|
+
this._nodes.update.push({ class: refRaw(cls), path: refRaw(path), props });
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
deleteNode(cls, path) {
|
|
72
|
+
this._nodes.delete.push({ class: refRaw(cls), path: refRaw(path) });
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
createEdge(edge) {
|
|
76
|
+
this._edges.create.push(rawEdge(edge, edge.props ?? {}));
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
updateEdge(edge) {
|
|
80
|
+
this._edges.update.push(rawEdge(edge, edge.props));
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
deleteEdge(edge) {
|
|
84
|
+
this._edges.delete.push(rawIdentity(edge));
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
link(source, cls, target, opts) {
|
|
88
|
+
return this.createEdge({
|
|
89
|
+
class: cls,
|
|
90
|
+
source,
|
|
91
|
+
target,
|
|
92
|
+
...(opts?.slug !== undefined && { slug: opts.slug }),
|
|
93
|
+
...(opts?.props !== undefined && { props: opts.props }),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
unlink(source, cls, target, opts) {
|
|
97
|
+
return this.deleteEdge({
|
|
98
|
+
class: cls,
|
|
99
|
+
source,
|
|
100
|
+
target,
|
|
101
|
+
...(opts?.slug !== undefined && { slug: opts.slug }),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/** The accumulated wire patch — all six arms present (empty when unused). */
|
|
105
|
+
build() {
|
|
106
|
+
return { nodes: this._nodes, edges: this._edges };
|
|
107
|
+
}
|
|
108
|
+
/** Back-fill minted node ids so returned `NodeRef.id` resolves. */
|
|
109
|
+
resolve(minted) {
|
|
110
|
+
this._res.minted = minted;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// ─── helpers ─────────────────────────────────────────────────────────────────
|
|
114
|
+
/** Edge identity → raw wire tuple, `slug` omitted when absent. */
|
|
115
|
+
function rawIdentity(edge) {
|
|
116
|
+
return {
|
|
117
|
+
class: refRaw(edge.class),
|
|
118
|
+
source: refRaw(edge.source),
|
|
119
|
+
...(edge.slug !== undefined && { slug: edge.slug }),
|
|
120
|
+
target: refRaw(edge.target),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** Edge identity + props → raw wire edge record. */
|
|
124
|
+
function rawEdge(edge, props) {
|
|
125
|
+
return { ...rawIdentity(edge), props };
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../src/graph/mutate/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAiFH,kFAAkF;AAClF,MAAM,UAAU,MAAM,CAAC,CAAM;IAC3B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,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,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACnD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;KAC5B,CAAA;AACH,CAAC;AAED,oDAAoD;AACpD,SAAS,OAAO,CAAC,IAAsB,EAAE,KAAiB;IACxD,OAAO,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAA;AACxC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { PatchBuilderImpl, refRaw } from './builder';
|
|
2
|
+
export type { EdgeBuilderInput, NodeRef, PatchBuilder, PatchInput, Ref } from './builder';
|
|
3
|
+
export { makeWriteShorthands, mintedId } from './shorthands';
|
|
4
|
+
export type { WriteShorthands } from './shorthands';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graph/mutate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACpD,YAAY,EAAE,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graph/mutate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one-op write shorthands — each a loss-less one-arm `function.mutate`.
|
|
3
|
+
* Loss-less because a write returns an *outcome*, not a session: a minted id
|
|
4
|
+
* (create) or nothing (update/delete), so no envelope is stripped.
|
|
5
|
+
*
|
|
6
|
+
* Factored over a bare `commit` (the value-form mutate) rather than the whole
|
|
7
|
+
* `GraphApi`, so this module never imports the surface it helps build.
|
|
8
|
+
*/
|
|
9
|
+
import type { EdgeIdentity, PathLike, Properties } from '@astrale-os/kernel-core';
|
|
10
|
+
import type { MutationResultWire } from '../wire';
|
|
11
|
+
import type { PatchInput } from './builder';
|
|
12
|
+
/** The write half of {@link GraphApi} — kept as its own contract so `GraphApi` can extend it. */
|
|
13
|
+
export interface WriteShorthands {
|
|
14
|
+
/** Create one node; resolves to the minted node id. */
|
|
15
|
+
createNode(cls: PathLike, at: PathLike, props?: Properties): Promise<string>;
|
|
16
|
+
/** Update one node's props. */
|
|
17
|
+
updateNode(cls: PathLike, path: PathLike, props: Properties): Promise<void>;
|
|
18
|
+
/** Delete one node (leaf-guarded — batch deletes drain subtrees atomically). */
|
|
19
|
+
deleteNode(cls: PathLike, path: PathLike): Promise<void>;
|
|
20
|
+
/** Create one edge; resolves to the minted edge id. */
|
|
21
|
+
createEdge(edge: EdgeIdentity & {
|
|
22
|
+
props?: Properties;
|
|
23
|
+
}): Promise<string>;
|
|
24
|
+
/** Update one edge's props. */
|
|
25
|
+
updateEdge(edge: EdgeIdentity & {
|
|
26
|
+
props: Properties;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/** Delete one edge by identity tuple. */
|
|
29
|
+
deleteEdge(edge: EdgeIdentity): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/** A value-form `function.mutate` — the one capability the shorthands need. */
|
|
32
|
+
type Commit = (patch: PatchInput) => Promise<MutationResultWire>;
|
|
33
|
+
/** Build the six write shorthands over a value-form mutate. */
|
|
34
|
+
export declare function makeWriteShorthands(commit: Commit): WriteShorthands;
|
|
35
|
+
/**
|
|
36
|
+
* Look up a minted id by its request key; when hydration normalized the key,
|
|
37
|
+
* a single-entry map is unambiguous — use it. Throws on a genuine miss rather
|
|
38
|
+
* than return the request key (a path/edge-key masquerading as a minted id).
|
|
39
|
+
*/
|
|
40
|
+
export declare function mintedId(map: Record<string, string>, key: string, kind: 'node' | 'edge'): string;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=shorthands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shorthands.d.ts","sourceRoot":"","sources":["../../../src/graph/mutate/shorthands.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAI3C,iGAAiG;AACjG,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5E,+BAA+B;IAC/B,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3E,gFAAgF;IAChF,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,uDAAuD;IACvD,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG;QAAE,KAAK,CAAC,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACxE,+BAA+B;IAC/B,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG;QAAE,KAAK,EAAE,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrE,yCAAyC;IACzC,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9C;AAED,+EAA+E;AAC/E,KAAK,MAAM,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAEhE,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAkCnE;AAmBD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAMhG"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one-op write shorthands — each a loss-less one-arm `function.mutate`.
|
|
3
|
+
* Loss-less because a write returns an *outcome*, not a session: a minted id
|
|
4
|
+
* (create) or nothing (update/delete), so no envelope is stripped.
|
|
5
|
+
*
|
|
6
|
+
* Factored over a bare `commit` (the value-form mutate) rather than the whole
|
|
7
|
+
* `GraphApi`, so this module never imports the surface it helps build.
|
|
8
|
+
*/
|
|
9
|
+
import { edgeKey, rawOf } from '../wire';
|
|
10
|
+
/** Build the six write shorthands over a value-form mutate. */
|
|
11
|
+
export function makeWriteShorthands(commit) {
|
|
12
|
+
return {
|
|
13
|
+
async createNode(cls, at, props) {
|
|
14
|
+
const atRaw = rawOf(at);
|
|
15
|
+
const result = await commit({
|
|
16
|
+
nodes: { create: [{ class: rawOf(cls), at: atRaw, props: props ?? {} }] },
|
|
17
|
+
});
|
|
18
|
+
return mintedId(result.createdNodes, atRaw, 'node');
|
|
19
|
+
},
|
|
20
|
+
async updateNode(cls, path, props) {
|
|
21
|
+
await commit({ nodes: { update: [{ class: rawOf(cls), path: rawOf(path), props }] } });
|
|
22
|
+
},
|
|
23
|
+
async deleteNode(cls, path) {
|
|
24
|
+
await commit({ nodes: { delete: [{ class: rawOf(cls), path: rawOf(path) }] } });
|
|
25
|
+
},
|
|
26
|
+
async createEdge(edge) {
|
|
27
|
+
const { props, ...rest } = edge;
|
|
28
|
+
const identity = rawIdentity(rest);
|
|
29
|
+
const result = await commit({ edges: { create: [{ ...identity, props: props ?? {} }] } });
|
|
30
|
+
return mintedId(result.createdEdges, edgeKey(identity), 'edge');
|
|
31
|
+
},
|
|
32
|
+
async updateEdge(edge) {
|
|
33
|
+
const { props, ...rest } = edge;
|
|
34
|
+
await commit({ edges: { update: [{ ...rawIdentity(rest), props }] } });
|
|
35
|
+
},
|
|
36
|
+
async deleteEdge(edge) {
|
|
37
|
+
await commit({ edges: { delete: [rawIdentity(edge)] } });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// ─── Internals ───────────────────────────────────────────────────────────────
|
|
42
|
+
/** Normalize an edge identity's `PathLike` fields to raw wire strings. */
|
|
43
|
+
function rawIdentity(edge) {
|
|
44
|
+
return {
|
|
45
|
+
class: rawOf(edge.class),
|
|
46
|
+
source: rawOf(edge.source),
|
|
47
|
+
...(edge.slug !== undefined ? { slug: edge.slug } : {}),
|
|
48
|
+
target: rawOf(edge.target),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Look up a minted id by its request key; when hydration normalized the key,
|
|
53
|
+
* a single-entry map is unambiguous — use it. Throws on a genuine miss rather
|
|
54
|
+
* than return the request key (a path/edge-key masquerading as a minted id).
|
|
55
|
+
*/
|
|
56
|
+
export function mintedId(map, key, kind) {
|
|
57
|
+
const exact = map[key];
|
|
58
|
+
if (exact)
|
|
59
|
+
return exact;
|
|
60
|
+
const values = Object.values(map);
|
|
61
|
+
if (values.length === 1)
|
|
62
|
+
return values[0];
|
|
63
|
+
throw new Error(`function.mutate minted no ${kind} id for "${key}"`);
|
|
64
|
+
}
|
|
65
|
+
//# source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AK,CAAC,IAAI,CAAC,MAAM,CAAC;KAC3B,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAA2B,EAAE,GAAW,EAAE,IAAqB;IACtF,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;IACtB,IAAI,KAAK;QAAE,OAAO,KAAK,CAAA;IACvB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACjC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAE,CAAA;IAC1C,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,YAAY,GAAG,GAAG,CAAC,CAAA;AACtE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blessed universal-prop helpers (FRONTEND/SHELL_REACT §G8).
|
|
3
|
+
*
|
|
4
|
+
* Every node inherits the kernel `Named`/`Descriptable`/`Statused` mixins, so
|
|
5
|
+
* their qualified prop keys and readers belong to one place — single-sourced
|
|
6
|
+
* from the compiled kernel schema `K` accessor, never a hand-written literal
|
|
7
|
+
* that could drift. Replaces the per-repo copies (the GUI's hardcoded prefix,
|
|
8
|
+
* the workspace domain's `keys.ts`).
|
|
9
|
+
*/
|
|
10
|
+
import type { Properties } from '@astrale-os/kernel-core';
|
|
11
|
+
/** Qualified key of the `Named.name` prop — the universal display name. */
|
|
12
|
+
export declare const NAME_KEY: `${import("@astrale-os/kernel-core/domain").DomainOrigin}:interface.Named.property.name`;
|
|
13
|
+
/** Qualified key of the `Descriptable.description` prop. */
|
|
14
|
+
export declare const DESCRIPTION_KEY: `${import("@astrale-os/kernel-core/domain").DomainOrigin}:interface.Descriptable.property.description`;
|
|
15
|
+
/** Qualified key of the `Statused.status` prop. */
|
|
16
|
+
export declare const STATUS_KEY: `${import("@astrale-os/kernel-core/domain").DomainOrigin}:interface.Statused.property.status`;
|
|
17
|
+
/**
|
|
18
|
+
* The minimal node projection these helpers read — satisfied by both a typed
|
|
19
|
+
* kernel `Node` (`path` an `AbsolutePath`) and a wire `NodeWire` (`path` a raw
|
|
20
|
+
* string), so the same reader serves the surface and the store internals.
|
|
21
|
+
*/
|
|
22
|
+
export interface NamedNodeLike {
|
|
23
|
+
readonly props: Properties;
|
|
24
|
+
readonly path: {
|
|
25
|
+
basename?(): string | null;
|
|
26
|
+
raw?: string;
|
|
27
|
+
} | string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A node's display name: its `Named.name` when set, else the last path segment,
|
|
31
|
+
* else the raw path. Always a non-empty string for a real node.
|
|
32
|
+
*/
|
|
33
|
+
export declare function nameOf(node: NamedNodeLike): string;
|
|
34
|
+
/** A node's `Descriptable.description`, or `undefined` when unset. */
|
|
35
|
+
export declare function descriptionOf(node: Pick<NamedNodeLike, 'props'>): string | undefined;
|
|
36
|
+
/** A node's `Statused.status`, or `undefined` when unset. */
|
|
37
|
+
export declare function statusOf(node: Pick<NamedNodeLike, 'props'>): string | undefined;
|
|
38
|
+
//# sourceMappingURL=named.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named.d.ts","sourceRoot":"","sources":["../../src/graph/named.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIzD,2EAA2E;AAC3E,eAAO,MAAM,QAAQ,0FAAmB,CAAA;AAExC,4DAA4D;AAC5D,eAAO,MAAM,eAAe,wGAAiC,CAAA;AAE7D,mDAAmD;AACnD,eAAO,MAAM,UAAU,+FAAwB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAA;CACrE;AAmBD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAElD;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED,6DAA6D;AAC7D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAE/E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blessed universal-prop helpers (FRONTEND/SHELL_REACT §G8).
|
|
3
|
+
*
|
|
4
|
+
* Every node inherits the kernel `Named`/`Descriptable`/`Statused` mixins, so
|
|
5
|
+
* their qualified prop keys and readers belong to one place — single-sourced
|
|
6
|
+
* from the compiled kernel schema `K` accessor, never a hand-written literal
|
|
7
|
+
* that could drift. Replaces the per-repo copies (the GUI's hardcoded prefix,
|
|
8
|
+
* the workspace domain's `keys.ts`).
|
|
9
|
+
*/
|
|
10
|
+
import { K } from '@astrale-os/kernel-core';
|
|
11
|
+
/** Qualified key of the `Named.name` prop — the universal display name. */
|
|
12
|
+
export const NAME_KEY = K.Named.name.key;
|
|
13
|
+
/** Qualified key of the `Descriptable.description` prop. */
|
|
14
|
+
export const DESCRIPTION_KEY = K.Descriptable.description.key;
|
|
15
|
+
/** Qualified key of the `Statused.status` prop. */
|
|
16
|
+
export const STATUS_KEY = K.Statused.status.key;
|
|
17
|
+
/** Read a string prop by qualified key, or `undefined` when absent/non-string. */
|
|
18
|
+
function stringProp(props, key) {
|
|
19
|
+
const v = props[key];
|
|
20
|
+
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The last path segment, from either a typed `AbsolutePath` or a raw string. */
|
|
23
|
+
function basenameOf(path) {
|
|
24
|
+
if (typeof path === 'string') {
|
|
25
|
+
const trimmed = path.replace(/\/+$/, '');
|
|
26
|
+
const seg = trimmed.slice(trimmed.lastIndexOf('/') + 1);
|
|
27
|
+
return seg.length > 0 ? seg : path;
|
|
28
|
+
}
|
|
29
|
+
const raw = typeof path.raw === 'string' ? path.raw : '';
|
|
30
|
+
return path.basename?.() ?? (raw.length > 0 ? raw : '');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A node's display name: its `Named.name` when set, else the last path segment,
|
|
34
|
+
* else the raw path. Always a non-empty string for a real node.
|
|
35
|
+
*/
|
|
36
|
+
export function nameOf(node) {
|
|
37
|
+
return stringProp(node.props, NAME_KEY) ?? basenameOf(node.path);
|
|
38
|
+
}
|
|
39
|
+
/** A node's `Descriptable.description`, or `undefined` when unset. */
|
|
40
|
+
export function descriptionOf(node) {
|
|
41
|
+
return stringProp(node.props, DESCRIPTION_KEY);
|
|
42
|
+
}
|
|
43
|
+
/** A node's `Statused.status`, or `undefined` when unset. */
|
|
44
|
+
export function statusOf(node) {
|
|
45
|
+
return stringProp(node.props, STATUS_KEY);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=named.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named.js","sourceRoot":"","sources":["../../src/graph/named.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,yBAAyB,CAAA;AAE3C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAA;AAExC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAA;AAE7D,mDAAmD;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAA;AAY/C,kFAAkF;AAClF,SAAS,UAAU,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