@cedarjs/realtime 2.5.1 → 2.5.2-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/graphql/index.d.ts +6 -2
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/plugins/{useRedwoodRealtime.d.ts → useCedarRealtime.d.ts} +17 -7
- package/dist/graphql/plugins/useCedarRealtime.d.ts.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/package.json +3 -3
- package/dist/graphql/plugins/useRedwoodRealtime.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -33,11 +33,13 @@ Lastly, the Cedar CLI has commands to
|
|
|
33
33
|
|
|
34
34
|
Regardless of the implementation chosen, **a stateful server and store are needed** to track changes, invalidation, or who wants to be informed about the change.
|
|
35
35
|
|
|
36
|
-
###
|
|
36
|
+
### useCedarRealtime
|
|
37
37
|
|
|
38
|
-
The `
|
|
38
|
+
The `useCedarRealtime` plugin adds support for Cedar Realtime in GraphQL Yoga
|
|
39
|
+
Server.
|
|
39
40
|
|
|
40
|
-
Note: Since a stateful server and store are needed, this plugin cannot be used
|
|
41
|
+
Note: Since a stateful server and store are needed, this plugin cannot be used
|
|
42
|
+
in CedarJS applications deployed to serverless.
|
|
41
43
|
|
|
42
44
|
> **Warning**
|
|
43
45
|
>
|
package/dist/graphql/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
1
|
+
export { useCedarRealtime,
|
|
2
|
+
/** @deprecated - please use useCedarRealtime instead */
|
|
3
|
+
useRedwoodRealtime, createPubSub, liveDirectiveTypeDefs, InMemoryLiveQueryStore, RedisLiveQueryStore, liveQueryStore, pubSub, Repeater, } from './plugins/useCedarRealtime';
|
|
4
|
+
export type { LiveQueryStorageMechanism, PubSub, PublishClientType, SubscribeClientType, SubscriptionGlobImports, CedarRealtimeOptions,
|
|
5
|
+
/** @deprecated - please use CedarRealtimeOptions instead */
|
|
6
|
+
RedwoodRealtimeOptions, } from './plugins/useCedarRealtime';
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,QAAQ,GACT,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB;AAChB,wDAAwD;AACxD,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,QAAQ,GACT,MAAM,4BAA4B,CAAA;AAEnC,YAAY,EACV,yBAAyB,EACzB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB;AACpB,4DAA4D;AAC5D,sBAAsB,GACvB,MAAM,4BAA4B,CAAA"}
|
|
@@ -29,9 +29,11 @@ export type SubscribeClientType = CreateRedisEventTargetArgs['subscribeClient'];
|
|
|
29
29
|
*
|
|
30
30
|
* Realtime supports Live Queries and Subscriptions over GraphQL SSE.
|
|
31
31
|
*
|
|
32
|
-
* Live Queries are GraphQL queries that are automatically re-run when the data
|
|
32
|
+
* Live Queries are GraphQL queries that are automatically re-run when the data
|
|
33
|
+
* they depend on changes.
|
|
33
34
|
*
|
|
34
|
-
* Subscriptions are GraphQL queries that are run when a client subscribes to a
|
|
35
|
+
* Subscriptions are GraphQL queries that are run when a client subscribes to a
|
|
36
|
+
* channel.
|
|
35
37
|
*
|
|
36
38
|
* CedarJS Realtime
|
|
37
39
|
* - uses a publish/subscribe model to broadcast data to clients.
|
|
@@ -41,11 +43,11 @@ export type SubscribeClientType = CreateRedisEventTargetArgs['subscribeClient'];
|
|
|
41
43
|
* - In-memory stores are useful for development and testing.
|
|
42
44
|
* - Redis stores are useful for production.
|
|
43
45
|
*/
|
|
44
|
-
export type
|
|
46
|
+
export type CedarRealtimeOptions = {
|
|
45
47
|
enableDeferStream?: boolean;
|
|
46
48
|
liveQueries?: {
|
|
47
49
|
/**
|
|
48
|
-
* @description
|
|
50
|
+
* @description Cedar Realtime supports in-memory and Redis stores.
|
|
49
51
|
* @default 'in-memory'
|
|
50
52
|
*/
|
|
51
53
|
store: 'in-memory' | {
|
|
@@ -62,7 +64,7 @@ export type RedwoodRealtimeOptions = {
|
|
|
62
64
|
};
|
|
63
65
|
subscriptions?: {
|
|
64
66
|
/**
|
|
65
|
-
* @description
|
|
67
|
+
* @description Cedar Realtime supports in-memory and Redis stores.
|
|
66
68
|
* @default 'in-memory'
|
|
67
69
|
*/
|
|
68
70
|
store: 'in-memory' | {
|
|
@@ -78,6 +80,10 @@ export type RedwoodRealtimeOptions = {
|
|
|
78
80
|
subscriptions: SubscriptionGlobImports;
|
|
79
81
|
};
|
|
80
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated Use `CedarRealtimeOptions` instead.
|
|
85
|
+
*/
|
|
86
|
+
export type RedwoodRealtimeOptions = CedarRealtimeOptions;
|
|
81
87
|
export declare class RedisLiveQueryStore {
|
|
82
88
|
pub: PublishClientType;
|
|
83
89
|
sub: SubscribeClientType;
|
|
@@ -89,5 +95,9 @@ export declare class RedisLiveQueryStore {
|
|
|
89
95
|
}
|
|
90
96
|
export declare let liveQueryStore: LiveQueryStorageMechanism | undefined;
|
|
91
97
|
export declare let pubSub: ReturnType<typeof createPubSub> | undefined;
|
|
92
|
-
export declare const
|
|
93
|
-
|
|
98
|
+
export declare const useCedarRealtime: (options: CedarRealtimeOptions) => Plugin;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Use `useCedarRealtime` instead.
|
|
101
|
+
*/
|
|
102
|
+
export declare const useRedwoodRealtime: (options: CedarRealtimeOptions) => Plugin;
|
|
103
|
+
//# sourceMappingURL=useCedarRealtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCedarRealtime.d.ts","sourceRoot":"","sources":["../../../src/graphql/plugins/useCedarRealtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAO3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAEzD,YAAY,EAAE,MAAM,EAAE,CAAA;AAEtB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,CAAA;AAE/C,eAAO,MAAM,qBAAqB,QAEjC,CAAA;AAED,MAAM,MAAM,yBAAyB,GACjC,mBAAmB,GACnB,sBAAsB,CAAA;AAE1B,MAAM,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,eAAe,CAAC,CAAA;AAC3E,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,iBAAiB,CAAC,CAAA;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,WAAW,CAAC,EAAE;QACZ;;;WAGG;QACH,KAAK,EACD,WAAW,GACX;YACE,KAAK,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ealtime instead */
|
|
3
|
+
useRedwoodRealtime, createPubSub, liveDirectiveTypeDefs, InMemoryLiveQueryStore, RedisLiveQueryStore, liveQueryStore, pubSub, Repeater, } from './graphql';
|
|
4
|
+
export type { LiveQueryStorageMechanism, PubSub, PublishClientType, SubscribeClientType, SubscriptionGlobImports, CedarRealtimeOptions,
|
|
5
|
+
/** @deprecated - please use CedarRealtimeOptions instead */
|
|
6
|
+
RedwoodRealtimeOptions, } from './graphql';
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,QAAQ,GACT,MAAM,WAAW,CAAA;AAElB,YAAY,EACV,yBAAyB,EACzB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB;AAChB,wDAAwD;AACxD,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,QAAQ,GACT,MAAM,WAAW,CAAA;AAElB,YAAY,EACV,yBAAyB,EACzB,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB;AACpB,4DAA4D;AAC5D,sBAAsB,GACvB,MAAM,WAAW,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -27,11 +27,12 @@ __export(src_exports, {
|
|
|
27
27
|
liveDirectiveTypeDefs: () => liveDirectiveTypeDefs,
|
|
28
28
|
liveQueryStore: () => liveQueryStore,
|
|
29
29
|
pubSub: () => pubSub,
|
|
30
|
+
useCedarRealtime: () => useCedarRealtime,
|
|
30
31
|
useRedwoodRealtime: () => useRedwoodRealtime
|
|
31
32
|
});
|
|
32
33
|
module.exports = __toCommonJS(src_exports);
|
|
33
34
|
|
|
34
|
-
// src/graphql/plugins/
|
|
35
|
+
// src/graphql/plugins/useCedarRealtime.ts
|
|
35
36
|
var import_live_query = require("@envelop/live-query");
|
|
36
37
|
var import_schema = require("@graphql-tools/schema");
|
|
37
38
|
var import_utils = require("@graphql-tools/utils");
|
|
@@ -81,14 +82,14 @@ var RedisLiveQueryStore = class {
|
|
|
81
82
|
};
|
|
82
83
|
var liveQueryStore = void 0;
|
|
83
84
|
var pubSub = void 0;
|
|
84
|
-
var
|
|
85
|
+
var useCedarRealtime = (options) => {
|
|
85
86
|
let liveQueriesEnabled = false;
|
|
86
87
|
let subscriptionsEnabled = false;
|
|
87
88
|
let liveQueryPlugin = {};
|
|
88
89
|
const inMemoryLiveQueryStore = new import_in_memory_live_query_store.InMemoryLiveQueryStore();
|
|
89
90
|
liveQueryStore = {};
|
|
90
91
|
pubSub = {};
|
|
91
|
-
const wasLiveQueryAdded = Symbol.for("
|
|
92
|
+
const wasLiveQueryAdded = Symbol.for("useCedarRealtime.wasLiveQueryAdded");
|
|
92
93
|
if (options.liveQueries?.store) {
|
|
93
94
|
if (options.liveQueries.store === "in-memory") {
|
|
94
95
|
liveQueriesEnabled = true;
|
|
@@ -162,6 +163,9 @@ var useRedwoodRealtime = (options) => {
|
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
165
|
};
|
|
166
|
+
var useRedwoodRealtime = (options) => {
|
|
167
|
+
return useCedarRealtime(options);
|
|
168
|
+
};
|
|
165
169
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
170
|
0 && (module.exports = {
|
|
167
171
|
InMemoryLiveQueryStore,
|
|
@@ -171,5 +175,6 @@ var useRedwoodRealtime = (options) => {
|
|
|
171
175
|
liveDirectiveTypeDefs,
|
|
172
176
|
liveQueryStore,
|
|
173
177
|
pubSub,
|
|
178
|
+
useCedarRealtime,
|
|
174
179
|
useRedwoodRealtime
|
|
175
180
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/realtime",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2-next.16+a27a893fb",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"graphql": "16.12.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@cedarjs/framework-tools": "
|
|
37
|
+
"@cedarjs/framework-tools": "2.5.2-next.16",
|
|
38
38
|
"@envelop/core": "5.5.0",
|
|
39
39
|
"@envelop/testing": "7.0.0",
|
|
40
40
|
"@envelop/types": "5.2.1",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a27a893fb8f6883f3bf121dad4d3edf7696484fe"
|
|
59
59
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRedwoodRealtime.d.ts","sourceRoot":"","sources":["../../../src/graphql/plugins/useRedwoodRealtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAO3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,M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