@wix/auto_sdk_duplexer_realtime-permissions-provider 1.0.1 → 1.0.3

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.
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.js';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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;;;ACoCO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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;;;AC/HZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAyB5B,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;;;ACzDD,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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.\n *\n * Wix calls this method when the realtime stack evaluates a **channel subscription**\n * (for example, when `wix-duplexer-sockets-server` resolves access for a client).\n * The call is **synchronous**: Wix waits for your response before allowing or denying\n * receive / send capabilities for that subscription attempt.\n *\n * Wix uses your `read` and `write` flags to decide whether the subscriber may\n * *receive channel messages** and **publish client events**, respectively.\n * Normal **authorization denials** should be expressed with `read` / `write`\n * set to `false`, not by throwing.\n *\n * If your implementation **throws**, times out, or the outbound call fails after Wix\n * has selected your app as the implementer, the **Realtime Permissions host** reports\n * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a\n * structured “reason” field for that failure mode. Keep handlers fast and avoid\n * blocking calls where possible.\n *\n * Wix may **skip** calling this RPC when there is no registered implementer for the\n * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**\n * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.\n *\n * *Your implementation should:**\n * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.\n * - Return `read` / `write` explicitly for every successful decision.\n *\n * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**\n * is invalid for your implementation (for example, a channel or subscriber shape you\n * cannot interpret). Do **not** use that error for normal policy denials.\n *\n * Parameter: `CheckSubscriberPermissionsRequest`.\n * Response: `CheckSubscriberPermissionsResponse` — for example:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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;;;ACgDO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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;;;ACzIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CA8C5B,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;;;AC9ED,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,19 +1,40 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.js';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.js';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
6
- * Checks whether a subscriber has permission to access a realtime channel.
6
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
7
7
  *
8
- * The Realtime Permissions Provider extension allows apps to control access
9
- * to realtime channels. When a subscriber attempts to connect to a channel,
10
- * this method is called to determine whether the subscriber has read and/or
11
- * write permissions for the specified channel.
8
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
9
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
10
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
11
+ * receive / send capabilities for that subscription attempt.
12
12
  *
