diff --git a/components/channel/jetstreamPushSubscription.js b/components/channel/jetstreamPushSubscription.js new file mode 100644 index 000000000..57b36eb3a --- /dev/null +++ b/components/channel/jetstreamPushSubscription.js @@ -0,0 +1,72 @@ +import { realizeChannelName, camelCase, getMessageType, messageHasNullPayload, realizeParametersForChannelWrapper, renderJSDocParameters} from '../../utils/index'; +import { unwrap } from './ChannelParameterUnwrap'; +// eslint-disable-next-line no-unused-vars +import { Message, ChannelParameter } from '@asyncapi/parser'; + +/** + * Component which returns a function which subscribes to the given channel + * + * @param {string} defaultContentType + * @param {string} channelName to subscribe to + * @param {Message} message which is being received + * @param {Object.} channelParameters parameters to the channel + */ +export function JetstreamPushSubscription(channelName, message, channelParameters) { + const messageType = getMessageType(message); + let parameters = []; + parameters = Object.entries(channelParameters).map(([parameterName]) => { + return `${camelCase(parameterName)}Param`; + }); + const hasNullPayload = messageHasNullPayload(message.payload()); + + //Determine the callback process when receiving messages. + //If the message payload is null no hooks are called to process the received data. + let whenReceivingMessage = `onDataCallback(undefined, null ${parameters.length > 0 && `, ${parameters.join(',')}`});`; + if (!hasNullPayload) { + whenReceivingMessage = ` + let receivedData: any = codec.decode(msg.data); + onDataCallback(undefined, ${messageType}.unmarshal(receivedData) ${parameters.length > 0 && `, ${parameters.join(',')}`}); + `; + } + + return ` + + /** + * Internal functionality to setup jetstream push subscription on the \`${channelName}\` channel + * + * @param onDataCallback to call when messages are received + * @param nc to subscribe with + * @param codec used to convert messages + ${renderJSDocParameters(channelParameters)} + * @param options to subscribe with, bindings from the AsyncAPI document overwrite these if specified + */ + export function jetStreamPushSubscribe( + onDataCallback: ( + err ? : NatsTypescriptTemplateError, + msg?: ${messageType} + ${realizeParametersForChannelWrapper(channelParameters, false)}, + jetstreamMsg?: Nats.JsMsg) => void, + js: Nats.JetStreamClient, + codec: Nats.Codec < any > + ${realizeParametersForChannelWrapper(channelParameters)}, + options: Nats.ConsumerOptsBuilder | Partial + ): Promise < Nats.JetStreamSubscription > { + return new Promise(async (resolve, reject) => { + try { + let subscription = js.subscribe(${realizeChannelName(channelParameters, channelName)}, options); + (async () => { + for await (const msg of await subscription) { + ${unwrap(channelName, channelParameters)} + + ${whenReceivingMessage} + } + console.log("subscription closed"); + })(); + resolve(subscription); + } catch (e: any) { + reject(NatsTypescriptTemplateError.errorForCode(ErrorCode.INTERNAL_NATS_TS_ERROR, e)); + } + }) + } + `; +} diff --git a/components/index/jetstreamPushSubscription.js b/components/index/jetstreamPushSubscription.js new file mode 100644 index 000000000..5904bc9ef --- /dev/null +++ b/components/index/jetstreamPushSubscription.js @@ -0,0 +1,55 @@ +import { pascalCase, camelCase, getMessageType, realizeParametersForChannelWrapper, realizeParametersForChannelWithoutType, renderJSDocParameters} from '../../utils/index'; +// eslint-disable-next-line no-unused-vars +import { Message, ChannelParameter } from '@asyncapi/parser'; + +/** + * Component which returns a subscribe to function for the client + * + * @param {string} defaultContentType + * @param {string} channelName to publish to + * @param {Message} message which is being received + * @param {string} messageDescription + * @param {Object.} channelParameters parameters to the channel + */ +export function JetstreamPushSubscription(channelName, message, messageDescription, channelParameters) { + return ` + /** + * Push subscription to the \`${channelName}\` + * + * ${messageDescription} + * + * @param onDataCallback to call when messages are received + ${renderJSDocParameters(channelParameters)} + * @param flush ensure client is force flushed after subscribing + * @param options to subscribe with, bindings from the AsyncAPI document overwrite these if specified + */ + public jetStreamPushSubscribeTo${pascalCase(channelName)}( + onDataCallback: ( + err?: NatsTypescriptTemplateError, + msg?: ${getMessageType(message)} + ${realizeParametersForChannelWrapper(channelParameters, false)}, + jetstreamMsg?: Nats.JsMsg) => void + ${realizeParametersForChannelWrapper(channelParameters)}, + options: Nats.ConsumerOptsBuilder | Partial + ): Promise { + return new Promise(async (resolve, reject) => { + if (!this.isClosed() && this.nc !== undefined && this.codec !== undefined && this.js !== undefined) { + try { + const sub = await ${camelCase(channelName)}Channel.jetStreamPushSubscribe( + onDataCallback, + this.js, + this.codec, + ${Object.keys(channelParameters).length ? `${realizeParametersForChannelWithoutType(channelParameters)},` : ''} + options + ); + resolve(sub); + } catch (e: any) { + reject(e); + } + } else { + reject(NatsTypescriptTemplateError.errorForCode(ErrorCode.NOT_CONNECTED)); + } + }); + } + `; +} diff --git a/examples/simple-publish/asyncapi-nats-client/API.md b/examples/simple-publish/asyncapi-nats-client/API.md index 26a270643..54b059d9e 100644 --- a/examples/simple-publish/asyncapi-nats-client/API.md +++ b/examples/simple-publish/asyncapi-nats-client/API.md @@ -195,6 +195,7 @@ The test/mirror client which is the reverse to the normal NatsAsyncApiClient. * [.connectToLocal()](#NatsAsyncApiTestClient+connectToLocal) * [.subscribeToStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, flush, options)](#NatsAsyncApiTestClient+subscribeToStreetlightStreetlightIdCommandTurnon) * [.jetStreamPullStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, options)](#NatsAsyncApiTestClient+jetStreamPullStreetlightStreetlightIdCommandTurnon) + * [.jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, flush, options)](#NatsAsyncApiTestClient+jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon) @@ -296,3 +297,19 @@ Channel for the turn on command which should turn on the streetlight | streetlight_id | parameter to use in topic | | options | to pull message with, bindings from the AsyncAPI document overwrite these if specified | + + +### natsAsyncApiTestClient.jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, flush, options) +Push subscription to the `streetlight/{streetlight_id}/command/turnon` + +Channel for the turn on command which should turn on the streetlight + +**Kind**: instance method of [NatsAsyncApiTestClient](#NatsAsyncApiTestClient) + +| Param | Description | +| --- | --- | +| onDataCallback | to call when messages are received | +| streetlight_id | parameter to use in topic | +| flush | ensure client is force flushed after subscribing | +| options | to subscribe with, bindings from the AsyncAPI document overwrite these if specified | + diff --git a/examples/simple-publish/asyncapi-nats-client/src/testclient/index.ts b/examples/simple-publish/asyncapi-nats-client/src/testclient/index.ts index ca93db899..625c6e085 100644 --- a/examples/simple-publish/asyncapi-nats-client/src/testclient/index.ts +++ b/examples/simple-publish/asyncapi-nats-client/src/testclient/index.ts @@ -174,4 +174,40 @@ export class NatsAsyncApiTestClient { throw NatsTypescriptTemplateError.errorForCode(ErrorCode.NOT_CONNECTED); } } + /** + * Push subscription to the `streetlight/{streetlight_id}/command/turnon` + * + * Channel for the turn on command which should turn on the streetlight + * + * @param onDataCallback to call when messages are received + * @param streetlight_id parameter to use in topic + * @param flush ensure client is force flushed after subscribing + * @param options to subscribe with, bindings from the AsyncAPI document overwrite these if specified + */ + public jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon( + onDataCallback: ( + err ? : NatsTypescriptTemplateError, + msg ? : TurnOn, streetlight_id ? : string, + jetstreamMsg ? : Nats.JsMsg) => void, streetlight_id: string, + options: Nats.ConsumerOptsBuilder | Partial < Nats.ConsumerOpts > + ): Promise < Nats.JetStreamSubscription > { + return new Promise(async (resolve, reject) => { + if (!this.isClosed() && this.nc !== undefined && this.codec !== undefined && this.js !== undefined) { + try { + const sub = await streetlightStreetlightIdCommandTurnonChannel.jetStreamPushSubscribe( + onDataCallback, + this.js, + this.codec, + streetlight_id, + options + ); + resolve(sub); + } catch (e: any) { + reject(e); + } + } else { + reject(NatsTypescriptTemplateError.errorForCode(ErrorCode.NOT_CONNECTED)); + } + }); + } } \ No newline at end of file diff --git a/examples/simple-publish/asyncapi-nats-client/src/testclient/testchannels/StreetlightStreetlightIdCommandTurnon.ts b/examples/simple-publish/asyncapi-nats-client/src/testclient/testchannels/StreetlightStreetlightIdCommandTurnon.ts index 95dec16f4..f63c1f6d2 100644 --- a/examples/simple-publish/asyncapi-nats-client/src/testclient/testchannels/StreetlightStreetlightIdCommandTurnon.ts +++ b/examples/simple-publish/asyncapi-nats-client/src/testclient/testchannels/StreetlightStreetlightIdCommandTurnon.ts @@ -86,4 +86,48 @@ export function jetStreamPull( let receivedData: any = codec.decode(msg.data); onDataCallback(undefined, TurnOn.unmarshal(receivedData), streetlightIdParam, msg); })(); +} +/** + * Internal functionality to setup jetstream push subscription on the `streetlight/{streetlight_id}/command/turnon` channel + * + * @param onDataCallback to call when messages are received + * @param nc to subscribe with + * @param codec used to convert messages + * @param streetlight_id parameter to use in topic + * @param options to subscribe with, bindings from the AsyncAPI document overwrite these if specified + */ +export function jetStreamPushSubscribe( + onDataCallback: ( + err ? : NatsTypescriptTemplateError, + msg ? : TurnOn, streetlight_id ? : string, + jetstreamMsg ? : Nats.JsMsg) => void, + js: Nats.JetStreamClient, + codec: Nats.Codec < any > , streetlight_id: string, + options: Nats.ConsumerOptsBuilder | Partial < Nats.ConsumerOpts > +): Promise < Nats.JetStreamSubscription > { + return new Promise(async (resolve, reject) => { + try { + let subscription = js.subscribe(`streetlight.${streetlight_id}.command.turnon`, options); + (async () => { + for await (const msg of await subscription) { + const unmodifiedChannel = `streetlight.{streetlight_id}.command.turnon`; + let channel = msg.subject; + const streetlightIdSplit = unmodifiedChannel.split("{streetlight_id}"); + const splits = [ + streetlightIdSplit[0], + streetlightIdSplit[1] + ]; + channel = channel.substring(splits[0].length); + const streetlightIdEnd = channel.indexOf(splits[1]); + const streetlightIdParam = "" + channel.substring(0, streetlightIdEnd); + let receivedData: any = codec.decode(msg.data); + onDataCallback(undefined, TurnOn.unmarshal(receivedData), streetlightIdParam); + } + console.log("subscription closed"); + })(); + resolve(subscription); + } catch (e: any) { + reject(NatsTypescriptTemplateError.errorForCode(ErrorCode.INTERNAL_NATS_TS_ERROR, e)); + } + }) } \ No newline at end of file diff --git a/examples/simple-subscribe/asyncapi-nats-client/API.md b/examples/simple-subscribe/asyncapi-nats-client/API.md index 969b5d8e8..758be83b9 100644 --- a/examples/simple-subscribe/asyncapi-nats-client/API.md +++ b/examples/simple-subscribe/asyncapi-nats-client/API.md @@ -28,6 +28,7 @@ Module which wraps functionality for the `streetlight/{streetlight_id}/command/t * [streetlightStreetlightIdCommandTurnon](#module_streetlightStreetlightIdCommandTurnon) * [~subscribe(onDataCallback, nc, codec, streetlight_id, options)](#module_streetlightStreetlightIdCommandTurnon..subscribe) * [~jetStreamPull(onDataCallback, js, codec, streetlight_id)](#module_streetlightStreetlightIdCommandTurnon..jetStreamPull) + * [~jetStreamPushSubscribe(onDataCallback, nc, codec, streetlight_id, options)](#module_streetlightStreetlightIdCommandTurnon..jetStreamPushSubscribe) @@ -58,6 +59,21 @@ Internal functionality to setup jetstrema pull on the `streetlight/{streetlight_ | codec | used to convert messages | | streetlight_id | parameter to use in topic | + + +### streetlightStreetlightIdCommandTurnon~jetStreamPushSubscribe(onDataCallback, nc, codec, streetlight_id, options) +Internal functionality to setup jetstream push subscription on the `streetlight/{streetlight_id}/command/turnon` channel + +**Kind**: inner method of [streetlightStreetlightIdCommandTurnon](#module_streetlightStreetlightIdCommandTurnon) + +| Param | Description | +| --- | --- | +| onDataCallback | to call when messages are received | +| nc | to subscribe with | +| codec | used to convert messages | +| streetlight_id | parameter to use in topic | +| options | to subscribe with, bindings from the AsyncAPI document overwrite these if specified | + ## NatsAsyncApiClient @@ -77,6 +93,7 @@ The generated client based on your AsyncAPI document. * [.connectToLocal()](#NatsAsyncApiClient+connectToLocal) * [.subscribeToStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, flush, options)](#NatsAsyncApiClient+subscribeToStreetlightStreetlightIdCommandTurnon) * [.jetStreamPullStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, options)](#NatsAsyncApiClient+jetStreamPullStreetlightStreetlightIdCommandTurnon) + * [.jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, flush, options)](#NatsAsyncApiClient+jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon) @@ -178,6 +195,22 @@ Channel for the turn on command which should turn on the streetlight | streetlight_id | parameter to use in topic | | options | to pull message with, bindings from the AsyncAPI document overwrite these if specified | + + +### natsAsyncApiClient.jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon(onDataCallback, streetlight_id, flush, options) +Push subscription to the `streetlight/{streetlight_id}/command/turnon` + +Channel for the turn on command which should turn on the streetlight + +**Kind**: instance method of [NatsAsyncApiClient](#NatsAsyncApiClient) + +| Param | Description | +| --- | --- | +| onDataCallback | to call when messages are received | +| streetlight_id | parameter to use in topic | +| flush | ensure client is force flushed after subscribing | +| options | to subscribe with, bindings from the AsyncAPI document overwrite these if specified | + ## NatsAsyncApiTestClient diff --git a/examples/simple-subscribe/asyncapi-nats-client/src/channels/StreetlightStreetlightIdCommandTurnon.ts b/examples/simple-subscribe/asyncapi-nats-client/src/channels/StreetlightStreetlightIdCommandTurnon.ts index cd195a812..8c20a7367 100644 --- a/examples/simple-subscribe/asyncapi-nats-client/src/channels/StreetlightStreetlightIdCommandTurnon.ts +++ b/examples/simple-subscribe/asyncapi-nats-client/src/channels/StreetlightStreetlightIdCommandTurnon.ts @@ -86,4 +86,48 @@ export function jetStreamPull( let receivedData: any = codec.decode(msg.data); onDataCallback(undefined, TurnOn.unmarshal(receivedData), streetlightIdParam, msg); })(); +} +/** + * Internal functionality to setup jetstream push subscription on the `streetlight/{streetlight_id}/command/turnon` channel + * + * @param onDataCallback to call when messages are received + * @param nc to subscribe with + * @param codec used to convert messages + * @param streetlight_id parameter to use in topic + * @param options to subscribe with, bindings from the AsyncAPI document overwrite these if specified + */ +export function jetStreamPushSubscribe( + onDataCallback: ( + err ? : NatsTypescriptTemplateError, + msg ? : TurnOn, streetlight_id ? : string, + jetstreamMsg ? : Nats.JsMsg) => void, + js: Nats.JetStreamClient, + codec: Nats.Codec < any > , streetlight_id: string, + options: Nats.ConsumerOptsBuilder | Partial < Nats.ConsumerOpts > +): Promise < Nats.JetStreamSubscription > { + return new Promise(async (resolve, reject) => { + try { + let subscription = js.subscribe(`streetlight.${streetlight_id}.command.turnon`, options); + (async () => { + for await (const msg of await subscription) { + const unmodifiedChannel = `streetlight.{streetlight_id}.command.turnon`; + let channel = msg.subject; + const streetlightIdSplit = unmodifiedChannel.split("{streetlight_id}"); + const splits = [ + streetlightIdSplit[0], + streetlightIdSplit[1] + ]; + channel = channel.substring(splits[0].length); + const streetlightIdEnd = channel.indexOf(splits[1]); + const streetlightIdParam = "" + channel.substring(0, streetlightIdEnd); + let receivedData: any = codec.decode(msg.data); + onDataCallback(undefined, TurnOn.unmarshal(receivedData), streetlightIdParam); + } + console.log("subscription closed"); + })(); + resolve(subscription); + } catch (e: any) { + reject(NatsTypescriptTemplateError.errorForCode(ErrorCode.INTERNAL_NATS_TS_ERROR, e)); + } + }) } \ No newline at end of file diff --git a/examples/simple-subscribe/asyncapi-nats-client/src/index.ts b/examples/simple-subscribe/asyncapi-nats-client/src/index.ts index e699a1caf..26e2aaa2b 100644 --- a/examples/simple-subscribe/asyncapi-nats-client/src/index.ts +++ b/examples/simple-subscribe/asyncapi-nats-client/src/index.ts @@ -182,4 +182,40 @@ export class NatsAsyncApiClient { throw NatsTypescriptTemplateError.errorForCode(ErrorCode.NOT_CONNECTED); } } + /** + * Push subscription to the `streetlight/{streetlight_id}/command/turnon` + * + * Channel for the turn on command which should turn on the streetlight + * + * @param onDataCallback to call when messages are received + * @param streetlight_id parameter to use in topic + * @param flush ensure client is force flushed after subscribing + * @param options to subscribe with, bindings from the AsyncAPI document overwrite these if specified + */ + public jetStreamPushSubscribeToStreetlightStreetlightIdCommandTurnon( + onDataCallback: ( + err ? : NatsTypescriptTemplateError, + msg ? : TurnOn, streetlight_id ? : string, + jetstreamMsg ? : Nats.JsMsg) => void, streetlight_id: string, + options: Nats.ConsumerOptsBuilder | Partial < Nats.ConsumerOpts > + ): Promise < Nats.JetStreamSubscription > { + return new Promise(async (resolve, reject) => { + if (!this.isClosed() && this.nc !== undefined && this.codec !== undefined && this.js !== undefined) { + try { + const sub = await streetlightStreetlightIdCommandTurnonChannel.jetStreamPushSubscribe( + onDataCallback, + this.js, + this.codec, + streetlight_id, + options + ); + resolve(sub); + } catch (e: any) { + reject(e); + } + } else { + reject(NatsTypescriptTemplateError.errorForCode(ErrorCode.NOT_CONNECTED)); + } + }); + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index efa498896..5209cface 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2925,7 +2925,7 @@ "asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", "dev": true }, "asn1": { @@ -2940,7 +2940,7 @@ "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", "dev": true }, "astral-regex": { @@ -2964,7 +2964,7 @@ "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", "dev": true }, "aws4": { @@ -3180,7 +3180,7 @@ "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", "dev": true, "requires": { "tweetnacl": "^0.14.3" @@ -3280,7 +3280,7 @@ "builtins": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", - "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "integrity": "sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==", "dev": true }, "cacache": { @@ -3394,7 +3394,7 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "dev": true }, "chalk": { @@ -3515,7 +3515,7 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", "dev": true }, "collect-v8-coverage": { @@ -3590,7 +3590,7 @@ "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", "dev": true }, "constant-case": { @@ -3814,7 +3814,7 @@ "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", "dev": true, "requires": { "assert-plus": "^1.0.0" @@ -3848,7 +3848,7 @@ "debuglog": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", - "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", + "integrity": "sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==", "dev": true }, "decamelize": { @@ -3949,13 +3949,13 @@ "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", "dev": true }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", "dev": true }, "deprecation": { @@ -4056,7 +4056,7 @@ "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", "dev": true, "requires": { "jsbn": "~0.1.0", @@ -4636,7 +4636,7 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", "dev": true }, "fast-deep-equal": { @@ -4772,13 +4772,13 @@ "foreachasync": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz", - "integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=", + "integrity": "sha512-J+ler7Ta54FwwNcx6wQRDhTIbNeyDcARMkOcguEqnEdtm0jKvN3Li3PDAb2Du3ubJYEWfYL83XMROXdsXAXycw==", "dev": true }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", "dev": true }, "form-data": { @@ -4825,7 +4825,7 @@ "fs.extra": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fs.extra/-/fs.extra-1.3.2.tgz", - "integrity": "sha1-3QI/kwE77iRTHxszUUw3sg/ZM0k=", + "integrity": "sha512-Ig401VXtyrWrz23k9KxAx9OrnL8AHSLNhQ8YJH2wSYuH0ZUfxwBeY6zXkd/oOyVRFTlpEu/0n5gHeuZt7aqbkw==", "dev": true, "requires": { "fs-extra": "~0.6.1", @@ -4836,7 +4836,7 @@ "fs-extra": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.6.4.tgz", - "integrity": "sha1-9G8MdbeEH40gCzNIzU1pHVoJnRU=", + "integrity": "sha512-5rU898vl/Z948L+kkJedbmo/iltzmiF5bn/eEk0j/SgrPpI+Ydau9xlJPicV7Av2CHYBGz5LAlwTnBU80j1zPQ==", "dev": true, "requires": { "jsonfile": "~1.0.1", @@ -4848,19 +4848,19 @@ "jsonfile": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-1.0.1.tgz", - "integrity": "sha1-6l7+QLg2kLmGZ2FKc5L8YOhCwN0=", + "integrity": "sha512-KbsDJNRfRPF5v49tMNf9sqyyGqGLBcz1v5kZT01kG5ns5mQSltwxCKVmUzVKtEinkUnTDtSrp6ngWpV7Xw0ZlA==", "dev": true }, "mkdirp": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", - "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=", + "integrity": "sha512-8OCq0De/h9ZxseqzCH8Kw/Filf5pF/vMI6+BH7Lu0jXz2pqYCjTAQRolSxRIi+Ax+oCCjlxoJMP0YQ4XlrQNHg==", "dev": true }, "rimraf": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "integrity": "sha512-R5KMKHnPAQaZMqLOsyuyUmcIjSeDm+73eoqQpaXA7AZ22BL+6C+1mcUscgOsNd8WVlJuvlgAPsegcx7pjlV0Dg==", "dev": true } } @@ -4890,7 +4890,7 @@ "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==", "dev": true, "requires": { "aproba": "^1.0.3", @@ -4906,13 +4906,13 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", "dev": true }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", "dev": true, "requires": { "number-is-nan": "^1.0.0" @@ -4921,7 +4921,7 @@ "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -4932,7 +4932,7 @@ "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -4978,7 +4978,7 @@ "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", "dev": true, "requires": { "assert-plus": "^1.0.0" @@ -5094,7 +5094,7 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", "dev": true }, "har-validator": { @@ -5134,7 +5134,7 @@ "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", "dev": true }, "header-case": { @@ -5196,7 +5196,7 @@ "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", "dev": true, "requires": { "assert-plus": "^1.0.0", @@ -5223,7 +5223,7 @@ "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", "dev": true, "requires": { "ms": "^2.0.0" @@ -5441,7 +5441,7 @@ "is-lambda": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=", + "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "dev": true }, "is-negative-zero": { @@ -5556,7 +5556,7 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", "dev": true }, "issue-parser": { @@ -7082,7 +7082,7 @@ "jmespath": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", - "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=", + "integrity": "sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w==", "dev": true }, "js-beautify": { @@ -7114,7 +7114,7 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", "dev": true }, "jsdom": { @@ -7849,7 +7849,7 @@ "ncp": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz", - "integrity": "sha1-q8xsvT7C7Spyn/bnwfqPAXhKhXQ=", + "integrity": "sha512-PfGU8jYWdRl4FqJfCy0IzbkGyFHntfWygZg46nFk/dJD/XRrk2cj0SsKSX9n5u5gE0E0YfEpKWrEkfjnlZSTXA==", "dev": true }, "negotiator": { @@ -10196,7 +10196,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "dev": true }, "nunjucks": { @@ -10534,7 +10534,7 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", "dev": true }, "picomatch": { @@ -10689,7 +10689,7 @@ "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", "dev": true }, "promise-retry": { @@ -11165,7 +11165,7 @@ "retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", "dev": true }, "reusify": { @@ -13208,7 +13208,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, "shebang-command": { @@ -13918,7 +13918,7 @@ "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", "dev": true, "requires": { "safe-buffer": "^5.0.1" @@ -13927,7 +13927,7 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", "dev": true }, "type-check": { @@ -14155,7 +14155,7 @@ "validate-npm-package-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", - "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "integrity": "sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==", "dev": true, "requires": { "builtins": "^1.0.3" @@ -14169,7 +14169,7 @@ "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", "dev": true, "requires": { "assert-plus": "^1.0.0", diff --git a/template/src/channels/$$channel$$.ts.js b/template/src/channels/$$channel$$.ts.js index d22ac8bd6..8a16c7c86 100644 --- a/template/src/channels/$$channel$$.ts.js +++ b/template/src/channels/$$channel$$.ts.js @@ -7,6 +7,7 @@ import { General } from '../../../components/channel/general'; import { pascalCase, isRequestReply, isReplier, isRequester, isPubsub, camelCase} from '../../../utils/index'; // eslint-disable-next-line no-unused-vars import { AsyncAPIDocument, Channel } from '@asyncapi/parser'; +import { JetstreamPushSubscription } from '../../../components/channel/jetstreamPushSubscription'; import { JetstreamPull } from '../../../components/channel/jetstreamPull'; import { JetstreamPublish } from '../../../components/channel/jetstreamPublish'; @@ -76,11 +77,16 @@ function getChannelCode(channel, channelName, params) { publishMessage, channel.parameters(), publishOperation); + const jetstreamPushSubscriptionCode = JetstreamPushSubscription( + channelName, + publishMessage, + channel.parameters(), + publishOperation); const jetstreamPullCode = JetstreamPull( channelName, publishMessage, channel.parameters()); - channelcode = `${normalSubscribeCode}\n${jetstreamPullCode}`; + channelcode = `${normalSubscribeCode}\n${jetstreamPullCode}\n${jetstreamPushSubscriptionCode}`; } } return channelcode; diff --git a/template/src/index.ts.js b/template/src/index.ts.js index 66f10dc9d..ff3baaa08 100644 --- a/template/src/index.ts.js +++ b/template/src/index.ts.js @@ -7,6 +7,7 @@ import { Request } from '../../components/index/request'; import { isRequestReply, isReplier, isRequester, isPubsub} from '../../utils/index'; // eslint-disable-next-line no-unused-vars import { AsyncAPIDocument } from '@asyncapi/parser'; +import { JetstreamPushSubscription } from '../../components/index/jetstreamPushSubscription'; import { JetstreamPull } from '../../components/index/jetstreamPull'; import { JetstreamPublish } from '../../components/index/jetstreamPublish'; @@ -81,12 +82,17 @@ function getChannelWrappers(asyncapi, params) { publishMessage, channelDescription, channelParameters); + const jetstreamPushSubscriptionCode = JetstreamPushSubscription( + channelName, + publishMessage, + channelDescription, + channelParameters); const jetstreamPullCode = JetstreamPull( channelName, publishMessage, channelDescription, channelParameters); - return `${normalSubscribeCode}\n${jetstreamPullCode}`; + return `${normalSubscribeCode}\n${jetstreamPullCode}\n${jetstreamPushSubscriptionCode}`; } } }); diff --git a/template/src/testclient/index.ts.js b/template/src/testclient/index.ts.js index 01eeaa399..e6fdb2bdc 100644 --- a/template/src/testclient/index.ts.js +++ b/template/src/testclient/index.ts.js @@ -7,6 +7,7 @@ import { Request } from '../../../components/index/request'; import { isRequestReply, isReplier, isRequester, isPubsub} from '../../../utils/index'; // eslint-disable-next-line no-unused-vars import { AsyncAPIDocument, ChannelParameter } from '@asyncapi/parser'; +import { JetstreamPushSubscription } from '../../../components/index/jetstreamPushSubscription'; import { JetstreamPull } from '../../../components/index/jetstreamPull'; import { JetstreamPublish } from '../../../components/index/jetstreamPublish'; @@ -67,12 +68,17 @@ function getChannelWrappers(asyncapi, params) { subscribeMessage, channelDescription, channelParameters); + const jetstreamPushSubscriptionCode = JetstreamPushSubscription( + channelName, + subscribeMessage, + channelDescription, + channelParameters); const jetstreamPullCode = JetstreamPull( channelName, subscribeMessage, channelDescription, channelParameters); - return `${normalSubscribeCode}\n${jetstreamPullCode}`; + return `${normalSubscribeCode}\n${jetstreamPullCode}\n${jetstreamPushSubscriptionCode}`; } if (channel.hasPublish()) { const normalPublish = Publish( diff --git a/template/src/testclient/testchannels/$$channel$$.ts.js b/template/src/testclient/testchannels/$$channel$$.ts.js index f3a275264..7885682b1 100644 --- a/template/src/testclient/testchannels/$$channel$$.ts.js +++ b/template/src/testclient/testchannels/$$channel$$.ts.js @@ -7,6 +7,7 @@ import { General } from '../../../../components/channel/general'; import { pascalCase, isRequestReply, isReplier, isRequester, isPubsub, camelCase} from '../../../../utils/index'; // eslint-disable-next-line no-unused-vars import { AsyncAPIDocument, Channel } from '@asyncapi/parser'; +import { JetstreamPushSubscription } from '../../../../components/channel/jetstreamPushSubscription'; import { JetstreamPull } from '../../../../components/channel/jetstreamPull'; import { JetstreamPublish } from '../../../../components/channel/jetstreamPublish'; @@ -63,11 +64,15 @@ function getChannelCode(channel, channelName, params) { channelName, channel.subscribe() ? channel.subscribe().message(0) : undefined, channel.parameters()); + const jetstreamPushSubscriptionCode = JetstreamPushSubscription( + channelName, + channel.subscribe() ? channel.subscribe().message(0) : undefined, + channel.parameters()); const jetstreamPullCode = JetstreamPull( channelName, channel.subscribe() ? channel.subscribe().message(0) : undefined, channel.parameters()); - channelcode = `${normalSubscribeCode}\n${jetstreamPullCode}`; + channelcode = `${normalSubscribeCode}\n${jetstreamPullCode}\n${jetstreamPushSubscriptionCode}`; } if (channel.hasPublish()) { const publishCode = Publish(