@dxos/protocols 0.8.4-main.406dc2a → 0.8.4-main.59c2e9b

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.
Files changed (198) hide show
  1. package/dist/src/FunctionProtocol.d.ts +82 -0
  2. package/dist/src/FunctionProtocol.d.ts.map +1 -0
  3. package/dist/src/FunctionProtocol.js +4 -0
  4. package/dist/src/FunctionProtocol.js.map +1 -0
  5. package/dist/src/buf/proto/gen/dxos/client/queue_pb.d.ts +189 -0
  6. package/dist/src/buf/proto/gen/dxos/client/queue_pb.d.ts.map +1 -0
  7. package/dist/src/buf/proto/gen/dxos/client/queue_pb.js +39 -0
  8. package/dist/src/buf/proto/gen/dxos/client/queue_pb.js.map +1 -0
  9. package/dist/src/buf/proto/gen/dxos/config_pb.d.ts +4 -0
  10. package/dist/src/buf/proto/gen/dxos/config_pb.d.ts.map +1 -1
  11. package/dist/src/buf/proto/gen/dxos/config_pb.js +1 -1
  12. package/dist/src/buf/proto/gen/dxos/config_pb.js.map +1 -1
  13. package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts +12 -2
  14. package/dist/src/buf/proto/gen/dxos/echo/query_pb.d.ts.map +1 -1
  15. package/dist/src/buf/proto/gen/dxos/echo/query_pb.js +1 -1
  16. package/dist/src/buf/proto/gen/dxos/echo/query_pb.js.map +1 -1
  17. package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts +55 -9
  18. package/dist/src/buf/proto/gen/dxos/echo/service_pb.d.ts.map +1 -1
  19. package/dist/src/buf/proto/gen/dxos/echo/service_pb.js +15 -5
  20. package/dist/src/buf/proto/gen/dxos/echo/service_pb.js.map +1 -1
  21. package/dist/src/buf/proto/gen/dxos/google_pb.js +1 -1
  22. package/dist/src/buf/proto/gen/dxos/google_pb.js.map +1 -1
  23. package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts +1 -0
  24. package/dist/src/buf/proto/gen/dxos/iframe_pb.d.ts.map +1 -1
  25. package/dist/src/buf/proto/gen/dxos/iframe_pb.js.map +1 -1
  26. package/dist/src/buf/proto/gen/dxos/tracing_pb.js +1 -1
  27. package/dist/src/buf/proto/gen/dxos/tracing_pb.js.map +1 -1
  28. package/dist/src/edge/EdgeFunctionEnv.d.ts +120 -0
  29. package/dist/src/edge/EdgeFunctionEnv.d.ts.map +1 -0
  30. package/dist/src/edge/EdgeFunctionEnv.js +4 -0
  31. package/dist/src/edge/EdgeFunctionEnv.js.map +1 -0
  32. package/dist/src/{edge.d.ts → edge/edge.d.ts} +110 -10
  33. package/dist/src/edge/edge.d.ts.map +1 -0
  34. package/dist/src/edge/edge.js +160 -0
  35. package/dist/src/edge/edge.js.map +1 -0
  36. package/dist/src/edge/errors.d.ts +29 -0
  37. package/dist/src/edge/errors.d.ts.map +1 -0
  38. package/dist/src/edge/errors.js +69 -0
  39. package/dist/src/edge/errors.js.map +1 -0
  40. package/dist/src/edge/index.d.ts +4 -0
  41. package/dist/src/edge/index.d.ts.map +1 -0
  42. package/dist/src/edge/index.js +7 -0
  43. package/dist/src/edge/index.js.map +1 -0
  44. package/dist/src/errors/base-errors.d.ts +86 -8
  45. package/dist/src/errors/base-errors.d.ts.map +1 -1
  46. package/dist/src/errors/base-errors.js +4 -20
  47. package/dist/src/errors/base-errors.js.map +1 -1
  48. package/dist/src/errors/encoding.d.ts +1 -1
  49. package/dist/src/errors/encoding.d.ts.map +1 -1
  50. package/dist/src/errors/errors.d.ts +618 -41
  51. package/dist/src/errors/errors.d.ts.map +1 -1
  52. package/dist/src/errors/errors.js +49 -103
  53. package/dist/src/errors/errors.js.map +1 -1
  54. package/dist/src/errors/errors.test.js +1 -1
  55. package/dist/src/errors/errors.test.js.map +1 -1
  56. package/dist/src/errors/helpers.d.ts +8 -4
  57. package/dist/src/errors/helpers.d.ts.map +1 -1
  58. package/dist/src/errors/helpers.js +3 -3
  59. package/dist/src/errors/helpers.js.map +1 -1
  60. package/dist/src/feed-replication.d.ts.map +1 -1
  61. package/dist/src/index.d.ts +3 -3
  62. package/dist/src/index.d.ts.map +1 -1
  63. package/dist/src/index.js +4 -3
  64. package/dist/src/index.js.map +1 -1
  65. package/dist/src/messenger.d.ts +16 -0
  66. package/dist/src/messenger.d.ts.map +1 -0
  67. package/dist/src/messenger.js +4 -0
  68. package/dist/src/messenger.js.map +1 -0
  69. package/dist/src/proto/gen/dxos/client/services.d.ts +254 -151
  70. package/dist/src/proto/gen/dxos/client/services.d.ts.map +1 -1
  71. package/dist/src/proto/gen/dxos/client/services.js +27 -27
  72. package/dist/src/proto/gen/dxos/client/services.js.map +1 -1
  73. package/dist/src/proto/gen/dxos/config.d.ts +5 -0
  74. package/dist/src/proto/gen/dxos/config.d.ts.map +1 -1
  75. package/dist/src/proto/gen/dxos/config.js.map +1 -1
  76. package/dist/src/proto/gen/dxos/echo/query.d.ts +17 -1
  77. package/dist/src/proto/gen/dxos/echo/query.d.ts.map +1 -1
  78. package/dist/src/proto/gen/dxos/echo/query.js.map +1 -1
  79. package/dist/src/proto/gen/dxos/echo/service.d.ts +34 -8
  80. package/dist/src/proto/gen/dxos/echo/service.d.ts.map +1 -1
  81. package/dist/src/proto/gen/index.d.ts +8 -0
  82. package/dist/src/proto/gen/index.d.ts.map +1 -1
  83. package/dist/src/proto/gen/index.js +1 -1
  84. package/dist/src/proto/gen/index.js.map +1 -1
  85. package/dist/src/queue.d.ts +1 -26
  86. package/dist/src/queue.d.ts.map +1 -1
  87. package/dist/src/queue.js +1 -4
  88. package/dist/src/queue.js.map +1 -1
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +19 -15
  91. package/src/FunctionProtocol.ts +104 -0
  92. package/src/buf/proto/gen/dxos/agent/dashboard_pb.ts +1 -1
  93. package/src/buf/proto/gen/dxos/agent/echo-proxy_pb.ts +1 -1
  94. package/src/buf/proto/gen/dxos/agent/epoch_pb.ts +1 -1
  95. package/src/buf/proto/gen/dxos/agent/functions_pb.ts +1 -1
  96. package/src/buf/proto/gen/dxos/bot_pb.ts +1 -1
  97. package/src/buf/proto/gen/dxos/client/invitation_pb.ts +1 -1
  98. package/src/buf/proto/gen/dxos/client/logging_pb.ts +1 -1
  99. package/src/buf/proto/gen/dxos/client/queue_pb.ts +231 -0
  100. package/src/buf/proto/gen/dxos/client/services_pb.ts +1 -1
  101. package/src/buf/proto/gen/dxos/config_pb.ts +7 -2
  102. package/src/buf/proto/gen/dxos/devtools/diagnostics_pb.ts +1 -1
  103. package/src/buf/proto/gen/dxos/devtools/host_pb.ts +1 -1
  104. package/src/buf/proto/gen/dxos/devtools/swarm_pb.ts +1 -1
  105. package/src/buf/proto/gen/dxos/echo/blob_pb.ts +1 -1
  106. package/src/buf/proto/gen/dxos/echo/feed_pb.ts +1 -1
  107. package/src/buf/proto/gen/dxos/echo/filter_pb.ts +1 -1
  108. package/src/buf/proto/gen/dxos/echo/indexing_pb.ts +1 -1
  109. package/src/buf/proto/gen/dxos/echo/metadata_pb.ts +1 -1
  110. package/src/buf/proto/gen/dxos/echo/model/document_pb.ts +1 -1
  111. package/src/buf/proto/gen/dxos/echo/model/messenger_pb.ts +1 -1
  112. package/src/buf/proto/gen/dxos/echo/model/text_pb.ts +1 -1
  113. package/src/buf/proto/gen/dxos/echo/object_pb.ts +1 -1
  114. package/src/buf/proto/gen/dxos/echo/query_pb.ts +16 -4
  115. package/src/buf/proto/gen/dxos/echo/service_pb.ts +68 -16
  116. package/src/buf/proto/gen/dxos/echo/snapshot_pb.ts +1 -1
  117. package/src/buf/proto/gen/dxos/echo/timeframe_pb.ts +1 -1
  118. package/src/buf/proto/gen/dxos/edge/calls_pb.ts +1 -1
  119. package/src/buf/proto/gen/dxos/edge/messenger_pb.ts +1 -1
  120. package/src/buf/proto/gen/dxos/edge/signal_pb.ts +1 -1
  121. package/src/buf/proto/gen/dxos/error_pb.ts +1 -1
  122. package/src/buf/proto/gen/dxos/field_options_pb.ts +1 -1
  123. package/src/buf/proto/gen/dxos/google_pb.ts +1 -1
  124. package/src/buf/proto/gen/dxos/gravity_pb.ts +1 -1
  125. package/src/buf/proto/gen/dxos/halo/credentials/auth_pb.ts +1 -1
  126. package/src/buf/proto/gen/dxos/halo/credentials/greet_pb.ts +1 -1
  127. package/src/buf/proto/gen/dxos/halo/credentials/identity_pb.ts +1 -1
  128. package/src/buf/proto/gen/dxos/halo/credentials_pb.ts +1 -1
  129. package/src/buf/proto/gen/dxos/halo/invitations_pb.ts +1 -1
  130. package/src/buf/proto/gen/dxos/halo/keyring_pb.ts +1 -1
  131. package/src/buf/proto/gen/dxos/halo/keys_pb.ts +1 -1
  132. package/src/buf/proto/gen/dxos/halo/signed_pb.ts +1 -1
  133. package/src/buf/proto/gen/dxos/iframe_pb.ts +2 -1
  134. package/src/buf/proto/gen/dxos/keys_pb.ts +1 -1
  135. package/src/buf/proto/gen/dxos/mesh/bridge_pb.ts +1 -1
  136. package/src/buf/proto/gen/dxos/mesh/broadcast_pb.ts +1 -1
  137. package/src/buf/proto/gen/dxos/mesh/messaging_pb.ts +1 -1
  138. package/src/buf/proto/gen/dxos/mesh/muxer_pb.ts +1 -1
  139. package/src/buf/proto/gen/dxos/mesh/presence_pb.ts +1 -1
  140. package/src/buf/proto/gen/dxos/mesh/protocol_pb.ts +1 -1
  141. package/src/buf/proto/gen/dxos/mesh/replicator_pb.ts +1 -1
  142. package/src/buf/proto/gen/dxos/mesh/signal_pb.ts +1 -1
  143. package/src/buf/proto/gen/dxos/mesh/swarm_pb.ts +1 -1
  144. package/src/buf/proto/gen/dxos/mesh/teleport/admission-discovery_pb.ts +1 -1
  145. package/src/buf/proto/gen/dxos/mesh/teleport/auth_pb.ts +1 -1
  146. package/src/buf/proto/gen/dxos/mesh/teleport/automerge_pb.ts +1 -1
  147. package/src/buf/proto/gen/dxos/mesh/teleport/blobsync_pb.ts +1 -1
  148. package/src/buf/proto/gen/dxos/mesh/teleport/control_pb.ts +1 -1
  149. package/src/buf/proto/gen/dxos/mesh/teleport/gossip_pb.ts +1 -1
  150. package/src/buf/proto/gen/dxos/mesh/teleport/notarization_pb.ts +1 -1
  151. package/src/buf/proto/gen/dxos/mesh/teleport/replicator_pb.ts +1 -1
  152. package/src/buf/proto/gen/dxos/registry_pb.ts +1 -1
  153. package/src/buf/proto/gen/dxos/rpc_pb.ts +1 -1
  154. package/src/buf/proto/gen/dxos/service/agentmanager_pb.ts +1 -1
  155. package/src/buf/proto/gen/dxos/service/publisher_pb.ts +1 -1
  156. package/src/buf/proto/gen/dxos/service/supervisor_pb.ts +1 -1
  157. package/src/buf/proto/gen/dxos/service/tunnel_pb.ts +1 -1
  158. package/src/buf/proto/gen/dxos/tracing_pb.ts +1 -1
  159. package/src/buf/proto/gen/dxos/type_pb.ts +1 -1
  160. package/src/buf/proto/gen/dxos/value_pb.ts +1 -1
  161. package/src/buf/proto/gen/example/testing/data_pb.ts +1 -1
  162. package/src/buf/proto/gen/example/testing/rpc_pb.ts +1 -1
  163. package/src/edge/EdgeFunctionEnv.ts +193 -0
  164. package/src/edge/edge.ts +484 -0
  165. package/src/edge/errors.ts +85 -0
  166. package/src/edge/index.ts +7 -0
  167. package/src/errors/base-errors.ts +4 -22
  168. package/src/errors/errors.test.ts +1 -1
  169. package/src/errors/errors.ts +55 -121
  170. package/src/errors/helpers.ts +5 -6
  171. package/src/feed-replication.ts +1 -0
  172. package/src/index.ts +5 -3
  173. package/src/messenger.ts +22 -0
  174. package/src/proto/dxos/client/queue.proto +67 -0
  175. package/src/proto/dxos/config.proto +2 -0
  176. package/src/proto/dxos/echo/query.proto +4 -1
  177. package/src/proto/dxos/echo/service.proto +27 -6
  178. package/src/proto/dxos/iframe.proto +1 -0
  179. package/src/proto/gen/dxos/client/services.ts +254 -151
  180. package/src/proto/gen/dxos/config.ts +5 -0
  181. package/src/proto/gen/dxos/echo/query.ts +17 -1
  182. package/src/proto/gen/dxos/echo/service.ts +33 -8
  183. package/src/proto/gen/index.ts +9 -1
  184. package/src/queue.ts +9 -33
  185. package/dist/src/edge-error.d.ts +0 -26
  186. package/dist/src/edge-error.d.ts.map +0 -1
  187. package/dist/src/edge-error.js +0 -102
  188. package/dist/src/edge-error.js.map +0 -1
  189. package/dist/src/edge.d.ts.map +0 -1
  190. package/dist/src/edge.js +0 -49
  191. package/dist/src/edge.js.map +0 -1
  192. package/dist/src/query.d.ts +0 -5
  193. package/dist/src/query.d.ts.map +0 -1
  194. package/dist/src/query.js +0 -8
  195. package/dist/src/query.js.map +0 -1
  196. package/src/edge-error.ts +0 -134
  197. package/src/edge.ts +0 -279
  198. package/src/query.ts +0 -8
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file dxos/service/publisher.proto (package dxos.service.publisher, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file dxos/service/supervisor.proto (package dxos.service.supervisor, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file dxos/service/tunnel.proto (package dxos.service.tunnel, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
1
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
2
2
  // @generated from file dxos/tracing.proto (package dxos.tracing, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file dxos/type.proto (package dxos.type, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file dxos/value.proto (package dxos.value, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file example/testing/data.proto (package example.testing.data, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- // @generated by protoc-gen-es v2.9.0 with parameter "target=ts,import_extension=js"
5
+ // @generated by protoc-gen-es v2.10.1 with parameter "target=ts,import_extension=js"
6
6
  // @generated from file example/testing/rpc.proto (package example.testing.rpc, syntax proto3)
7
7
  /* eslint-disable */
8
8
 
@@ -0,0 +1,193 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type SpaceId } from '@dxos/keys';
6
+
7
+ import { type CreateDocumentRequest, type CreateDocumentResponse } from '../proto/gen/dxos/echo/service';
8
+ import { type QueryResult, type QueueQuery } from '../queue';
9
+
10
+ /*
11
+
12
+ API for the edge functions service.
13
+ A function module should be a valid cloudflare worker module.
14
+
15
+ # Fetching metadata (done on deploy)
16
+
17
+ GET http://functions.dxos.internal/
18
+ X-DXOS-Function-Route: meta
19
+
20
+ Expected to return `FunctionMetadata` in JSON:
21
+
22
+ {
23
+ key: string;
24
+ name?: string;
25
+ description?: string;
26
+ inputSchema?: JsonSchemaType;
27
+ outputSchema?: JsonSchemaType;
28
+ }
29
+
30
+ # Invoking the function
31
+
32
+ POST http://functions.dxos.internal/
33
+ Content-Type: application/json
34
+ X-Trace-Queue-Dxn: dxn:queue:trace:AAAAAA:BBBBBB
35
+ X-Invocation-Id: XXXXXXX
36
+ X-Edge-Env: production
37
+
38
+ {input_data}
39
+
40
+ Expected to return `EdgeEnvelope` with the output data:
41
+
42
+ {
43
+ success: true,
44
+ data: unknown
45
+ }
46
+
47
+ On Error returns `EdgeEnvelope` with error:
48
+
49
+ {
50
+ success: false,
51
+ message: string
52
+ error: EncodedError
53
+ }
54
+
55
+ */
56
+
57
+ /**
58
+ * Environment available to the function running on Cloudflare.
59
+ */
60
+ export interface Env {
61
+ QUEUE_SERVICE: QueueService;
62
+ DATA_SERVICE: DataService;
63
+ FUNCTIONS_AI_SERVICE: FunctionsAiService;
64
+ }
65
+
66
+ /**
67
+ * Use to trace the execution across multiple services.
68
+ *
69
+ * NOTE: Currently unused in functions.
70
+ */
71
+ export interface ExecutionContext {}
72
+
73
+ /**
74
+ * Database API for other CF services like functions.
75
+ */
76
+ export interface DataService {
77
+ getSpaceMeta(ctx: ExecutionContext, spaceId: SpaceId): Promise<RpcResult<SpaceMeta | undefined>>;
78
+ getDocument(ctx: ExecutionContext, spaceId: SpaceId, documentId: string): Promise<RpcResult<RawDocument | undefined>>;
79
+
80
+ query(ctx: ExecutionContext, request: QueryRequest): Promise<RpcResult<QueryResponse>>;
81
+ queryDocuments(ctx: ExecutionContext, request: QueryRequest): Promise<RpcResult<QueryDocumentsResponse>>;
82
+ queryReferences(ctx: ExecutionContext, request: QueryReferencesRequest): Promise<RpcResult<QueryReferencesResponse>>;
83
+
84
+ createDocument(ctx: ExecutionContext, request: CreateDocumentRequest): Promise<RpcResult<CreateDocumentResponse>>;
85
+
86
+ // TODO(burdon): Update? Return DocumentEntry?
87
+ changeDocument(ctx: ExecutionContext, spaceId: SpaceId, documentId: string, changes: Uint8Array): Promise<void>;
88
+ }
89
+
90
+ export interface QueueService {
91
+ query(ctx: ExecutionContext, queueDXN: string, query: Omit<QueueQuery, 'queueId'>): Promise<RpcResult<QueryResult>>;
92
+ append(ctx: ExecutionContext, queueDXN: string, objects: unknown[]): Promise<void>;
93
+ }
94
+
95
+ /**
96
+ * FunctionsAiService API for other CF services like functions.
97
+ */
98
+ export interface FunctionsAiService {
99
+ /**
100
+ * Enables proxying HTTP requests to the AI service from other workers.
101
+ */
102
+ fetch(request: Request): Promise<RpcResult<Response>>;
103
+ }
104
+
105
+ export type ObjectDocumentJson = {
106
+ type?: string;
107
+ objectId: string;
108
+ documentId: string;
109
+ /** Base64 encoding of a document. */
110
+ document: string;
111
+ };
112
+
113
+ export type SpaceMeta = {
114
+ spaceKey: string;
115
+ rootDocumentId: string;
116
+ };
117
+
118
+ export type QueryRequest = {
119
+ spaceId: string;
120
+ type?: string;
121
+ where?: Record<string, any>;
122
+ objectIds?: string[];
123
+ cursor?: string;
124
+ limit?: number;
125
+ };
126
+
127
+ export type QueryResponse = {
128
+ results: ObjectSnapshot[];
129
+ cursor?: string;
130
+ };
131
+
132
+ /**
133
+ * TODO(yaroslav): make Indexer return EchoObject after create() can properly reconstruct an object
134
+ * from this structure (meta, id and type aren't handled properly)
135
+ */
136
+ export type ObjectSnapshot = {
137
+ type?: string;
138
+ documentId: string;
139
+ objectId: string;
140
+ // TODO(mykola): Use ObjectStructure from @dxos/echo-protocol.
141
+ object: unknown;
142
+ };
143
+
144
+ export type ObjectReference = {
145
+ fromId: string;
146
+ toId: string;
147
+ fieldName: string;
148
+ };
149
+
150
+ export type QueryDocumentsResponse = {
151
+ results: RawObject[];
152
+ cursor?: string;
153
+ };
154
+
155
+ export type RawDocument = {
156
+ documentId: string;
157
+ data: Uint8Array;
158
+ };
159
+
160
+ export type RawObject = {
161
+ type?: string;
162
+ objectId: string;
163
+ document: RawDocument;
164
+ };
165
+
166
+ export type QueryReferencesRequest = {
167
+ spaceId: string;
168
+ objectId: string;
169
+ referenceType: 'from' | 'to';
170
+ };
171
+
172
+ export type QueryReferencesResponse = {
173
+ references: ObjectReference[];
174
+ };
175
+
176
+ /**
177
+ * Cloudflare Workers RPC returns objects/arrays/stubs that may need to be explicitly disposed.
178
+ *
179
+ * See: https://developers.cloudflare.com/workers/runtime-apis/rpc/lifecycle/
180
+ */
181
+ export interface RpcDisposable {
182
+ /**
183
+ * Disposes the RPC stub / returned value and releases any server-side resources it references.
184
+ */
185
+ [Symbol.dispose](): void;
186
+ }
187
+
188
+ /**
189
+ * Wraps a return type so that any non-primitive value is marked as disposable.
190
+ *
191
+ * This models Workers RPC behavior where any returned object (including arrays) gets a disposer added.
192
+ */
193
+ export type RpcResult<T> = T extends object ? T & RpcDisposable : T;