13
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
14
- * channel and subscriber details.
15
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
16
- * read and write permissions:
13
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
14
+ * *receive channel messages** and **publish client events**, respectively.
15
+ * Normal **authorization denials** should be expressed with `read` / `write`
16
+ * set to `false`, not by throwing.
17
+ *
18
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
19
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
20
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
21
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
22
+ * blocking calls where possible.
23
+ *
24
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
25
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
26
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
27
+ *
28
+ * *Your implementation should:**
29
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
30
+ * - Return `read` / `write` explicitly for every successful decision.
31
+ *
32
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
33
+ * is invalid for your implementation (for example, a channel or subscriber shape you
34
+ * cannot interpret). Do **not** use that error for normal policy denials.
35
+ *
36
+ * Parameter: `CheckSubscriberPermissionsRequest`.
37
+ * Response: `CheckSubscriberPermissionsResponse` — for example:
17
38
  * ```json
18
39
  * {
19
40
  * "read": true,
@@ -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 access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ```\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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACOpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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 * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.\n *\n * Wix calls this method when the realtime stack evaluates a **channel subscription**\n * (for example, when `wix-duplexer-sockets-server` resolves access for a client).\n * The call is **synchronous**: Wix waits for your response before allowing or denying\n * receive / send capabilities for that subscription attempt.\n *\n * Wix uses your `read` and `write` flags to decide whether the subscriber may\n * *receive channel messages** and **publish client events**, respectively.\n * Normal **authorization denials** should be expressed with `read` / `write`\n * set to `false`, not by throwing.\n *\n * If your implementation **throws**, times out, or the outbound call fails after Wix\n * has selected your app as the implementer, the **Realtime Permissions host** reports\n * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a\n * structured “reason” field for that failure mode. Keep handlers fast and avoid\n * blocking calls where possible.\n *\n * Wix may **skip** calling this RPC when there is no registered implementer for the\n * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**\n * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.\n *\n * *Your implementation should:**\n * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.\n * - Return `read` / `write` explicitly for every successful decision.\n *\n * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**\n * is invalid for your implementation (for example, a channel or subscriber shape you\n * cannot interpret). Do **not** use that error for normal policy denials.\n *\n * Parameter: `CheckSubscriberPermissionsRequest`.\n * Response: `CheckSubscriberPermissionsResponse` — for example:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ```\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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACmBpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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"]}
@@ -2,31 +2,43 @@ import { ServicePluginDefinition } from '@wix/sdk-types';
2
2
 
3
3
  /** Request to check subscriber permissions for a realtime channel. */
4
4
  interface CheckSubscriberPermissionsRequest {
5
- /** The channel to check permissions for */
5
+ /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */
6
6
  channel?: Channel;
7
- /** The subscriber requesting access */
7
+ /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */
8
8
  subscriber?: Subscriber;
9
9
  /**
10
- * The appId of the app who is requesting to subscribe to the channel
10
+ * App definition ID of the **caller's origin app** for this subscription check,
11
+ * as injected by the Wix host from request identity context (not copied from the
12
+ * duplexer `CheckPermissions` body). Identifies which third-party app is trying to
13
+ * subscribe when that context exists.
14
+ *
15
+ * The host **always sets** this field on the wire. When the context has no origin
16
+ * app id, the value may be an **empty string**—treat that as "unknown origin app"
17
+ * rather than assuming a valid GUID.
18
+ *
19
+ * When non-empty, the value is a GUID string.
11
20
  * @format GUID
12
21
  */
13
22
  requestingAppId?: string | null;
14
23
  }
15
24
  interface Channel {
16
25
  /**
17
- * Channel name. Cannot exceed 140 characters
26
+ * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.
18
27
  * @maxLength 140
19
28
  */
20
29
  name?: string;
21
30
  /**
22
- * ID of a specific channel resource
31
+ * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).
32
+ * Use with `name` when multiple channels share the same name but differ by resource.
23
33
  * @maxLength 1000
24
34
  */
25
35
  resourceId?: string | null;
26
36
  }
27
37
  interface Subscriber {
28
38
  /**
29
- * The subscriber's user ID
39
+ * Stable identifier for the subscriber when one exists in context (e.g. Wix user id
40
+ * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty
41
+ * identifier depending on platform context—do not assume a real member id.
30
42
  * @maxLength 1000
31
43
  */
32
44
  _id?: string;
@@ -44,16 +56,14 @@ declare enum SubscriberType {
44
56
  }
45
57
  /** Response containing the subscriber's permissions for the channel. */
46
58
  interface CheckSubscriberPermissionsResponse {
47
- /** Whether the subscriber can listen/read messages */
59
+ /** When `true`, the subscriber may **receive** messages published on the channel. */
48
60
  read?: boolean;
49
- /** Whether the subscriber can send client events */
50
- write?: boolean;
51
61
  }
52
62
  interface RealtimePermissionsProviderConfig {
53
- /** URI where the SPI Implementer is deployed */
63
+ /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */
54
64
  deploymentUri?: SpiBaseUri;
55
65
  /**
56
- * User-friendly name of the permissions provider
66
+ * Display name for this permissions provider in the app dashboard (translatable short text).
57
67
  * @maxLength 100
58
68
  */
59
69
  providerName?: string;
@@ -180,17 +190,38 @@ interface CheckSubscriberPermissionsEnvelope {
180
190
  declare const provideHandlers: ServicePluginDefinition<{
181
191
  /**
182
192
  *
183
- * Checks whether a subscriber has permission to access a realtime channel.
193
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
194
+ *
195
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
196
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
197
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
198
+ * receive / send capabilities for that subscription attempt.
199
+ *
200
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
201
+ * *receive channel messages** and **publish client events**, respectively.
202
+ * Normal **authorization denials** should be expressed with `read` / `write`
203
+ * set to `false`, not by throwing.
204
+ *
205
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
206
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
207
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
208
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
209
+ * blocking calls where possible.
210
+ *
211
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
212
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
213
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
214
+ *
215
+ * *Your implementation should:**
216
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
217
+ * - Return `read` / `write` explicitly for every successful decision.
184
218
  *
185
- * The Realtime Permissions Provider extension allows apps to control access
186
- * to realtime channels. When a subscriber attempts to connect to a channel,
187
- * this method is called to determine whether the subscriber has read and/or
188
- * write permissions for the specified channel.
219
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
220
+ * is invalid for your implementation (for example, a channel or subscriber shape you
221
+ * cannot interpret). Do **not** use that error for normal policy denials.
189
222
  *
190
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
191
- * channel and subscriber details.
192
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
193
- * read and write permissions:
223
+ * Parameter: `CheckSubscriberPermissionsRequest`.
224
+ * Response: `CheckSubscriberPermissionsResponse` for example:
194
225
  * ```json
