@wix/auto_sdk_duplexer_realtime-permissions-provider 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +2 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +4 -7
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/{service-plugins-error-classes-B7a57gue.d.ts → service-plugins-error-classes-Bx0JDqp7.d.ts} +3 -6
- package/build/es/index.d.mts +2 -2
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +4 -7
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/{service-plugins-error-classes-B7a57gue.d.mts → service-plugins-error-classes-Bx0JDqp7.d.mts} +3 -6
- package/build/internal/cjs/index.d.ts +2 -2
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +4 -7
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/{service-plugins-error-classes-B7a57gue.d.ts → service-plugins-error-classes-Bx0JDqp7.d.ts} +3 -6
- package/build/internal/es/index.d.mts +2 -2
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +4 -7
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/{service-plugins-error-classes-B7a57gue.d.mts → service-plugins-error-classes-Bx0JDqp7.d.mts} +3 -6
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { p as provideHandlers$1 } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAiB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACjDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
3
3
|
import '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
|
|
|
7
7
|
*
|
|
8
8
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
11
11
|
*
|
|
12
12
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
13
13
|
*
|
|
14
|
-
* Error handling:
|
|
15
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
16
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
17
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
|
|
14
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
|
|
18
15
|
* @throws InvalidArgumentWixError
|
|
19
16
|
*/
|
|
20
17
|
declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
@@ -29,7 +29,7 @@ interface Channel {
|
|
|
29
29
|
/** Subscriber to a channel or resource. */
|
|
30
30
|
interface Subscriber {
|
|
31
31
|
/**
|
|
32
|
-
* Subscriber ID.
|
|
32
|
+
* Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
|
|
33
33
|
* @maxLength 1000
|
|
34
34
|
*/
|
|
35
35
|
_id?: string;
|
|
@@ -193,14 +193,11 @@ declare const provideHandlers: ServicePluginDefinition<{
|
|
|
193
193
|
*
|
|
194
194
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
195
195
|
*
|
|
196
|
-
*
|
|
196
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
197
197
|
*
|
|
198
198
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
199
199
|
*
|
|
200
|
-
* Error handling:
|
|
201
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
202
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
203
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
|
|
200
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
|
|
204
201
|
checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
205
202
|
}>;
|
|
206
203
|
|
package/build/es/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { p as provideHandlers$1 } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
|
|
1
|
+
{"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAiB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACjDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
3
3
|
import '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
|
|
|
7
7
|
*
|
|
8
8
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
11
11
|
*
|
|
12
12
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
13
13
|
*
|
|
14
|
-
* Error handling:
|
|
15
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
16
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
17
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
|
|
14
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
|
|
18
15
|
* @throws InvalidArgumentWixError
|
|
19
16
|
*/
|
|
20
17
|
declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AAAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
1
|
+
{"version":3,"sources":["../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AAAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
@@ -29,7 +29,7 @@ interface Channel {
|
|
|
29
29
|
/** Subscriber to a channel or resource. */
|
|
30
30
|
interface Subscriber {
|
|
31
31
|
/**
|
|
32
|
-
* Subscriber ID.
|
|
32
|
+
* Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
|
|
33
33
|
* @maxLength 1000
|
|
34
34
|
*/
|
|
35
35
|
_id?: string;
|
|
@@ -193,14 +193,11 @@ declare const provideHandlers: ServicePluginDefinition<{
|
|
|
193
193
|
*
|
|
194
194
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
195
195
|
*
|
|
196
|
-
*
|
|
196
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
197
197
|
*
|
|
198
198
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
199
199
|
*
|
|
200
|
-
* Error handling:
|
|
201
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
202
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
203
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
|
|
200
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
|
|
204
201
|
checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
205
202
|
}>;
|
|
206
203
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { p as provideHandlers$1 } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../index.ts","../../../src/service-plugins-types.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
|
|
1
|
+
{"version":3,"sources":["../../../index.ts","../../../src/service-plugins-types.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAiB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACjDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.js';
|
|
3
3
|
import '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
|
|
|
7
7
|
*
|
|
8
8
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
11
11
|
*
|
|
12
12
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
13
13
|
*
|
|
14
|
-
* Error handling:
|
|
15
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
16
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
17
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
|
|
14
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
|
|
18
15
|
* @throws InvalidArgumentWixError
|
|
19
16
|
*/
|
|
20
17
|
declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../index.typings.ts","../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
1
|
+
{"version":3,"sources":["../../../index.typings.ts","../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
@@ -29,7 +29,7 @@ interface Channel {
|
|
|
29
29
|
/** Subscriber to a channel or resource. */
|
|
30
30
|
interface Subscriber {
|
|
31
31
|
/**
|
|
32
|
-
* Subscriber ID.
|
|
32
|
+
* Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
|
|
33
33
|
* @maxLength 1000
|
|
34
34
|
*/
|
|
35
35
|
_id?: string;
|
|
@@ -193,14 +193,11 @@ declare const provideHandlers: ServicePluginDefinition<{
|
|
|
193
193
|
*
|
|
194
194
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
195
195
|
*
|
|
196
|
-
*
|
|
196
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
197
197
|
*
|
|
198
198
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
199
199
|
*
|
|
200
|
-
* Error handling:
|
|
201
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
202
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
203
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
|
|
200
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
|
|
204
201
|
checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
205
202
|
}>;
|
|
206
203
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { p as provideHandlers$1 } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/service-plugins-types.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/service-plugins-types.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAiB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACjDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-
|
|
2
|
-
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-
|
|
1
|
+
import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
2
|
+
export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.mjs';
|
|
3
3
|
import '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
|
|
|
7
7
|
*
|
|
8
8
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
11
11
|
*
|
|
12
12
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
13
13
|
*
|
|
14
|
-
* Error handling:
|
|
15
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
16
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
17
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
|
|
14
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
|
|
18
15
|
* @throws InvalidArgumentWixError
|
|
19
16
|
*/
|
|
20
17
|
declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AAAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AAAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
|
|
@@ -29,7 +29,7 @@ interface Channel {
|
|
|
29
29
|
/** Subscriber to a channel or resource. */
|
|
30
30
|
interface Subscriber {
|
|
31
31
|
/**
|
|
32
|
-
* Subscriber ID.
|
|
32
|
+
* Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
|
|
33
33
|
* @maxLength 1000
|
|
34
34
|
*/
|
|
35
35
|
_id?: string;
|
|
@@ -193,14 +193,11 @@ declare const provideHandlers: ServicePluginDefinition<{
|
|
|
193
193
|
*
|
|
194
194
|
* Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
|
|
195
195
|
*
|
|
196
|
-
*
|
|
196
|
+
* Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
|
|
197
197
|
*
|
|
198
198
|
* Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
|
|
199
199
|
*
|
|
200
|
-
* Error handling:
|
|
201
|
-
* - Don't throw an error for normal denials. Use `{ read: false }` instead.
|
|
202
|
-
* - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
|
|
203
|
-
* - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
|
|
200
|
+
* *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
|
|
204
201
|
checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
|
|
205
202
|
}>;
|
|
206
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/auto_sdk_duplexer_realtime-permissions-provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"fqdn": "wix.interfaces.realtime.v1.realtime_permissions_provider"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"falconPackageHash": "
|
|
54
|
+
"falconPackageHash": "d81cc4fc5f0c348d13c60c5695f6f7b209e3f409e8c2098572a8d965"
|
|
55
55
|
}
|