@wix/auto_sdk_duplexer_publisher 1.0.8 → 1.0.10

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.
@@ -51,10 +51,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
51
51
  }
52
52
  ],
53
53
  "www.wixapis.com": [
54
- {
55
- srcPath: "/realtime",
56
- destPath: ""
57
- },
58
54
  {
59
55
  srcPath: "/realtime/v4/publish",
60
56
  destPath: "/v4/publish"
@@ -75,7 +71,7 @@ function publish(payload) {
75
71
  optInTransformResponse: true
76
72
  },
77
73
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
78
- protoPath: "/publish",
74
+ protoPath: "/v4/publish",
79
75
  data: payload,
80
76
  host
81
77
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.public.ts","../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,IAAAC,uBAAiC;AAG1B,IAAMC,WAEK,2DAAiBA,QAAa;","names":["publish","publish","sdkTransformError","publish","import_rest_modules","publish"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.public.ts","../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,IAAAC,uBAAiC;AAG1B,IAAMC,WAEK,2DAAiBA,QAAa;","names":["publish","publish","sdkTransformError","publish","import_rest_modules","publish"]}
@@ -19,7 +19,7 @@ interface Message {
19
19
  }
20
20
  interface PublisherInfo {
21
21
  /**
22
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
22
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
23
23
  * @maxLength 1000
24
24
  */
25
25
  uid?: string;
@@ -33,7 +33,7 @@ interface PublishRequest {
33
33
  */
34
34
  channels: string[];
35
35
  /**
36
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
36
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
37
37
  * @maxLength 1000
38
38
  */
39
39
  resourceId?: string | null;
@@ -85,7 +85,7 @@ interface PublishOptions {
85
85
  */
86
86
  channels: string[];
87
87
  /**
88
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
88
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
89
89
  * @maxLength 1000
90
90
  */
91
91
  resourceId?: string | null;
@@ -51,10 +51,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
51
51
  }
52
52
  ],
53
53
  "www.wixapis.com": [
54
- {
55
- srcPath: "/realtime",
56
- destPath: ""
57
- },
58
54
  {
59
55
  srcPath: "/realtime/v4/publish",
60
56
  destPath: "/v4/publish"
@@ -75,7 +71,7 @@ function publish(payload) {
75
71
  optInTransformResponse: true
76
72
  },
77
73
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
78
- protoPath: "/publish",
74
+ protoPath: "/v4/publish",
79
75
  data: payload,
80
76
  host
81
77
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.typings.ts","../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish","publish","sdkTransformError"]}
1
+ {"version":3,"sources":["../../index.typings.ts","../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish","publish","sdkTransformError"]}
@@ -20,7 +20,7 @@ interface Message {
20
20
  }
21
21
  interface PublisherInfo {
22
22
  /**
23
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
23
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
24
24
  * @maxLength 1000
25
25
  */
26
26
  uid?: string;
@@ -34,7 +34,7 @@ interface PublishRequest {
34
34
  */
35
35
  channels: string[];
36
36
  /**
37
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
37
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
38
38
  * @maxLength 1000
39
39
  */
40
40
  resourceId?: string | null;
package/build/cjs/meta.js CHANGED
@@ -47,10 +47,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
47
47
  }
48
48
  ],
49
49
  "www.wixapis.com": [
50
- {
51
- srcPath: "/realtime",
52
- destPath: ""
53
- },
54
50
  {
55
51
  srcPath: "/realtime/v4/publish",
56
52
  destPath: "/v4/publish"
@@ -71,7 +67,7 @@ function publish(payload) {
71
67
  optInTransformResponse: true
72
68
  },
73
69
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
74
- protoPath: "/publish",
70
+ protoPath: "/v4/publish",
75
71
  data: payload,
76
72
  host
77
73
  }),
@@ -93,7 +89,7 @@ function publish2() {
93
89
  return {
94
90
  getUrl,
95
91
  httpMethod: "POST",
96
- path: "/publish",
92
+ path: "/v4/publish",
97
93
  pathParams: {},
98
94
  __requestType: null,
99
95
  __originalRequestType: null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../meta.ts","../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC3CO,SAASC,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish","publish"]}
1
+ {"version":3,"sources":["../../meta.ts","../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v4/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACvCO,SAASC,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish","publish"]}
@@ -25,10 +25,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
25
25
  }
26
26
  ],
27
27
  "www.wixapis.com": [
28
- {
29
- srcPath: "/realtime",
30
- destPath: ""
31
- },
32
28
  {
33
29
  srcPath: "/realtime/v4/publish",
34
30
  destPath: "/v4/publish"
@@ -49,7 +45,7 @@ function publish(payload) {
49
45
  optInTransformResponse: true
50
46
  },
51
47
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
52
- protoPath: "/publish",
48
+ protoPath: "/v4/publish",
53
49
  data: payload,
54
50
  host
55
51
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.public.ts","../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,SAAS,wBAAwB;AAG1B,IAAMC,WAEK,iCAAiBA,QAAa;","names":["publish","publish","publish"]}
1
+ {"version":3,"sources":["../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.public.ts","../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,SAAS,wBAAwB;AAG1B,IAAMC,WAEK,iCAAiBA,QAAa;","names":["publish","publish","publish"]}
@@ -19,7 +19,7 @@ interface Message {
19
19
  }
20
20
  interface PublisherInfo {
21
21
  /**
22
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
22
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
23
23
  * @maxLength 1000
24
24
  */
25
25
  uid?: string;
@@ -33,7 +33,7 @@ interface PublishRequest {
33
33
  */
34
34
  channels: string[];
35
35
  /**
36
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
36
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
37
37
  * @maxLength 1000
38
38
  */
39
39
  resourceId?: string | null;
@@ -85,7 +85,7 @@ interface PublishOptions {
85
85
  */
86
86
  channels: string[];
87
87
  /**
88
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
88
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
89
89
  * @maxLength 1000
90
90
  */
91
91
  resourceId?: string | null;
@@ -25,10 +25,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
25
25
  }
26
26
  ],
27
27
  "www.wixapis.com": [
28
- {
29
- srcPath: "/realtime",
30
- destPath: ""
31
- },
32
28
  {
33
29
  srcPath: "/realtime/v4/publish",
34
30
  destPath: "/v4/publish"
@@ -49,7 +45,7 @@ function publish(payload) {
49
45
  optInTransformResponse: true
50
46
  },
51
47
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
52
- protoPath: "/publish",
48
+ protoPath: "/v4/publish",
53
49
  data: payload,
54
50
  host
55
51
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish"]}
1
+ {"version":3,"sources":["../../src/realtime-v4-message-publisher.universal.ts","../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish"]}
@@ -20,7 +20,7 @@ interface Message {
20
20
  }
21
21
  interface PublisherInfo {
22
22
  /**
23
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
23
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
24
24
  * @maxLength 1000
25
25
  */
26
26
  uid?: string;
@@ -34,7 +34,7 @@ interface PublishRequest {
34
34
  */
35
35
  channels: string[];
36
36
  /**
37
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
37
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
38
38
  * @maxLength 1000
39
39
  */
40
40
  resourceId?: string | null;
package/build/es/meta.mjs CHANGED
@@ -21,10 +21,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
21
21
  }
22
22
  ],
23
23
  "www.wixapis.com": [
24
- {
25
- srcPath: "/realtime",
26
- destPath: ""
27
- },
28
24
  {
29
25
  srcPath: "/realtime/v4/publish",
30
26
  destPath: "/v4/publish"
@@ -45,7 +41,7 @@ function publish(payload) {
45
41
  optInTransformResponse: true
46
42
  },
47
43
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
48
- protoPath: "/publish",
44
+ protoPath: "/v4/publish",
49
45
  data: payload,
50
46
  host
51
47
  }),
@@ -67,7 +63,7 @@ function publish2() {
67
63
  return {
68
64
  getUrl,
69
65
  httpMethod: "POST",
70
- path: "/publish",
66
+ path: "/v4/publish",
71
67
  pathParams: {},
72
68
  __requestType: null,
73
69
  __originalRequestType: null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC3CO,SAASA,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish"]}
1
+ {"version":3,"sources":["../../src/realtime-v4-message-publisher.http.ts","../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v4/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACvCO,SAASA,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish"]}
@@ -51,10 +51,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
51
51
  }
52
52
  ],
53
53
  "www.wixapis.com": [
54
- {
55
- srcPath: "/realtime",
56
- destPath: ""
57
- },
58
54
  {
59
55
  srcPath: "/realtime/v4/publish",
60
56
  destPath: "/v4/publish"
@@ -75,7 +71,7 @@ function publish(payload) {
75
71
  optInTransformResponse: true
76
72
  },
77
73
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
78
- protoPath: "/publish",
74
+ protoPath: "/v4/publish",
79
75
  data: payload,
80
76
  host
81
77
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../index.ts","../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.public.ts","../../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,IAAAC,uBAAiC;AAG1B,IAAMC,WAEK,2DAAiBA,QAAa;","names":["publish","publish","sdkTransformError","publish","import_rest_modules","publish"]}
1
+ {"version":3,"sources":["../../../index.ts","../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.public.ts","../../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,IAAAC,uBAAiC;AAG1B,IAAMC,WAEK,2DAAiBA,QAAa;","names":["publish","publish","sdkTransformError","publish","import_rest_modules","publish"]}
@@ -19,7 +19,7 @@ interface Message {
19
19
  }
20
20
  interface PublisherInfo {
21
21
  /**
22
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
22
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
23
23
  * @maxLength 1000
24
24
  */
25
25
  uid?: string;
@@ -33,7 +33,7 @@ interface PublishRequest {
33
33
  */
34
34
  channels: string[];
35
35
  /**
36
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
36
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
37
37
  * @maxLength 1000
38
38
  */
39
39
  resourceId?: string | null;
@@ -85,7 +85,7 @@ interface PublishOptions {
85
85
  */
86
86
  channels: string[];
87
87
  /**
88
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
88
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
89
89
  * @maxLength 1000
90
90
  */
91
91
  resourceId?: string | null;
@@ -51,10 +51,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
51
51
  }
52
52
  ],
53
53
  "www.wixapis.com": [
54
- {
55
- srcPath: "/realtime",
56
- destPath: ""
57
- },
58
54
  {
59
55
  srcPath: "/realtime/v4/publish",
60
56
  destPath: "/v4/publish"
@@ -75,7 +71,7 @@ function publish(payload) {
75
71
  optInTransformResponse: true
76
72
  },
77
73
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
78
- protoPath: "/publish",
74
+ protoPath: "/v4/publish",
79
75
  data: payload,
80
76
  host
81
77
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../index.typings.ts","../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish","publish","sdkTransformError"]}
1
+ {"version":3,"sources":["../../../index.typings.ts","../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAAsD;;;ACDtD,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBC,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish","publish","sdkTransformError"]}
@@ -20,7 +20,7 @@ interface Message {
20
20
  }
21
21
  interface PublisherInfo {
22
22
  /**
23
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
23
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
24
24
  * @maxLength 1000
25
25
  */
26
26
  uid?: string;
@@ -34,7 +34,7 @@ interface PublishRequest {
34
34
  */
35
35
  channels: string[];
36
36
  /**
37
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
37
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
38
38
  * @maxLength 1000
39
39
  */
40
40
  resourceId?: string | null;
@@ -47,10 +47,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
47
47
  }
48
48
  ],
49
49
  "www.wixapis.com": [
50
- {
51
- srcPath: "/realtime",
52
- destPath: ""
53
- },
54
50
  {
55
51
  srcPath: "/realtime/v4/publish",
56
52
  destPath: "/v4/publish"
@@ -71,7 +67,7 @@ function publish(payload) {
71
67
  optInTransformResponse: true
72
68
  },
73
69
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
74
- protoPath: "/publish",
70
+ protoPath: "/v4/publish",
75
71
  data: payload,
76
72
  host
77
73
  }),
@@ -93,7 +89,7 @@ function publish2() {
93
89
  return {
94
90
  getUrl,
95
91
  httpMethod: "POST",
96
- path: "/publish",
92
+ path: "/v4/publish",
97
93
  pathParams: {},
98
94
  __requestType: null,
99
95
  __originalRequestType: null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../meta.ts","../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC3CO,SAASC,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish","publish"]}
1
+ {"version":3,"sources":["../../../meta.ts","../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["export * from './src/realtime-v4-message-publisher.meta.js';\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v4/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iBAAAA;AAAA;AAAA;;;ACAA,0BAA2B;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACvCO,SAASC,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish","publish"]}
@@ -25,10 +25,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
25
25
  }
26
26
  ],
27
27
  "www.wixapis.com": [
28
- {
29
- srcPath: "/realtime",
30
- destPath: ""
31
- },
32
28
  {
33
29
  srcPath: "/realtime/v4/publish",
34
30
  destPath: "/v4/publish"
@@ -49,7 +45,7 @@ function publish(payload) {
49
45
  optInTransformResponse: true
50
46
  },
51
47
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
52
- protoPath: "/publish",
48
+ protoPath: "/v4/publish",
53
49
  data: payload,
54
50
  host
55
51
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.public.ts","../../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,SAAS,wBAAwB;AAG1B,IAAMC,WAEK,iCAAiBA,QAAa;","names":["publish","publish","publish"]}
1
+ {"version":3,"sources":["../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.public.ts","../../../src/realtime-v4-message-publisher.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n Message,\n PublishOptions,\n publish as universalPublish,\n} from './realtime-v4-message-publisher.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/duplexer' };\n\nexport function publish(httpClient: HttpClient): PublishSignature {\n return (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ) =>\n universalPublish(\n message,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PublishSignature {\n /** */\n (\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n ): Promise<void>;\n}\n\nexport {\n Message,\n PublishOptions,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n PublishToUserResponse,\n PublisherInfo,\n UserIdList,\n} from './realtime-v4-message-publisher.universal.js';\n","import { publish as publicPublish } from './realtime-v4-message-publisher.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const publish: MaybeContext<\n BuildRESTFunction<typeof publicPublish> & typeof publicPublish\n> = /*#__PURE__*/ createRESTModule(publicPublish);\n\nexport {\n Message,\n PublisherInfo,\n PublishRequest,\n PublishResponse,\n PublishToUserRequest,\n PublishToUserRequestTargetingOneOf,\n UserIdList,\n PublishToUserResponse,\n PublishOptions,\n} from './realtime-v4-message-publisher.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvHO,SAASC,SAAQ,YAA0C;AAChE,SAAO,CACL,SACA,YAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnBA,SAAS,wBAAwB;AAG1B,IAAMC,WAEK,iCAAiBA,QAAa;","names":["publish","publish","publish"]}
@@ -19,7 +19,7 @@ interface Message {
19
19
  }
20
20
  interface PublisherInfo {
21
21
  /**
22
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
22
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
23
23
  * @maxLength 1000
24
24
  */
25
25
  uid?: string;
@@ -33,7 +33,7 @@ interface PublishRequest {
33
33
  */
34
34
  channels: string[];
35
35
  /**
36
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
36
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
37
37
  * @maxLength 1000
38
38
  */
39
39
  resourceId?: string | null;
@@ -85,7 +85,7 @@ interface PublishOptions {
85
85
  */
86
86
  channels: string[];
87
87
  /**
88
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
88
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
89
89
  * @maxLength 1000
90
90
  */
91
91
  resourceId?: string | null;
@@ -25,10 +25,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
25
25
  }
26
26
  ],
27
27
  "www.wixapis.com": [
28
- {
29
- srcPath: "/realtime",
30
- destPath: ""
31
- },
32
28
  {
33
29
  srcPath: "/realtime/v4/publish",
34
30
  destPath: "/v4/publish"
@@ -49,7 +45,7 @@ function publish(payload) {
49
45
  optInTransformResponse: true
50
46
  },
51
47
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
52
- protoPath: "/publish",
48
+ protoPath: "/v4/publish",
53
49
  data: payload,
54
50
  host
55
51
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADuBA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish"]}
1
+ {"version":3,"sources":["../../../src/realtime-v4-message-publisher.universal.ts","../../../src/realtime-v4-message-publisher.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\n\nexport interface Message {\n /**\n * Unique message identifier\n * @readonly\n * @format GUID\n */\n _id?: string;\n /**\n * Event name, e.g \"product_added\"\n * @maxLength 1000\n */\n eventName?: string;\n /** Event payload, e.g { \"product_id\": \"123\", \"product_name\": \"Product 1\" } */\n payload?: Record<string, any> | null;\n /** Info regarding the publisher of the message */\n publisherInfo?: PublisherInfo;\n}\n\nexport interface PublisherInfo {\n /**\n * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.\n * @maxLength 1000\n */\n uid?: string;\n}\n\nexport interface PublishRequest {\n message: Message;\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface PublishResponse {}\n\nexport interface PublishToUserRequest\n extends PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n message?: Message;\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** @oneof */\nexport interface PublishToUserRequestTargetingOneOf {\n /** list of user ids to receive the message */\n includeRecipients?: UserIdList;\n /** list of user ids to exclude from receiving the message */\n excludeRecipients?: UserIdList;\n}\n\nexport interface UserIdList {\n /**\n * @maxSize 1000\n * @maxLength 1000\n */\n userId?: string[];\n}\n\nexport interface PublishToUserResponse {}\n\n/** @public\n * @requiredField message\n * @requiredField message.eventName\n * @requiredField message.payload\n * @requiredField options.channels\n * @permissionId realtime:v4:message:publish\n * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish\n */\nexport async function publish(\n message: NonNullablePaths<Message, `eventName` | `payload`, 2>,\n options?: NonNullablePaths<PublishOptions, `channels`, 2>\n): Promise<void> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n message: message,\n channels: options?.channels,\n resourceId: options?.resourceId,\n });\n\n const reqOpts = ambassadorWixRealtimeV4Message.publish(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n message: '$[0]',\n channels: '$[1].channels',\n resourceId: '$[1].resourceId',\n },\n singleArgumentUnchanged: false,\n },\n ['message', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PublishOptions {\n /**\n * Channel names to publish to, e.g [\"product_notifications\", \"site_notifications\"]\n * @maxSize 10\n * @maxLength 140\n */\n channels: string[];\n /**\n * Optional sub resource identifier, e.g \"important_notification\", only subscribers to this specific resource will receive the message.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD2BA,eAAsBA,SACpB,SACA,SACe;AAEf,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD;AAAA,IACA,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS;AAAA,EACvB,CAAC;AAED,QAAM,UAAyC,QAAQ,OAAO;AAE9D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAAA,EACjC,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,SAAS;AAAA,UACT,UAAU;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,SAAS;AAAA,IACvB;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["publish"]}
@@ -20,7 +20,7 @@ interface Message {
20
20
  }
21
21
  interface PublisherInfo {
22
22
  /**
23
- * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher
23
+ * Arbitrary string identifier for the publisher, can be used by subscribers to identify the publisher.
24
24
  * @maxLength 1000
25
25
  */
26
26
  uid?: string;
@@ -34,7 +34,7 @@ interface PublishRequest {
34
34
  */
35
35
  channels: string[];
36
36
  /**
37
- * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message
37
+ * Optional sub resource identifier, e.g "important_notification", only subscribers to this specific resource will receive the message.
38
38
  * @maxLength 1000
39
39
  */
40
40
  resourceId?: string | null;
@@ -21,10 +21,6 @@ function resolveComWixRealtimeV4DuplexerApiV4Url(opts) {
21
21
  }
22
22
  ],
23
23
  "www.wixapis.com": [
24
- {
25
- srcPath: "/realtime",
26
- destPath: ""
27
- },
28
24
  {
29
25
  srcPath: "/realtime/v4/publish",
30
26
  destPath: "/v4/publish"
@@ -45,7 +41,7 @@ function publish(payload) {
45
41
  optInTransformResponse: true
46
42
  },
47
43
  url: resolveComWixRealtimeV4DuplexerApiV4Url({
48
- protoPath: "/publish",
44
+ protoPath: "/v4/publish",
49
45
  data: payload,
50
46
  host
51
47
  }),
@@ -67,7 +63,7 @@ function publish2() {
67
63
  return {
68
64
  getUrl,
69
65
  httpMethod: "POST",
70
- path: "/publish",
66
+ path: "/v4/publish",
71
67
  pathParams: {},
72
68
  __requestType: null,
73
69
  __originalRequestType: null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime',\n destPath: '',\n },\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC3CO,SAASA,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish"]}
1
+ {"version":3,"sources":["../../../src/realtime-v4-message-publisher.http.ts","../../../src/realtime-v4-message-publisher.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixRealtimeV4DuplexerApiV4Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/_api/wix-duplexer-api',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/realtime/v4/publish',\n destPath: '/v4/publish',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_duplexer_publisher';\n\nexport function publish(payload: object): RequestOptionsFactory<any> {\n function __publish({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.realtime.v4.message',\n method: 'POST' as any,\n methodFqn: 'com.wix.realtime.v4.DuplexerApiV4.Publish',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveComWixRealtimeV4DuplexerApiV4Url({\n protoPath: '/v4/publish',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __publish;\n}\n","import * as ambassadorWixRealtimeV4Message from './realtime-v4-message-publisher.http.js';\nimport * as ambassadorWixRealtimeV4MessageTypes from './realtime-v4-message-publisher.types.js';\nimport * as ambassadorWixRealtimeV4MessageUniversalTypes from './realtime-v4-message-publisher.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function publish(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageTypes.PublishRequest,\n ambassadorWixRealtimeV4MessageUniversalTypes.PublishResponse,\n ambassadorWixRealtimeV4MessageTypes.PublishResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixRealtimeV4Message.publish(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v4/publish',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport {\n Message as MessageOriginal,\n PublisherInfo as PublisherInfoOriginal,\n PublishRequest as PublishRequestOriginal,\n PublishResponse as PublishResponseOriginal,\n PublishToUserRequest as PublishToUserRequestOriginal,\n PublishToUserRequestTargetingOneOf as PublishToUserRequestTargetingOneOfOriginal,\n UserIdList as UserIdListOriginal,\n PublishToUserResponse as PublishToUserResponseOriginal,\n} from './realtime-v4-message-publisher.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,wCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAEd,SAAS,QAAQ,SAA6C;AACnE,WAAS,UAAU,EAAE,KAAK,GAAQ;AAChC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wCAAwC;AAAA,QAC3C,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ACvCO,SAASA,WAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAmD,QAAQ,OAAO;AAExE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["publish"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/auto_sdk_duplexer_publisher",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -50,5 +50,5 @@
50
50
  "fqdn": "wix.realtime.v4.message"
51
51
  }
52
52
  },
53
- "falconPackageHash": "4ac4173bbe9bd35f60f967e02dc429e80a9fe5c5cf1fed5af21bf662"
53
+ "falconPackageHash": "32b25ef7d7b2f6fc4b05305cda2ae21a04fff685da8915b4aa38408c"
54
54
  }