195
226
  * {
196
227
  * "read": true,
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.mjs';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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":";AAoCO,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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;;;AC/HZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAyB5B,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;;;ACzDD,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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.\n *\n * Wix calls this method when the realtime stack evaluates a **channel subscription**\n * (for example, when `wix-duplexer-sockets-server` resolves access for a client).\n * The call is **synchronous**: Wix waits for your response before allowing or denying\n * receive / send capabilities for that subscription attempt.\n *\n * Wix uses your `read` and `write` flags to decide whether the subscriber may\n * *receive channel messages** and **publish client events**, respectively.\n * Normal **authorization denials** should be expressed with `read` / `write`\n * set to `false`, not by throwing.\n *\n * If your implementation **throws**, times out, or the outbound call fails after Wix\n * has selected your app as the implementer, the **Realtime Permissions host** reports\n * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a\n * structured “reason” field for that failure mode. Keep handlers fast and avoid\n * blocking calls where possible.\n *\n * Wix may **skip** calling this RPC when there is no registered implementer for the\n * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**\n * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.\n *\n * *Your implementation should:**\n * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.\n * - Return `read` / `write` explicitly for every successful decision.\n *\n * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**\n * is invalid for your implementation (for example, a channel or subscriber shape you\n * cannot interpret). Do **not** use that error for normal policy denials.\n *\n * Parameter: `CheckSubscriberPermissionsRequest`.\n * Response: `CheckSubscriberPermissionsResponse` — for example:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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":";AAgDO,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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;;;ACzIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBA8C5B,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;;;AC9ED,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,19 +1,40 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.mjs';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.mjs';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
6
- * Checks whether a subscriber has permission to access a realtime channel.
6
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
7
7
  *
8
- * The Realtime Permissions Provider extension allows apps to control access
9
- * to realtime channels. When a subscriber attempts to connect to a channel,
10
- * this method is called to determine whether the subscriber has read and/or
11
- * write permissions for the specified channel.
8
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
9
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
10
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
11
+ * receive / send capabilities for that subscription attempt.
12
12
  *
13
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
14
- * channel and subscriber details.
15
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
16
- * read and write permissions:
13
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
14
+ * *receive channel messages** and **publish client events**, respectively.
15
+ * Normal **authorization denials** should be expressed with `read` / `write`
16
+ * set to `false`, not by throwing.
17
+ *
18
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
19
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
20
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
21
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
22
+ * blocking calls where possible.
23
+ *
24
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
25
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
26
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
27
+ *
28
+ * *Your implementation should:**
29
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
30
+ * - Return `read` / `write` explicitly for every successful decision.
31
+ *
32
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
33
+ * is invalid for your implementation (for example, a channel or subscriber shape you
34
+ * cannot interpret). Do **not** use that error for normal policy denials.
35
+ *
36
+ * Parameter: `CheckSubscriberPermissionsRequest`.
37
+ * Response: `CheckSubscriberPermissionsResponse` — for example:
17
38
  * ```json
18
39
  * {
19
40
  * "read": true,
@@ -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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACOpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACmBpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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"]}
@@ -2,31 +2,43 @@ import { ServicePluginDefinition } from '@wix/sdk-types';
2
2
 
3
3
  /** Request to check subscriber permissions for a realtime channel. */
4
4
  interface CheckSubscriberPermissionsRequest {
5
- /** The channel to check permissions for */
5
+ /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */
6
6
  channel?: Channel;
7
- /** The subscriber requesting access */
7
+ /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */
8
8
  subscriber?: Subscriber;
9
9
  /**
10
- * The appId of the app who is requesting to subscribe to the channel
10
+ * App definition ID of the **caller's origin app** for this subscription check,
11
+ * as injected by the Wix host from request identity context (not copied from the
12
+ * duplexer `CheckPermissions` body). Identifies which third-party app is trying to
13
+ * subscribe when that context exists.
14
+ *
15
+ * The host **always sets** this field on the wire. When the context has no origin
16
+ * app id, the value may be an **empty string**—treat that as "unknown origin app"
17
+ * rather than assuming a valid GUID.
18
+ *
19
+ * When non-empty, the value is a GUID string.
11
20
  * @format GUID
12
21
  */
13
22
  requestingAppId?: string | null;
14
23
  }
15
24
  interface Channel {
16
25
  /**
17
- * Channel name. Cannot exceed 140 characters
26
+ * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.
18
27
  * @maxLength 140
19
28
  */
20
29
  name?: string;
21
30
  /**
22
- * ID of a specific channel resource
31
+ * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).
32
+ * Use with `name` when multiple channels share the same name but differ by resource.
23
33
  * @maxLength 1000
24
34
  */
25
35
  resourceId?: string | null;
26
36
  }
27
37
  interface Subscriber {
28
38
  /**
29
- * The subscriber's user ID
39
+ * Stable identifier for the subscriber when one exists in context (e.g. Wix user id
40
+ * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty
41
+ * identifier depending on platform context—do not assume a real member id.
30
42
  * @maxLength 1000
31
43
  */
32
44
  _id?: string;
@@ -44,16 +56,14 @@ declare enum SubscriberType {
44
56
  }
45
57
  /** Response containing the subscriber's permissions for the channel. */
46
58
  interface CheckSubscriberPermissionsResponse {
47
- /** Whether the subscriber can listen/read messages */
59
+ /** When `true`, the subscriber may **receive** messages published on the channel. */
48
60
  read?: boolean;
49
- /** Whether the subscriber can send client events */
50
- write?: boolean;
51
61
  }
52
62
  interface RealtimePermissionsProviderConfig {
53
- /** URI where the SPI Implementer is deployed */
63
+ /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */
54
64
  deploymentUri?: SpiBaseUri;
55
65
  /**
56
- * User-friendly name of the permissions provider
66
+ * Display name for this permissions provider in the app dashboard (translatable short text).
57
67
  * @maxLength 100
58
68
  */
59
69
  providerName?: string;
@@ -180,17 +190,38 @@ interface CheckSubscriberPermissionsEnvelope {
180
190
  declare const provideHandlers: ServicePluginDefinition<{
181
191
  /**
182
192
  *
183
- * Checks whether a subscriber has permission to access a realtime channel.
193
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
194
+ *
195
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
196
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
197
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
198
+ * receive / send capabilities for that subscription attempt.
199
+ *
200
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
201
+ * *receive channel messages** and **publish client events**, respectively.
202
+ * Normal **authorization denials** should be expressed with `read` / `write`
203
+ * set to `false`, not by throwing.
204
+ *
205
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
206
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
207
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
208
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
209
+ * blocking calls where possible.
210
+ *
211
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
212
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
213
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
214
+ *
215
+ * *Your implementation should:**
216
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
217
+ * - Return `read` / `write` explicitly for every successful decision.
184
218
  *
185
- * The Realtime Permissions Provider extension allows apps to control access
186
- * to realtime channels. When a subscriber attempts to connect to a channel,
187
- * this method is called to determine whether the subscriber has read and/or
188
- * write permissions for the specified channel.
219
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
220
+ * is invalid for your implementation (for example, a channel or subscriber shape you
221
+ * cannot interpret). Do **not** use that error for normal policy denials.
189
222
  *
190
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
191
- * channel and subscriber details.
192
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
193
- * read and write permissions:
223
+ * Parameter: `CheckSubscriberPermissionsRequest`.
224
+ * Response: `CheckSubscriberPermissionsResponse` for example:
194
225
  * ```json
195
226
  * {
196
227
  * "read": true,
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.js';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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;;;ACoCO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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;;;AC/HZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAyB5B,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;;;ACzDD,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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.\n *\n * Wix calls this method when the realtime stack evaluates a **channel subscription**\n * (for example, when `wix-duplexer-sockets-server` resolves access for a client).\n * The call is **synchronous**: Wix waits for your response before allowing or denying\n * receive / send capabilities for that subscription attempt.\n *\n * Wix uses your `read` and `write` flags to decide whether the subscriber may\n * *receive channel messages** and **publish client events**, respectively.\n * Normal **authorization denials** should be expressed with `read` / `write`\n * set to `false`, not by throwing.\n *\n * If your implementation **throws**, times out, or the outbound call fails after Wix\n * has selected your app as the implementer, the **Realtime Permissions host** reports\n * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a\n * structured “reason” field for that failure mode. Keep handlers fast and avoid\n * blocking calls where possible.\n *\n * Wix may **skip** calling this RPC when there is no registered implementer for the\n * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**\n * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.\n *\n * *Your implementation should:**\n * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.\n * - Return `read` / `write` explicitly for every successful decision.\n *\n * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**\n * is invalid for your implementation (for example, a channel or subscriber shape you\n * cannot interpret). Do **not** use that error for normal policy denials.\n *\n * Parameter: `CheckSubscriberPermissionsRequest`.\n * Response: `CheckSubscriberPermissionsResponse` — for example:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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;;;ACgDO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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;;;ACzIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CA8C5B,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;;;AC9ED,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,19 +1,40 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.js';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.js';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
6
- * Checks whether a subscriber has permission to access a realtime channel.
6
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
7
7
  *
8
- * The Realtime Permissions Provider extension allows apps to control access
9
- * to realtime channels. When a subscriber attempts to connect to a channel,
10
- * this method is called to determine whether the subscriber has read and/or
11
- * write permissions for the specified channel.
8
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
9
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
10
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
11
+ * receive / send capabilities for that subscription attempt.
12
12
  *
13
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
14
- * channel and subscriber details.
15
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
16
- * read and write permissions:
13
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
14
+ * *receive channel messages** and **publish client events**, respectively.
15
+ * Normal **authorization denials** should be expressed with `read` / `write`
16
+ * set to `false`, not by throwing.
17
+ *
18
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
19
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
20
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
21
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
22
+ * blocking calls where possible.
23
+ *
24
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
25
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
26
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
27
+ *
28
+ * *Your implementation should:**
29
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
30
+ * - Return `read` / `write` explicitly for every successful decision.
31
+ *
32
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
33
+ * is invalid for your implementation (for example, a channel or subscriber shape you
34
+ * cannot interpret). Do **not** use that error for normal policy denials.
35
+ *
36
+ * Parameter: `CheckSubscriberPermissionsRequest`.
37
+ * Response: `CheckSubscriberPermissionsResponse` — for example:
17
38
  * ```json
18
39
  * {
19
40
  * "read": true,
@@ -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 access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ```\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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACOpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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 * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.\n *\n * Wix calls this method when the realtime stack evaluates a **channel subscription**\n * (for example, when `wix-duplexer-sockets-server` resolves access for a client).\n * The call is **synchronous**: Wix waits for your response before allowing or denying\n * receive / send capabilities for that subscription attempt.\n *\n * Wix uses your `read` and `write` flags to decide whether the subscriber may\n * *receive channel messages** and **publish client events**, respectively.\n * Normal **authorization denials** should be expressed with `read` / `write`\n * set to `false`, not by throwing.\n *\n * If your implementation **throws**, times out, or the outbound call fails after Wix\n * has selected your app as the implementer, the **Realtime Permissions host** reports\n * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a\n * structured “reason” field for that failure mode. Keep handlers fast and avoid\n * blocking calls where possible.\n *\n * Wix may **skip** calling this RPC when there is no registered implementer for the\n * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**\n * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.\n *\n * *Your implementation should:**\n * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.\n * - Return `read` / `write` explicitly for every successful decision.\n *\n * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**\n * is invalid for your implementation (for example, a channel or subscriber shape you\n * cannot interpret). Do **not** use that error for normal policy denials.\n *\n * Parameter: `CheckSubscriberPermissionsRequest`.\n * Response: `CheckSubscriberPermissionsResponse` — for example:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ```\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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACmBpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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"]}
@@ -2,31 +2,43 @@ import { ServicePluginDefinition } from '@wix/sdk-types';
2
2
 
3
3
  /** Request to check subscriber permissions for a realtime channel. */
4
4
  interface CheckSubscriberPermissionsRequest {
5
- /** The channel to check permissions for */
5
+ /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */
6
6
  channel?: Channel;
7
- /** The subscriber requesting access */
7
+ /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */
8
8
  subscriber?: Subscriber;
9
9
  /**
10
- * The appId of the app who is requesting to subscribe to the channel
10
+ * App definition ID of the **caller's origin app** for this subscription check,
11
+ * as injected by the Wix host from request identity context (not copied from the
12
+ * duplexer `CheckPermissions` body). Identifies which third-party app is trying to
13
+ * subscribe when that context exists.
14
+ *
15
+ * The host **always sets** this field on the wire. When the context has no origin
16
+ * app id, the value may be an **empty string**—treat that as "unknown origin app"
17
+ * rather than assuming a valid GUID.
18
+ *
19
+ * When non-empty, the value is a GUID string.
11
20
  * @format GUID
12
21
  */
13
22
  requestingAppId?: string | null;
14
23
  }
15
24
  interface Channel {
16
25
  /**
17
- * Channel name. Cannot exceed 140 characters
26
+ * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.
18
27
  * @maxLength 140
19
28
  */
20
29
  name?: string;
21
30
  /**
22
- * ID of a specific channel resource
31
+ * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).
32
+ * Use with `name` when multiple channels share the same name but differ by resource.
23
33
  * @maxLength 1000
24
34
  */
25
35
  resourceId?: string | null;
26
36
  }
27
37
  interface Subscriber {
28
38
  /**
29
- * The subscriber's user ID
39
+ * Stable identifier for the subscriber when one exists in context (e.g. Wix user id
40
+ * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty
41
+ * identifier depending on platform context—do not assume a real member id.
30
42
  * @maxLength 1000
31
43
  */
32
44
  _id?: string;
@@ -44,16 +56,14 @@ declare enum SubscriberType {
44
56
  }
45
57
  /** Response containing the subscriber's permissions for the channel. */
46
58
  interface CheckSubscriberPermissionsResponse {
47
- /** Whether the subscriber can listen/read messages */
59
+ /** When `true`, the subscriber may **receive** messages published on the channel. */
48
60
  read?: boolean;
49
- /** Whether the subscriber can send client events */
50
- write?: boolean;
51
61
  }
52
62
  interface RealtimePermissionsProviderConfig {
53
- /** URI where the SPI Implementer is deployed */
63
+ /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */
54
64
  deploymentUri?: SpiBaseUri;
55
65
  /**
56
- * User-friendly name of the permissions provider
66
+ * Display name for this permissions provider in the app dashboard (translatable short text).
57
67
  * @maxLength 100
58
68
  */
59
69
  providerName?: string;
@@ -180,17 +190,38 @@ interface CheckSubscriberPermissionsEnvelope {
180
190
  declare const provideHandlers: ServicePluginDefinition<{
181
191
  /**
182
192
  *
183
- * Checks whether a subscriber has permission to access a realtime channel.
193
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
194
+ *
195
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
196
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
197
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
198
+ * receive / send capabilities for that subscription attempt.
199
+ *
200
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
201
+ * *receive channel messages** and **publish client events**, respectively.
202
+ * Normal **authorization denials** should be expressed with `read` / `write`
203
+ * set to `false`, not by throwing.
204
+ *
205
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
206
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
207
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
208
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
209
+ * blocking calls where possible.
210
+ *
211
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
212
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
213
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
214
+ *
215
+ * *Your implementation should:**
216
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
217
+ * - Return `read` / `write` explicitly for every successful decision.
184
218
  *
185
- * The Realtime Permissions Provider extension allows apps to control access
186
- * to realtime channels. When a subscriber attempts to connect to a channel,
187
- * this method is called to determine whether the subscriber has read and/or
188
- * write permissions for the specified channel.
219
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
220
+ * is invalid for your implementation (for example, a channel or subscriber shape you
221
+ * cannot interpret). Do **not** use that error for normal policy denials.
189
222
  *
190
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
191
- * channel and subscriber details.
192
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
193
- * read and write permissions:
223
+ * Parameter: `CheckSubscriberPermissionsRequest`.
224
+ * Response: `CheckSubscriberPermissionsResponse` for example:
194
225
  * ```json
195
226
  * {
196
227
  * "read": true,
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.mjs';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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":";AAoCO,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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;;;AC/HZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAyB5B,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;;;ACzDD,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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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 * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.\n *\n * Wix calls this method when the realtime stack evaluates a **channel subscription**\n * (for example, when `wix-duplexer-sockets-server` resolves access for a client).\n * The call is **synchronous**: Wix waits for your response before allowing or denying\n * receive / send capabilities for that subscription attempt.\n *\n * Wix uses your `read` and `write` flags to decide whether the subscriber may\n * *receive channel messages** and **publish client events**, respectively.\n * Normal **authorization denials** should be expressed with `read` / `write`\n * set to `false`, not by throwing.\n *\n * If your implementation **throws**, times out, or the outbound call fails after Wix\n * has selected your app as the implementer, the **Realtime Permissions host** reports\n * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a\n * structured “reason” field for that failure mode. Keep handlers fast and avoid\n * blocking calls where possible.\n *\n * Wix may **skip** calling this RPC when there is no registered implementer for the\n * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**\n * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.\n *\n * *Your implementation should:**\n * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.\n * - Return `read` / `write` explicitly for every successful decision.\n *\n * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**\n * is invalid for your implementation (for example, a channel or subscriber shape you\n * cannot interpret). Do **not** use that error for normal policy denials.\n *\n * Parameter: `CheckSubscriberPermissionsRequest`.\n * Response: `CheckSubscriberPermissionsResponse` — for example:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\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":";AAgDO,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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;;;ACzIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBA8C5B,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;;;AC9ED,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,19 +1,40 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-C2e4yH1l.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-C2e4yH1l.mjs';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-O4V6ESSE.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-O4V6ESSE.mjs';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
6
- * Checks whether a subscriber has permission to access a realtime channel.
6
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
7
7
  *
8
- * The Realtime Permissions Provider extension allows apps to control access
9
- * to realtime channels. When a subscriber attempts to connect to a channel,
10
- * this method is called to determine whether the subscriber has read and/or
11
- * write permissions for the specified channel.
8
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
9
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
10
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
11
+ * receive / send capabilities for that subscription attempt.
12
12
  *
13
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
14
- * channel and subscriber details.
15
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
16
- * read and write permissions:
13
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
14
+ * *receive channel messages** and **publish client events**, respectively.
15
+ * Normal **authorization denials** should be expressed with `read` / `write`
16
+ * set to `false`, not by throwing.
17
+ *
18
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
19
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
20
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
21
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
22
+ * blocking calls where possible.
23
+ *
24
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
25
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
26
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
27
+ *
28
+ * *Your implementation should:**
29
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
30
+ * - Return `read` / `write` explicitly for every successful decision.
31
+ *
32
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
33
+ * is invalid for your implementation (for example, a channel or subscriber shape you
34
+ * cannot interpret). Do **not** use that error for normal policy denials.
35
+ *
36
+ * Parameter: `CheckSubscriberPermissionsRequest`.
37
+ * Response: `CheckSubscriberPermissionsResponse` — for example:
17
38
  * ```json
18
39
  * {
19
40
  * "read": true,
@@ -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 /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n /**\n * The appId of the app who is requesting to subscribe to the channel\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACOpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,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 /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */\n channel?: Channel;\n /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */\n subscriber?: Subscriber;\n /**\n * App definition ID of the **caller's origin app** for this subscription check,\n * as injected by the Wix host from request identity context (not copied from the\n * duplexer `CheckPermissions` body). Identifies which third-party app is trying to\n * subscribe when that context exists.\n *\n * The host **always sets** this field on the wire. When the context has no origin\n * app id, the value may be an **empty string**—treat that as \"unknown origin app\"\n * rather than assuming a valid GUID.\n *\n * When non-empty, the value is a GUID string.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\nexport interface Channel {\n /**\n * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.\n * @maxLength 140\n */\n name?: string;\n /**\n * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).\n * Use with `name` when multiple channels share the same name but differ by resource.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * Stable identifier for the subscriber when one exists in context (e.g. Wix user id\n * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty\n * identifier depending on platform context—do not assume a real member id.\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** When `true`, the subscriber may **receive** messages published on the channel. */\n read?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the app dashboard (translatable short text).\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\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;;;ACmBpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AAyFL,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"]}
@@ -2,31 +2,43 @@ import { ServicePluginDefinition } from '@wix/sdk-types';
2
2
 
3
3
  /** Request to check subscriber permissions for a realtime channel. */
4
4
  interface CheckSubscriberPermissionsRequest {
5
- /** The channel to check permissions for */
5
+ /** Realtime **channel** being subscribed to, including its logical name and optional resource scope. */
6
6
  channel?: Channel;
7
- /** The subscriber requesting access */
7
+ /** *Subscriber** attempting the subscription (user id pattern depends on `type`; see `Subscriber.id`). */
8
8
  subscriber?: Subscriber;
9
9
  /**
10
- * The appId of the app who is requesting to subscribe to the channel
10
+ * App definition ID of the **caller's origin app** for this subscription check,
11
+ * as injected by the Wix host from request identity context (not copied from the
12
+ * duplexer `CheckPermissions` body). Identifies which third-party app is trying to
13
+ * subscribe when that context exists.
14
+ *
15
+ * The host **always sets** this field on the wire. When the context has no origin
16
+ * app id, the value may be an **empty string**—treat that as "unknown origin app"
17
+ * rather than assuming a valid GUID.
18
+ *
19
+ * When non-empty, the value is a GUID string.
11
20
  * @format GUID
12
21
  */
13
22
  requestingAppId?: string | null;
14
23
  }
15
24
  interface Channel {
16
25
  /**
17
- * Channel name. Cannot exceed 140 characters
26
+ * Logical channel name (for example, the name your app uses when publishing). Max 140 characters.
18
27
  * @maxLength 140
19
28
  */
20
29
  name?: string;
21
30
  /**
22
- * ID of a specific channel resource
31
+ * Optional id for a **resource** this channel is tied to (for example, a specific entity instance).
32
+ * Use with `name` when multiple channels share the same name but differ by resource.
23
33
  * @maxLength 1000
24
34
  */
25
35
  resourceId?: string | null;
26
36
  }
27
37
  interface Subscriber {
28
38
  /**
29
- * The subscriber's user ID
39
+ * Stable identifier for the subscriber when one exists in context (e.g. Wix user id
40
+ * for `ADMIN` / `MEMBER`). For `VISITOR`, the host may send an anonymous or empty
41
+ * identifier depending on platform context—do not assume a real member id.
30
42
  * @maxLength 1000
31
43
  */
32
44
  _id?: string;
@@ -44,16 +56,14 @@ declare enum SubscriberType {
44
56
  }
45
57
  /** Response containing the subscriber's permissions for the channel. */
46
58
  interface CheckSubscriberPermissionsResponse {
47
- /** Whether the subscriber can listen/read messages */
59
+ /** When `true`, the subscriber may **receive** messages published on the channel. */
48
60
  read?: boolean;
49
- /** Whether the subscriber can send client events */
50
- write?: boolean;
51
61
  }
52
62
  interface RealtimePermissionsProviderConfig {
53
- /** URI where the SPI Implementer is deployed */
63
+ /** Base URI where Wix should reach your service plugin **HTTPS** endpoints (see Auto SDK / SPI hosting). */
54
64
  deploymentUri?: SpiBaseUri;
55
65
  /**
56
- * User-friendly name of the permissions provider
66
+ * Display name for this permissions provider in the app dashboard (translatable short text).
57
67
  * @maxLength 100
58
68
  */
59
69
  providerName?: string;
@@ -180,17 +190,38 @@ interface CheckSubscriberPermissionsEnvelope {
180
190
  declare const provideHandlers: ServicePluginDefinition<{
181
191
  /**
182
192
  *
183
- * Checks whether a subscriber has permission to access a realtime channel.
193
+ * Requests whether a subscriber may **read** and **write** on a Wix Realtime channel.
194
+ *
195
+ * Wix calls this method when the realtime stack evaluates a **channel subscription**
196
+ * (for example, when `wix-duplexer-sockets-server` resolves access for a client).
197
+ * The call is **synchronous**: Wix waits for your response before allowing or denying
198
+ * receive / send capabilities for that subscription attempt.
199
+ *
200
+ * Wix uses your `read` and `write` flags to decide whether the subscriber may
201
+ * *receive channel messages** and **publish client events**, respectively.
202
+ * Normal **authorization denials** should be expressed with `read` / `write`
203
+ * set to `false`, not by throwing.
204
+ *
205
+ * If your implementation **throws**, times out, or the outbound call fails after Wix
206
+ * has selected your app as the implementer, the **Realtime Permissions host** reports
207
+ * *gRPC `UNAVAILABLE` / HTTP 503** to its caller. It does **not** return a
208
+ * structured “reason” field for that failure mode. Keep handlers fast and avoid
209
+ * blocking calls where possible.
210
+ *
211
+ * Wix may **skip** calling this RPC when there is no registered implementer for the
212
+ * channel owner app (`NO_IMPLEMENTER`) or when required **MetaSite / identity**
213
+ * context is missing (`MISSING_CONTEXT`); those outcomes are resolved entirely by the host.
214
+ *
215
+ * *Your implementation should:**
216
+ * - Use `channel`, `subscriber`, and `requesting_app_id` (see field comments) to enforce your rules.
217
+ * - Return `read` / `write` explicitly for every successful decision.
184
218
  *
185
- * The Realtime Permissions Provider extension allows apps to control access
186
- * to realtime channels. When a subscriber attempts to connect to a channel,
187
- * this method is called to determine whether the subscriber has read and/or
188
- * write permissions for the specified channel.
219
+ * *Error handling:** Return **`InvalidArgumentError`** only when the **request payload**
220
+ * is invalid for your implementation (for example, a channel or subscriber shape you
221
+ * cannot interpret). Do **not** use that error for normal policy denials.
189
222
  *
190
- * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
191
- * channel and subscriber details.
192
- * Response: A `CheckSubscriberPermissionsResponse` object containing the
193
- * read and write permissions:
223
+ * Parameter: `CheckSubscriberPermissionsRequest`.
224
+ * Response: `CheckSubscriberPermissionsResponse` for example:
194
225
  * ```json
195
226
  * {
196
227
  * "read": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/auto_sdk_duplexer_realtime-permissions-provider",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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": "084836404883b02cec08965364bd205c925a5c2906ed27652af7b1a2"
54
+ "falconPackageHash": "3b31705abcdab1910062f0f508e762d3d718aecd1db91a6f11523f51"
55
55
  }