@orthograph/language-effect 0.0.0-stage → 0.1.0-next.2
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/LICENSE +202 -0
- package/README.md +2 -2
- package/dist/device.d.ts +5 -0
- package/dist/device.js +6 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +25 -0
- package/dist/modules/access/internal/path.d.ts +3 -0
- package/dist/modules/access/internal/path.js +11 -0
- package/dist/modules/access/service.d.ts +5 -0
- package/dist/modules/access/service.js +111 -0
- package/dist/modules/access/types.d.ts +38 -0
- package/dist/modules/access/types.js +3 -0
- package/dist/modules/auth/service.d.ts +4 -0
- package/dist/modules/auth/service.js +19 -0
- package/dist/modules/auth/types.d.ts +38 -0
- package/dist/modules/auth/types.js +8 -0
- package/dist/modules/calls/internal/run.d.ts +2 -0
- package/dist/modules/calls/internal/run.js +28 -0
- package/dist/modules/calls/service.d.ts +2 -0
- package/dist/modules/calls/service.js +2 -0
- package/dist/modules/calls/types.d.ts +32 -0
- package/dist/modules/calls/types.js +1 -0
- package/dist/modules/handler/internal/attributes.d.ts +17 -0
- package/dist/modules/handler/internal/attributes.js +46 -0
- package/dist/modules/handler/internal/call-id.d.ts +2 -0
- package/dist/modules/handler/internal/call-id.js +5 -0
- package/dist/modules/handler/internal/call-metrics.d.ts +17 -0
- package/dist/modules/handler/internal/call-metrics.js +35 -0
- package/dist/modules/handler/internal/decided.d.ts +14 -0
- package/dist/modules/handler/internal/decided.js +106 -0
- package/dist/modules/handler/internal/defect.d.ts +4 -0
- package/dist/modules/handler/internal/defect.js +19 -0
- package/dist/modules/handler/internal/derived.d.ts +21 -0
- package/dist/modules/handler/internal/derived.js +96 -0
- package/dist/modules/handler/internal/device.d.ts +3 -0
- package/dist/modules/handler/internal/device.js +46 -0
- package/dist/modules/handler/internal/digest.d.ts +3 -0
- package/dist/modules/handler/internal/digest.js +52 -0
- package/dist/modules/handler/internal/environment.d.ts +3 -0
- package/dist/modules/handler/internal/environment.js +3 -0
- package/dist/modules/handler/internal/invariants.d.ts +12 -0
- package/dist/modules/handler/internal/invariants.js +28 -0
- package/dist/modules/handler/internal/move.d.ts +32 -0
- package/dist/modules/handler/internal/move.js +84 -0
- package/dist/modules/handler/internal/prehandle.d.ts +23 -0
- package/dist/modules/handler/internal/prehandle.js +34 -0
- package/dist/modules/handler/internal/read.d.ts +3 -0
- package/dist/modules/handler/internal/read.js +79 -0
- package/dist/modules/handler/internal/signal.d.ts +3 -0
- package/dist/modules/handler/internal/signal.js +10 -0
- package/dist/modules/handler/internal/span.d.ts +8 -0
- package/dist/modules/handler/internal/span.js +14 -0
- package/dist/modules/handler/service.d.ts +7 -0
- package/dist/modules/handler/service.js +163 -0
- package/dist/modules/handler/types.d.ts +217 -0
- package/dist/modules/handler/types.js +24 -0
- package/dist/modules/ids/service.d.ts +2 -0
- package/dist/modules/ids/service.js +11 -0
- package/dist/modules/ids/types.d.ts +8 -0
- package/dist/modules/ids/types.js +1 -0
- package/dist/modules/journal/service.d.ts +6 -0
- package/dist/modules/journal/service.js +4 -0
- package/dist/modules/journal/types.d.ts +22 -0
- package/dist/modules/journal/types.js +5 -0
- package/dist/modules/mcp/internal/input.d.ts +15 -0
- package/dist/modules/mcp/internal/input.js +35 -0
- package/dist/modules/mcp/internal/output.d.ts +16 -0
- package/dist/modules/mcp/internal/output.js +50 -0
- package/dist/modules/mcp/internal/tool.d.ts +4 -0
- package/dist/modules/mcp/internal/tool.js +56 -0
- package/dist/modules/mcp/service.d.ts +2 -0
- package/dist/modules/mcp/service.js +38 -0
- package/dist/modules/mcp/types.d.ts +101 -0
- package/dist/modules/mcp/types.js +1 -0
- package/dist/modules/mount/internal/none.d.ts +2 -0
- package/dist/modules/mount/internal/none.js +1 -0
- package/dist/modules/mount/service.d.ts +2 -0
- package/dist/modules/mount/service.js +12 -0
- package/dist/modules/mount/types.d.ts +11 -0
- package/dist/modules/mount/types.js +4 -0
- package/dist/modules/principals/service.d.ts +4 -0
- package/dist/modules/principals/service.js +4 -0
- package/dist/modules/principals/types.d.ts +15 -0
- package/dist/modules/principals/types.js +4 -0
- package/dist/modules/records/internal/holder.d.ts +16 -0
- package/dist/modules/records/internal/holder.js +55 -0
- package/dist/modules/records/internal/list.d.ts +12 -0
- package/dist/modules/records/internal/list.js +65 -0
- package/dist/modules/records/internal/order.d.ts +18 -0
- package/dist/modules/records/internal/order.js +41 -0
- package/dist/modules/records/internal/unique.d.ts +31 -0
- package/dist/modules/records/internal/unique.js +49 -0
- package/dist/modules/records/internal/unit.d.ts +3 -0
- package/dist/modules/records/internal/unit.js +135 -0
- package/dist/modules/records/service.d.ts +22 -0
- package/dist/modules/records/service.js +102 -0
- package/dist/modules/records/types.d.ts +170 -0
- package/dist/modules/records/types.js +9 -0
- package/dist/modules/timers/internal/world.d.ts +4 -0
- package/dist/modules/timers/internal/world.js +64 -0
- package/dist/modules/timers/service.d.ts +18 -0
- package/dist/modules/timers/service.js +125 -0
- package/dist/modules/timers/types.d.ts +102 -0
- package/dist/modules/timers/types.js +40 -0
- package/dist/modules/versions/internal/handlers.d.ts +6 -0
- package/dist/modules/versions/internal/handlers.js +36 -0
- package/dist/modules/versions/internal/keep.d.ts +21 -0
- package/dist/modules/versions/internal/keep.js +36 -0
- package/dist/modules/versions/service.d.ts +2 -0
- package/dist/modules/versions/service.js +14 -0
- package/dist/modules/versions/types.d.ts +27 -0
- package/dist/modules/versions/types.js +1 -0
- package/dist/modules/visibility/internal/rule.d.ts +7 -0
- package/dist/modules/visibility/internal/rule.js +23 -0
- package/dist/modules/visibility/internal/schema.d.ts +5 -0
- package/dist/modules/visibility/internal/schema.js +12 -0
- package/dist/modules/visibility/service.d.ts +15 -0
- package/dist/modules/visibility/service.js +27 -0
- package/dist/modules/visibility/types.d.ts +60 -0
- package/dist/modules/visibility/types.js +1 -0
- package/dist/modules/wire/internal/call-telemetry.d.ts +15 -0
- package/dist/modules/wire/internal/call-telemetry.js +31 -0
- package/dist/modules/wire/internal/refused-payload.d.ts +7 -0
- package/dist/modules/wire/internal/refused-payload.js +25 -0
- package/dist/modules/wire/internal/shown.d.ts +9 -0
- package/dist/modules/wire/internal/shown.js +32 -0
- package/dist/modules/wire/service.d.ts +3 -0
- package/dist/modules/wire/service.js +14 -0
- package/dist/modules/wire/types.d.ts +30 -0
- package/dist/modules/wire/types.js +1 -0
- package/dist/modules/work/internal/fake-world.d.ts +17 -0
- package/dist/modules/work/internal/fake-world.js +43 -0
- package/dist/modules/work/internal/fibers.d.ts +2 -0
- package/dist/modules/work/internal/fibers.js +5 -0
- package/dist/modules/work/service.d.ts +6 -0
- package/dist/modules/work/service.js +249 -0
- package/dist/modules/work/types.d.ts +103 -0
- package/dist/modules/work/types.js +19 -0
- package/dist/visibility.d.ts +1 -0
- package/dist/visibility.js +3 -0
- package/package.json +39 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @orthograph/language-effect
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Effect target and the runtime generated code runs on. Built; what each part does and how far it goes is in the package map in `docs/canon/status.md`.
|
package/dist/device.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Device } from "#modules/handler/service.js";
|
|
2
|
+
export { Mount } from "#modules/mount/service.js";
|
|
3
|
+
export { TimersLive } from "#modules/timers/service.js";
|
|
4
|
+
export { DeviceWorld } from "#modules/handler/types.js";
|
|
5
|
+
export type { DeviceWhere, DeviceWorldOf } from "#modules/handler/types.js";
|
package/dist/device.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// `@orthograph/language-effect/device`: all a generated SDK needs to run an operation on the caller's device, without the
|
|
2
|
+
// rest of the runtime (no MCP server, no store) in a browser's bundle.
|
|
3
|
+
export { Device } from "#modules/handler/service.js";
|
|
4
|
+
export { Mount } from "#modules/mount/service.js";
|
|
5
|
+
export { TimersLive } from "#modules/timers/service.js";
|
|
6
|
+
export { DeviceWorld } from "#modules/handler/types.js";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { Access } from "#modules/access/service.js";
|
|
2
|
+
export { authMemory } from "#modules/auth/service.js";
|
|
3
|
+
export { Auth, AuthRefused } from "#modules/auth/types.js";
|
|
4
|
+
export { NotAllowed } from "#modules/access/types.js";
|
|
5
|
+
export { Mcp } from "#modules/mcp/service.js";
|
|
6
|
+
export type { McpEntry, McpRefusals, McpResult, McpServed, McpTool } from "#modules/mcp/types.js";
|
|
7
|
+
export { Calls } from "#modules/calls/service.js";
|
|
8
|
+
export type { CallRunner, CallWiring, Callable } from "#modules/calls/types.js";
|
|
9
|
+
export { Device, Environment, Handlers, Reads } from "#modules/handler/service.js";
|
|
10
|
+
export { BlankReached, DeviceWorld, IdempotencyConflict, InvalidPayload, NotFound, NotFrom, ReadNotServed } from "#modules/handler/types.js";
|
|
11
|
+
export type { Device as DeviceOf, DeviceWhere, DeviceWorldOf, Handler, HandlerContext, ReadAnswer, ReadPayload, Served, ServedRead, StepRunners } from "#modules/handler/types.js";
|
|
12
|
+
export { journalOf } from "#modules/journal/service.js";
|
|
13
|
+
export { Journal, type Entry } from "#modules/journal/types.js";
|
|
14
|
+
export { Ids } from "#modules/ids/service.js";
|
|
15
|
+
export { PrincipalsAnonymous } from "#modules/principals/service.js";
|
|
16
|
+
export { Principals, type PrincipalDoor } from "#modules/principals/types.js";
|
|
17
|
+
export { invariantsIn, storeMemory, thingIn, Unit } from "#modules/records/service.js";
|
|
18
|
+
export { Records, Store, type Commit, type Committed, type Instance, type ListQuery, type ListRead, type Listed, type NamedRule, type Page, type RowRead, type Stored, type Violation, type Write } from "#modules/records/types.js";
|
|
19
|
+
export { TimersLive, TimersMemory, TimersWorld, wakesByKind } from "#modules/timers/service.js";
|
|
20
|
+
export { DurableTimers, TimerWakes, Timers, WorldTable, type DurableTimer, type Json, type Timer, type Wake } from "#modules/timers/types.js";
|
|
21
|
+
export { Audience, Visibility } from "#modules/visibility/service.js";
|
|
22
|
+
export type { ItemFields } from "#modules/visibility/types.js";
|
|
23
|
+
export { CallTelemetry, Wire } from "#modules/wire/service.js";
|
|
24
|
+
export type { ShownOperation, WireClasses } from "#modules/wire/types.js";
|
|
25
|
+
export { BusyLive, BusyReporting } from "#modules/work/service.js";
|
|
26
|
+
export { Busy, BusyBoxRef, WorldCount, genOf, makeBox, type BusyBox, type BusyShape, type Lease } from "#modules/work/types.js";
|
|
27
|
+
export { Mount } from "#modules/mount/service.js";
|
|
28
|
+
export { Versions } from "#modules/versions/service.js";
|
|
29
|
+
export type { VersionContext, VersionHandler, VersionVerb } from "#modules/versions/types.js";
|
|
30
|
+
export { Mounted, type MountApi } from "#modules/mount/types.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @orthograph/language-effect: the runtime generated code runs on. Effect only, no host.
|
|
2
|
+
export { Access } from "#modules/access/service.js";
|
|
3
|
+
export { authMemory } from "#modules/auth/service.js";
|
|
4
|
+
export { Auth, AuthRefused } from "#modules/auth/types.js";
|
|
5
|
+
export { NotAllowed } from "#modules/access/types.js";
|
|
6
|
+
export { Mcp } from "#modules/mcp/service.js";
|
|
7
|
+
export { Calls } from "#modules/calls/service.js";
|
|
8
|
+
export { Device, Environment, Handlers, Reads } from "#modules/handler/service.js";
|
|
9
|
+
export { BlankReached, DeviceWorld, IdempotencyConflict, InvalidPayload, NotFound, NotFrom, ReadNotServed } from "#modules/handler/types.js";
|
|
10
|
+
export { journalOf } from "#modules/journal/service.js";
|
|
11
|
+
export { Journal } from "#modules/journal/types.js";
|
|
12
|
+
export { Ids } from "#modules/ids/service.js";
|
|
13
|
+
export { PrincipalsAnonymous } from "#modules/principals/service.js";
|
|
14
|
+
export { Principals } from "#modules/principals/types.js";
|
|
15
|
+
export { invariantsIn, storeMemory, thingIn, Unit } from "#modules/records/service.js";
|
|
16
|
+
export { Records, Store } from "#modules/records/types.js";
|
|
17
|
+
export { TimersLive, TimersMemory, TimersWorld, wakesByKind } from "#modules/timers/service.js";
|
|
18
|
+
export { DurableTimers, TimerWakes, Timers, WorldTable } from "#modules/timers/types.js";
|
|
19
|
+
export { Audience, Visibility } from "#modules/visibility/service.js";
|
|
20
|
+
export { CallTelemetry, Wire } from "#modules/wire/service.js";
|
|
21
|
+
export { BusyLive, BusyReporting } from "#modules/work/service.js";
|
|
22
|
+
export { Busy, BusyBoxRef, WorldCount, genOf, makeBox } from "#modules/work/types.js";
|
|
23
|
+
export { Mount } from "#modules/mount/service.js";
|
|
24
|
+
export { Versions } from "#modules/versions/service.js";
|
|
25
|
+
export { Mounted } from "#modules/mount/types.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const isField = (x) => typeof x === "object" && x !== null && x.kind === "field";
|
|
2
|
+
/** The thing whose id a field holds: follow the field back to the `id` it was taken from. */
|
|
3
|
+
export const referencedThing = (field) => {
|
|
4
|
+
let f = isField(field) ? field : undefined;
|
|
5
|
+
while (f) {
|
|
6
|
+
if (f.key === "id")
|
|
7
|
+
return f.of;
|
|
8
|
+
f = f.from;
|
|
9
|
+
}
|
|
10
|
+
return undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type AccessApi } from "./types.ts";
|
|
2
|
+
import { referencedThing } from "./internal/path.ts";
|
|
3
|
+
/** The thing whose id a field holds, followed back to the `id` it was taken from: what a payload field names. */
|
|
4
|
+
export { referencedThing };
|
|
5
|
+
export declare const Access: AccessApi;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { acting } from "orthograph";
|
|
3
|
+
import { Records } from "#modules/records/types.js";
|
|
4
|
+
import { NotAllowed } from "./types.js";
|
|
5
|
+
import { referencedThing } from "./internal/path.js";
|
|
6
|
+
/** The thing whose id a field holds, followed back to the `id` it was taken from: what a payload field names. */
|
|
7
|
+
export { referencedThing };
|
|
8
|
+
const NO_MOUNTS = new Map();
|
|
9
|
+
/** Where a walk starts: a payload field holding some thing's id. */
|
|
10
|
+
const start = (payloadFields, payload, key) => ({
|
|
11
|
+
thing: referencedThing(payloadFields[key]),
|
|
12
|
+
id: payload[key],
|
|
13
|
+
});
|
|
14
|
+
/** The payload field that names an instance of `thing`: the subject, for a bare role or a path from the subject. */
|
|
15
|
+
const subjectKey = (payloadFields, thing) => Object.keys(payloadFields).find((k) => referencedThing(payloadFields[k]) === thing);
|
|
16
|
+
/** Walk `keys` from an instance, field by field, to the instance the role is decided on. */
|
|
17
|
+
const walk = (from, keys) => Effect.gen(function* () {
|
|
18
|
+
const records = yield* Records;
|
|
19
|
+
let { thing, id } = from;
|
|
20
|
+
for (const key of keys) {
|
|
21
|
+
if (!thing || typeof id !== "string")
|
|
22
|
+
return undefined;
|
|
23
|
+
const instance = yield* records.find(thing, id);
|
|
24
|
+
if (!instance)
|
|
25
|
+
return undefined;
|
|
26
|
+
id = instance[key];
|
|
27
|
+
thing = referencedThing(thing.fields[key]);
|
|
28
|
+
}
|
|
29
|
+
return thing && typeof id === "string" ? { thing, id } : undefined;
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* A role decided on an instance: `grantee` on the operation's own subject, `owner.of("organization")` on the thing a
|
|
33
|
+
* payload field points at, or a path that starts from the subject when the payload has no such field (a read). On a read
|
|
34
|
+
* by id, a path may name the subject's own thing first: `owner.of("membership.organization")` on `membership.get`.
|
|
35
|
+
*/
|
|
36
|
+
const roleOn = (role, path, payloadFields, payload, person, own) => Effect.gen(function* () {
|
|
37
|
+
const records = yield* Records;
|
|
38
|
+
const keys = path === undefined ? [] : path.split(".");
|
|
39
|
+
const first = keys[0];
|
|
40
|
+
const fromPayload = first !== undefined && first in payloadFields;
|
|
41
|
+
const subject = own && subjectKey(payloadFields, own);
|
|
42
|
+
const origin = fromPayload
|
|
43
|
+
? start(payloadFields, payload, first)
|
|
44
|
+
: subject !== undefined
|
|
45
|
+
? start(payloadFields, payload, subject)
|
|
46
|
+
: path === undefined
|
|
47
|
+
? start(payloadFields, payload, subjectKey(payloadFields, role.thing) ?? "")
|
|
48
|
+
: undefined;
|
|
49
|
+
if (!origin)
|
|
50
|
+
return false;
|
|
51
|
+
// On a payload `id` (a read by id, or a list filtered by `id`, which fails closed), a first key that is none of
|
|
52
|
+
// the subject's fields names the subject's own thing (`membership.organization`), the way the same words name the
|
|
53
|
+
// payload's subject field on an operation (#761). Only there: on an operation such a key is a typo, and it still
|
|
54
|
+
// admits nobody. `ortho check` holds a read to the thing's own name in camel case, so a typo there is refused (#767).
|
|
55
|
+
const namesSubject = !fromPayload && subject === "id" && own !== undefined && first !== undefined && !(first in own.fields);
|
|
56
|
+
const target = yield* walk(origin, fromPayload || namesSubject ? keys.slice(1) : keys);
|
|
57
|
+
if (!target || target.thing !== role.thing)
|
|
58
|
+
return false;
|
|
59
|
+
const instance = yield* records.find(role.thing, target.id);
|
|
60
|
+
return instance !== undefined && role.rule(instance, person);
|
|
61
|
+
});
|
|
62
|
+
/** The role an `allowed` entry names, if it names one (a narrowed entry names the role it narrowed). */
|
|
63
|
+
const roleOf = (a) => {
|
|
64
|
+
const entry = a.kind === "narrowed" ? a.entry : a;
|
|
65
|
+
return entry.kind === "role" ? entry : entry.kind === "role-of" ? entry.role : undefined;
|
|
66
|
+
};
|
|
67
|
+
/** What a service role is let through by: the mount it names is the mount the call came in by. */
|
|
68
|
+
const serviceAdmits = (role, principal, mounts) => principal.kind === "service" && mounts.get(role.service) === principal.mount;
|
|
69
|
+
const allows = (a, payloadFields, payload, principal, own, mounts) => {
|
|
70
|
+
// A narrowed entry also needs the way the person or agent came in to be one it keeps (M2-auth, fork 2); a service or the system has no way in to narrow.
|
|
71
|
+
const entry = a.kind === "narrowed" ? a.entry : a;
|
|
72
|
+
const kept = a.kind === "narrowed" ? a.via : undefined;
|
|
73
|
+
// The keeper calls only what lists it, even an operation open to anyone; and only the keeper may call what lists it (M8-checks call 4).
|
|
74
|
+
if (entry.kind === "keeper")
|
|
75
|
+
return Effect.succeed(principal.kind === "keeper");
|
|
76
|
+
if (principal.kind === "keeper")
|
|
77
|
+
return Effect.succeed(false);
|
|
78
|
+
if (entry.kind === "anyone")
|
|
79
|
+
return Effect.succeed(true);
|
|
80
|
+
if (entry.kind === "system")
|
|
81
|
+
return Effect.succeed(principal.kind === "system");
|
|
82
|
+
if (entry.kind === "role" && entry.service !== undefined)
|
|
83
|
+
return Effect.succeed(serviceAdmits(entry, principal, mounts));
|
|
84
|
+
if (entry.kind === "role-of" && entry.role.service !== undefined)
|
|
85
|
+
return Effect.succeed(serviceAdmits(entry.role, principal, mounts));
|
|
86
|
+
const who = acting(principal);
|
|
87
|
+
if (!who || (kept !== undefined && !kept.includes(who.via)))
|
|
88
|
+
return Effect.succeed(false);
|
|
89
|
+
if (entry.kind === "signed-in")
|
|
90
|
+
return Effect.succeed(true);
|
|
91
|
+
if (entry.kind === "role-of")
|
|
92
|
+
return roleOn(entry.role, entry.path, payloadFields, payload, who, own);
|
|
93
|
+
return roleOn(entry, undefined, payloadFields, payload, who, own);
|
|
94
|
+
};
|
|
95
|
+
export const Access = {
|
|
96
|
+
holds: ({ allowed, payloadFields, payload, principal, thing, mounts = NO_MOUNTS }) => Effect.gen(function* () {
|
|
97
|
+
const held = [];
|
|
98
|
+
for (const a of allowed) {
|
|
99
|
+
const role = roleOf(a);
|
|
100
|
+
if (role && (yield* allows(a, payloadFields, payload, principal, thing, mounts)))
|
|
101
|
+
held.push(role);
|
|
102
|
+
}
|
|
103
|
+
return held;
|
|
104
|
+
}),
|
|
105
|
+
check: ({ allowed, payloadFields, payload, principal, thing, mounts = NO_MOUNTS }) => Effect.gen(function* () {
|
|
106
|
+
for (const a of allowed)
|
|
107
|
+
if (yield* allows(a, payloadFields, payload, principal, thing, mounts))
|
|
108
|
+
return;
|
|
109
|
+
return yield* new NotAllowed();
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Effect } from "effect";
|
|
2
|
+
import { NotAllowed, type Allowed, type Principal, type Role, type Thing } from "orthograph";
|
|
3
|
+
import type { Records } from "#modules/records/types.js";
|
|
4
|
+
/** The caller has none of the operation's roles. The handler never runs. Exit 3. Declared in blueprint for journeys. */
|
|
5
|
+
export { NotAllowed };
|
|
6
|
+
export interface AccessApi {
|
|
7
|
+
/**
|
|
8
|
+
* The roles the caller holds for this call: each role that an `allowed` entry names and that the caller satisfies, decided
|
|
9
|
+
* the way `check` decides it. What a field `private` to roles is shown to (the MCP server's redaction, D3 #125); `anyone`
|
|
10
|
+
* and `signedIn` are not roles, so a call allowed by them alone holds none.
|
|
11
|
+
*/
|
|
12
|
+
readonly holds: (spec: {
|
|
13
|
+
readonly allowed: ReadonlyArray<Allowed>;
|
|
14
|
+
readonly payloadFields: {
|
|
15
|
+
readonly [key: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
readonly payload: object;
|
|
18
|
+
readonly principal: Principal;
|
|
19
|
+
readonly thing?: Thing;
|
|
20
|
+
/** Each adapter's mount by the name it is mounted under: what a `service` role is read against. */
|
|
21
|
+
readonly mounts?: ReadonlyMap<unknown, string>;
|
|
22
|
+
}) => Effect.Effect<ReadonlyArray<Role>, never, Records>;
|
|
23
|
+
/**
|
|
24
|
+
* Allowed if any entry allows: anyone; anyone signed in; a bare role on the operation's own subject (`grantee`);
|
|
25
|
+
* or a role on the thing a path points at, from a payload field or, failing that, from the subject.
|
|
26
|
+
*/
|
|
27
|
+
readonly check: (spec: {
|
|
28
|
+
readonly allowed: ReadonlyArray<Allowed>;
|
|
29
|
+
readonly payloadFields: {
|
|
30
|
+
readonly [key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
readonly payload: object;
|
|
33
|
+
readonly principal: Principal;
|
|
34
|
+
/** The operation's own thing: its instance named in the payload is the subject. */
|
|
35
|
+
readonly thing?: Thing;
|
|
36
|
+
readonly mounts?: ReadonlyMap<unknown, string>;
|
|
37
|
+
}) => Effect.Effect<void, NotAllowed, Records>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import { Auth, AuthRefused } from "./types.js";
|
|
3
|
+
/** The contract over memory, for the runtime's own tests: ids count up, tokens are the session id. */
|
|
4
|
+
export const authMemory = () => {
|
|
5
|
+
const people = new Map();
|
|
6
|
+
let n = 0;
|
|
7
|
+
const next = (prefix) => `${prefix}_${(++n).toString(36).padStart(16, "0")}`;
|
|
8
|
+
return Layer.succeed(Auth, {
|
|
9
|
+
signUp: ({ email, password }) => people.has(email) ? Effect.fail(new AuthRefused({ reason: "taken" })) : Effect.sync(() => {
|
|
10
|
+
const person = next("per");
|
|
11
|
+
people.set(email, { person, password });
|
|
12
|
+
return { person };
|
|
13
|
+
}),
|
|
14
|
+
signIn: ({ email, password }) => people.get(email)?.password === password
|
|
15
|
+
? Effect.sync(() => { const session = next("ses"); return { session, token: session }; })
|
|
16
|
+
: Effect.fail(new AuthRefused({ reason: "credentials" })),
|
|
17
|
+
createApiKey: () => Effect.sync(() => { const apiKey = next("key"); return { apiKey, key: `${apiKey}.secret` }; }),
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Context, type Effect } from "effect";
|
|
2
|
+
declare const AuthRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3
|
+
readonly _tag: "AuthRefused";
|
|
4
|
+
} & Readonly<A>;
|
|
5
|
+
/** Auth said no: the email is `taken`, or the email and password don't match (`credentials`). */
|
|
6
|
+
export declare class AuthRefused extends AuthRefused_base<{
|
|
7
|
+
readonly reason: "credentials" | "taken";
|
|
8
|
+
}> {
|
|
9
|
+
}
|
|
10
|
+
declare const Auth_base: Context.ServiceClass<Auth, "@orthograph/language-effect/Auth", {
|
|
11
|
+
/** A new person, signed up with an email and a password. Their id is a `per_` id. */
|
|
12
|
+
readonly signUp: (input: {
|
|
13
|
+
readonly email: string;
|
|
14
|
+
readonly password: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
}) => Effect.Effect<{
|
|
17
|
+
readonly person: string;
|
|
18
|
+
}, AuthRefused>;
|
|
19
|
+
/** A new session for the person with this email and password: its `ses_` id and the bearer token for later calls. */
|
|
20
|
+
readonly signIn: (input: {
|
|
21
|
+
readonly email: string;
|
|
22
|
+
readonly password: string;
|
|
23
|
+
}) => Effect.Effect<{
|
|
24
|
+
readonly session: string;
|
|
25
|
+
readonly token: string;
|
|
26
|
+
}, AuthRefused>;
|
|
27
|
+
/** A new API key that calls on `person`'s behalf: its `key_` id, and the key itself, which is never readable again. */
|
|
28
|
+
readonly createApiKey: (input: {
|
|
29
|
+
readonly person: string;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
}) => Effect.Effect<{
|
|
32
|
+
readonly apiKey: string;
|
|
33
|
+
readonly key: string;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
export declare class Auth extends Auth_base {
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Identity, for the handlers that deal in it: signing up, signing in, issuing API keys. The host provides it (Better
|
|
2
|
+
// Auth on D1 for Cloudflare); a handler never imports the auth library itself.
|
|
3
|
+
import { Context, Data } from "effect";
|
|
4
|
+
/** Auth said no: the email is `taken`, or the email and password don't match (`credentials`). */
|
|
5
|
+
export class AuthRefused extends Data.TaggedError("AuthRefused") {
|
|
6
|
+
}
|
|
7
|
+
export class Auth extends Context.Service()("@orthograph/language-effect/Auth") {
|
|
8
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// How a call step runs. Promise mode: the callable is called lazily inside `Effect.tryPromise`, so a synchronous throw
|
|
2
|
+
// and a rejection both enter the failure channel as `unknown`; only that raw wait is uninterruptible, so an interruption
|
|
3
|
+
// waits for the Promise to settle and the work stays counted (a client going away never drops it). Effect mode: the
|
|
4
|
+
// callable's typed failure and its services are kept, with the adapter's own layer. In both, only the typed failure is
|
|
5
|
+
// mapped, and the mapping stays outside the protected wait, so a mapper that throws is a defect.
|
|
6
|
+
import { Effect, Layer } from "effect";
|
|
7
|
+
import { BlankReached } from "#modules/handler/types.js";
|
|
8
|
+
const waited = (wiring, args) => Effect.uninterruptible(Effect.tryPromise({ try: () => Promise.resolve(wiring.run(...args)), catch: (failure) => failure }));
|
|
9
|
+
const effected = (wiring, args) => {
|
|
10
|
+
const work = Effect.suspend(() => wiring.run(...args));
|
|
11
|
+
return wiring.layer ? Effect.provide(work, Layer.orDie(wiring.layer)) : work;
|
|
12
|
+
};
|
|
13
|
+
/** A refusal must be one the call declares: what the mapping returned is never trusted to be one. */
|
|
14
|
+
const declared = (errors, label) => (mapped) => mapped instanceof BlankReached ? Effect.die(mapped)
|
|
15
|
+
// The decision is logged here, inside the operation's span, naming the refusal and never the foreign failure.
|
|
16
|
+
: errors.some((E) => mapped instanceof E) ? Effect.andThen(Effect.logInfo(`${label} failed, and was refused as ${mapped._tag ?? "a declared error"}`), Effect.fail(mapped))
|
|
17
|
+
: Effect.die(new Error(`${label}: its failure was mapped to something the call does not declare, so it is a defect, not a refusal`));
|
|
18
|
+
export const runner = ({ label, step, wiring }) => (args, failure) => {
|
|
19
|
+
const { call } = step;
|
|
20
|
+
if (!wiring)
|
|
21
|
+
return Effect.die(new Error(`${label}: nothing is wired to this call: the server serves it without the adapter's callable`));
|
|
22
|
+
// A generated adapter's mount with no address is a defect, before anything is sent: never a refusal, never a default URL.
|
|
23
|
+
const missing = wiring.unset?.();
|
|
24
|
+
if (missing !== undefined)
|
|
25
|
+
return Effect.die(new Error(`${label}: ${missing} is not set, so the call has nowhere to go`));
|
|
26
|
+
const raw = call.mode === "effect" ? effected(wiring, args) : waited(wiring, args);
|
|
27
|
+
return raw.pipe(Effect.mapError(failure), Effect.catch(declared(call.errors, label)));
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Effect, Layer } from "effect";
|
|
2
|
+
import type { AdapterCall, BlueprintError } from "orthograph";
|
|
3
|
+
/** An adapter's callable: its default export in `src/calls/<call>.js`. A Promise function, or one that gives an Effect. */
|
|
4
|
+
export type Callable = (...args: ReadonlyArray<any>) => unknown;
|
|
5
|
+
/** What the callable answers: the value its Promise settles to, or its Effect succeeds with. */
|
|
6
|
+
export type AnswerOf<F extends Callable> = ReturnType<F> extends Effect.Effect<infer A, any, any> ? A : Awaited<ReturnType<F>>;
|
|
7
|
+
/** What the callable fails with: `unknown` for a Promise (a rejection or a throw), the typed failure of an Effect. */
|
|
8
|
+
export type FailureOf<F extends Callable> = ReturnType<F> extends Effect.Effect<any, infer E, any> ? E : unknown;
|
|
9
|
+
/** What the generated server hands a call step: the callable, its adapter's layer when the adapter ships one, and whether it has an address. */
|
|
10
|
+
export interface CallWiring {
|
|
11
|
+
readonly run: Callable;
|
|
12
|
+
readonly layer?: Layer.Layer<any, any, any>;
|
|
13
|
+
/** A generated adapter's call (G16-adapter-mounts call 1): the variable its mount's address is missing from, or nothing when it has one. */
|
|
14
|
+
readonly unset?: () => string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A call step, as a handler holds it: the callable's arguments, and the one mapping, from what the call failed with to
|
|
18
|
+
* one of the errors the call declares. A refusal is only ever what the mapping made; anything else is a defect.
|
|
19
|
+
*/
|
|
20
|
+
export interface CallRunner<F extends Callable = Callable> {
|
|
21
|
+
<E extends BlueprintError>(args: Parameters<F>, failure: (failure: FailureOf<F>) => E): Effect.Effect<AnswerOf<F>, E>;
|
|
22
|
+
}
|
|
23
|
+
export interface CallsApi {
|
|
24
|
+
/** One call step's runner, not yet in its span: the handler wrapper puts it in `<thing>.<verb>.<step>`. */
|
|
25
|
+
readonly runner: (spec: {
|
|
26
|
+
readonly label: string;
|
|
27
|
+
readonly step: {
|
|
28
|
+
readonly call: AdapterCall;
|
|
29
|
+
};
|
|
30
|
+
readonly wiring: CallWiring | undefined;
|
|
31
|
+
}) => CallRunner;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FieldsInput, Principal } from "orthograph";
|
|
2
|
+
/** A payload as span attributes: `payload.<field>`, every value as text so bigints and ids read the same everywhere. */
|
|
3
|
+
export declare const payloadAttributes: (payload: object, fields: FieldsInput) => Record<string, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Who called, on every span of a call: the kind, the way in a person or agent used, and what names them (M2-auth, "Smaller calls" 2).
|
|
6
|
+
* A refused call names its kind and way in, never the person (G8); an accepted one of a person or an agent also names the person.
|
|
7
|
+
*/
|
|
8
|
+
export declare const principalAttributes: (principal: Principal, refused?: boolean) => Record<string, string>;
|
|
9
|
+
/** The request key a call was made with, as the caller sent it (never the store's `<op>|<who>|<key>`): an id, so traced. Only a key the operation honours (M1.12a). */
|
|
10
|
+
export declare const requestAttributes: (request: string | undefined) => Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* An answer as span attributes, `answer.<field>`, kept as it came (a number stays a number) so a wrong shape shows.
|
|
13
|
+
* A list's `items` are whole instances, so each is cut down to the thing's traceable fields (and `state`) first.
|
|
14
|
+
*/
|
|
15
|
+
export declare const answerAttributes: (answer: unknown, fields: FieldsInput, items?: FieldsInput) => Record<string, unknown>;
|
|
16
|
+
/** Whether a field of an event may be written to the journal. */
|
|
17
|
+
export declare const journalled: (fields: FieldsInput, key: string) => boolean;
|