@dxos/functions-runtime-cloudflare 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731
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/lib/browser/index.mjs +34 -47
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +34 -47
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/internal/queue-service-impl.d.ts +1 -0
- package/dist/types/src/internal/queue-service-impl.d.ts.map +1 -1
- package/dist/types/src/internal/service-container.d.ts +3 -3
- package/dist/types/src/internal/service-container.d.ts.map +1 -1
- package/dist/types/src/queues-api.d.ts +6 -5
- package/dist/types/src/queues-api.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/src/internal/queue-service-impl.ts +4 -0
- package/src/internal/service-container.ts +13 -15
- package/src/queues-api.ts +7 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/functions-runtime-cloudflare",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.d9fc60f731",
|
|
4
4
|
"description": "Functions runtime for Cloudflare.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -27,23 +27,23 @@
|
|
|
27
27
|
"src"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"effect": "3.
|
|
31
|
-
"@dxos/codec-protobuf": "0.8.4-main.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/debug": "0.8.4-main.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
30
|
+
"effect": "3.21.2",
|
|
31
|
+
"@dxos/codec-protobuf": "0.8.4-main.d9fc60f731",
|
|
32
|
+
"@dxos/context": "0.8.4-main.d9fc60f731",
|
|
33
|
+
"@dxos/debug": "0.8.4-main.d9fc60f731",
|
|
34
|
+
"@dxos/echo": "0.8.4-main.d9fc60f731",
|
|
35
|
+
"@dxos/echo-db": "0.8.4-main.d9fc60f731",
|
|
36
|
+
"@dxos/echo-protocol": "0.8.4-main.d9fc60f731",
|
|
37
|
+
"@dxos/errors": "0.8.4-main.d9fc60f731",
|
|
38
|
+
"@dxos/invariant": "0.8.4-main.d9fc60f731",
|
|
39
|
+
"@dxos/keys": "0.8.4-main.d9fc60f731",
|
|
40
|
+
"@dxos/log": "0.8.4-main.d9fc60f731",
|
|
41
|
+
"@dxos/protocols": "0.8.4-main.d9fc60f731",
|
|
42
|
+
"@dxos/util": "0.8.4-main.d9fc60f731"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@cloudflare/workers-types": "^4.20260302.0",
|
|
46
|
-
"@dxos/types": "0.8.4-main.
|
|
46
|
+
"@dxos/types": "0.8.4-main.d9fc60f731"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -63,4 +63,8 @@ export class QueueServiceImpl implements FeedProtocol.QueueService {
|
|
|
63
63
|
async syncQueue(_: FeedProtocol.SyncQueueRequest): Promise<void> {
|
|
64
64
|
// No-op in Cloudflare runtime.
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
async getSyncState(_: FeedProtocol.GetSyncStateRequest): Promise<FeedProtocol.GetSyncStateResponse> {
|
|
68
|
+
return { namespaces: [] };
|
|
69
|
+
}
|
|
66
70
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type AnyEntity } from '@dxos/echo/internal';
|
|
6
|
-
import {
|
|
6
|
+
import { EID, type SpaceId } from '@dxos/keys';
|
|
7
7
|
import { type EdgeFunctionEnv, type FeedProtocol } from '@dxos/protocols';
|
|
8
8
|
import { type QueryService as QueryServiceProto } from '@dxos/protocols/proto/dxos/echo/query';
|
|
9
9
|
import { type DataService as DataServiceProto } from '@dxos/protocols/proto/dxos/echo/service';
|
|
@@ -53,17 +53,15 @@ export class ServiceContainer {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
async queryQueue(queue:
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
async queryQueue(queue: EID.EID): Promise<FeedProtocol.QueryResult> {
|
|
57
|
+
const spaceId = EID.getSpaceId(queue);
|
|
58
|
+
const queueId = EID.getEntityId(queue);
|
|
59
|
+
if (!spaceId || !queueId) {
|
|
60
|
+
throw new Error('Invalid queue EID');
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
const { subspaceTag, spaceId, queueId } = parts;
|
|
63
62
|
const result = await this._queueService.queryQueue(this._executionContext, {
|
|
64
63
|
query: {
|
|
65
64
|
spaceId,
|
|
66
|
-
queuesNamespace: subspaceTag,
|
|
67
65
|
queueIds: [queueId],
|
|
68
66
|
},
|
|
69
67
|
});
|
|
@@ -75,15 +73,15 @@ export class ServiceContainer {
|
|
|
75
73
|
};
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
async insertIntoQueue(queue:
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
async insertIntoQueue(queue: EID.EID, objects: AnyEntity[]): Promise<void> {
|
|
77
|
+
const spaceId = EID.getSpaceId(queue);
|
|
78
|
+
const queueId = EID.getEntityId(queue);
|
|
79
|
+
if (!spaceId || !queueId) {
|
|
80
|
+
throw new Error('Invalid queue EID');
|
|
82
81
|
}
|
|
83
|
-
|
|
84
|
-
const { subspaceTag, spaceId, queueId } = parts;
|
|
82
|
+
// TODO(dmaretskyi): EID does not encode the subspaceTag — defaulting to 'data'.
|
|
85
83
|
await this._queueService.insertIntoQueue(this._executionContext, {
|
|
86
|
-
subspaceTag,
|
|
84
|
+
subspaceTag: 'data',
|
|
87
85
|
spaceId,
|
|
88
86
|
queueId,
|
|
89
87
|
objects: objects.map((obj) => JSON.stringify(obj)),
|
package/src/queues-api.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type AnyEntity } from '@dxos/echo/internal';
|
|
6
|
-
import type
|
|
7
|
-
import {
|
|
6
|
+
import { type EID, type SpaceId } from '@dxos/keys';
|
|
7
|
+
import { type FeedProtocol } from '@dxos/protocols';
|
|
8
8
|
|
|
9
9
|
import type { ServiceContainer } from './internal';
|
|
10
10
|
|
|
@@ -20,8 +20,8 @@ export interface QueuesQueryResult {
|
|
|
20
20
|
* @deprecated
|
|
21
21
|
*/
|
|
22
22
|
export interface QueuesAPI {
|
|
23
|
-
queryQueue(queue:
|
|
24
|
-
insertIntoQueue(queue:
|
|
23
|
+
queryQueue(queue: EID.EID, options?: {}): Promise<FeedProtocol.QueryResult>;
|
|
24
|
+
insertIntoQueue(queue: EID.EID, objects: AnyEntity[]): Promise<void>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -33,24 +33,11 @@ export class QueuesAPIImpl implements QueuesAPI {
|
|
|
33
33
|
private readonly _spaceId: SpaceId,
|
|
34
34
|
) {}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const objects = (result.objects ?? []).flatMap((encoded): AnyEntity[] => {
|
|
39
|
-
try {
|
|
40
|
-
return [JSON.parse(encoded) as AnyEntity];
|
|
41
|
-
} catch (err) {
|
|
42
|
-
log.verbose('queue object JSON parse failed; object ignored', { encoded, error: err });
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
objects,
|
|
48
|
-
nextCursor: result.nextCursor ?? null,
|
|
49
|
-
prevCursor: result.prevCursor ?? null,
|
|
50
|
-
};
|
|
36
|
+
queryQueue(queue: EID.EID, options?: {}): Promise<FeedProtocol.QueryResult> {
|
|
37
|
+
return this._serviceContainer.queryQueue(queue);
|
|
51
38
|
}
|
|
52
39
|
|
|
53
|
-
insertIntoQueue(queue:
|
|
40
|
+
insertIntoQueue(queue: EID.EID, objects: AnyEntity[]): Promise<void> {
|
|
54
41
|
// TODO(dmaretskyi): Ugly.
|
|
55
42
|
return this._serviceContainer.insertIntoQueue(queue, JSON.parse(JSON.stringify(objects)));
|
|
56
43
|
}
|