@wix/auto_sdk_duplexer_realtime-permissions-provider 1.0.4 → 1.0.6

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.
Files changed (29) hide show
  1. package/build/cjs/index.d.ts +2 -2
  2. package/build/cjs/index.js +5 -3
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +4 -7
  5. package/build/cjs/index.typings.js +4 -2
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/{service-plugins-error-classes-B7a57gue.d.ts → service-plugins-error-classes-Bx0JDqp7.d.ts} +3 -6
  8. package/build/es/index.d.mts +2 -2
  9. package/build/es/index.mjs +5 -3
  10. package/build/es/index.mjs.map +1 -1
  11. package/build/es/index.typings.d.mts +4 -7
  12. package/build/es/index.typings.mjs +4 -2
  13. package/build/es/index.typings.mjs.map +1 -1
  14. package/build/es/{service-plugins-error-classes-B7a57gue.d.mts → service-plugins-error-classes-Bx0JDqp7.d.mts} +3 -6
  15. package/build/internal/cjs/index.d.ts +2 -2
  16. package/build/internal/cjs/index.typings.d.ts +4 -7
  17. package/build/internal/cjs/{service-plugins-error-classes-B7a57gue.d.ts → service-plugins-error-classes-BUWgDF3H.d.ts} +27 -6
  18. package/build/internal/es/index.d.mts +2 -2
  19. package/build/internal/es/index.typings.d.mts +4 -7
  20. package/build/internal/es/{service-plugins-error-classes-B7a57gue.d.mts → service-plugins-error-classes-BUWgDF3H.d.mts} +27 -6
  21. package/package.json +5 -12
  22. package/build/internal/cjs/index.js +0 -99
  23. package/build/internal/cjs/index.js.map +0 -1
  24. package/build/internal/cjs/index.typings.js +0 -69
  25. package/build/internal/cjs/index.typings.js.map +0 -1
  26. package/build/internal/es/index.mjs +0 -71
  27. package/build/internal/es/index.mjs.map +0 -1
  28. package/build/internal/es/index.typings.mjs +0 -40
  29. package/build/internal/es/index.typings.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.js';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-Bx0JDqp7.js';
2
+ export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.js';
3
3
  import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
4
 
5
5
  declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
@@ -67,7 +67,7 @@ var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("REALTIME_PE
67
67
 
68
68
  // src/interfaces-realtime-v1-realtime-permissions-provider.context.ts
69
69
  var import_service_plugin_modules = require("@wix/sdk-runtime/service-plugin-modules");
70
- var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(
70
+ var provideHandlers2 = /* @__PURE__ */ (0, import_service_plugin_modules.createServicePluginModule)(
71
71
  provideHandlers
72
72
  );
73
73
 
@@ -85,9 +85,11 @@ var InvalidArgumentWixError = class extends Error {
85
85
  applicationCode: "INVALID_ARGUMENT"
86
86
  };
87
87
  }
88
+ static {
89
+ /** @hidden */
90
+ this.__type = "wix_spi_error";
91
+ }
88
92
  };
89
- /** @hidden */
90
- InvalidArgumentWixError.__type = "wix_spi_error";
91
93
  // Annotate the CommonJS export names for ESM import in node:
92
94
  0 && (module.exports = {
93
95
  IdentityType,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n /**\n * When `true`, the subscriber may **send** client events on the channel.\n * Internal. Currently unused.\n * @internal\n */\n write?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Extension ID in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionId?: string | null;\n /**\n * Extension type in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionType?: string | null;\n /**\n * Invoked function.\n * @internal\n * @maxLength 256\n */\n functionName?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = /*#__PURE__*/ createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AAoHL,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;;;AChKZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAiB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACjDD,oCAA0C;AAMnC,IAAMC,mBAGkC;AAAA,EAC7C;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;AAAA,EAGA;AAAA;AAAA,SAAgB,SAAS;AAAA;AAC3B;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
@@ -1,5 +1,5 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.js';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-Bx0JDqp7.js';
2
+ export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.js';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
7
7
  *
8
8
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
9
9
  *
10
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
10
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
11
11
  *
12
12
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
13
13
  *
14
- * Error handling:
15
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
16
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
17
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
14
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
18
15
  * @throws InvalidArgumentWixError
19
16
  */
20
17
  declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
@@ -40,9 +40,11 @@ var InvalidArgumentWixError = class extends Error {
40
40
  applicationCode: "INVALID_ARGUMENT"
41
41
  };
42
42
  }
43
+ static {
44
+ /** @hidden */
45
+ this.__type = "wix_spi_error";
46
+ }
43
47
  };
44
- /** @hidden */
45
- InvalidArgumentWixError.__type = "wix_spi_error";
46
48
 
47
49
  // src/service-plugins-types.ts
48
50
  var SubscriberType = /* @__PURE__ */ ((SubscriberType2) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
1
+ {"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n /**\n * When `true`, the subscriber may **send** client events on the channel.\n * Internal. Currently unused.\n * @internal\n */\n write?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Extension ID in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionId?: string | null;\n /**\n * Extension type in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionType?: string | null;\n /**\n * Invoked function.\n * @internal\n * @maxLength 256\n */\n functionName?: 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;AAAA,EAGA;AAAA;AAAA,SAAgB,SAAS;AAAA;AAC3B;;;ACcO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AAoHL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
@@ -29,7 +29,7 @@ interface Channel {
29
29
  /** Subscriber to a channel or resource. */
30
30
  interface Subscriber {
31
31
  /**
32
- * Subscriber ID.
32
+ * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
33
33
  * @maxLength 1000
34
34
  */
35
35
  _id?: string;
@@ -193,14 +193,11 @@ declare const provideHandlers: ServicePluginDefinition<{
193
193
  *
194
194
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
195
195
  *
196
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
196
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
197
197
  *
198
198
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
199
199
  *
200
- * Error handling:
201
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
202
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
203
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
200
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
204
201
  checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
205
202
  }>;
206
203
 
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.mjs';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-Bx0JDqp7.mjs';
2
+ export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, c as CheckSubscriberPermissionsResponse, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.mjs';
3
3
  import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
4
 
5
5
  declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
@@ -40,7 +40,7 @@ var provideHandlers = ServicePluginDefinition("REALTIME_PERMISSIONS_PROVIDER", [
40
40
 
41
41
  // src/interfaces-realtime-v1-realtime-permissions-provider.context.ts
42
42
  import { createServicePluginModule } from "@wix/sdk-runtime/service-plugin-modules";
43
- var provideHandlers2 = createServicePluginModule(
43
+ var provideHandlers2 = /* @__PURE__ */ createServicePluginModule(
44
44
  provideHandlers
45
45
  );
46
46
 
@@ -58,9 +58,11 @@ var InvalidArgumentWixError = class extends Error {
58
58
  applicationCode: "INVALID_ARGUMENT"
59
59
  };
60
60
  }
61
+ static {
62
+ /** @hidden */
63
+ this.__type = "wix_spi_error";
64
+ }
61
65
  };
62
- /** @hidden */
63
- InvalidArgumentWixError.__type = "wix_spi_error";
64
66
  export {
65
67
  IdentityType,
66
68
  InvalidArgumentWixError,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
1
+ {"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n /**\n * When `true`, the subscriber may **send** client events on the channel.\n * Internal. Currently unused.\n * @internal\n */\n write?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Extension ID in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionId?: string | null;\n /**\n * Extension type in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionType?: string | null;\n /**\n * Invoked function.\n * @internal\n * @maxLength 256\n */\n functionName?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = /*#__PURE__*/ createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AAoHL,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;;;AChKZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAiB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACjDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGkC;AAAA,EAC7C;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;AAAA,EAGA;AAAA;AAAA,SAAgB,SAAS;AAAA;AAC3B;","names":["SubscriberType","IdentityType","provideHandlers"]}
@@ -1,5 +1,5 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.mjs';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-Bx0JDqp7.mjs';
2
+ export { A as AlternativeUri, a as Channel, C as CheckSubscriberPermissionsRequest, e as Context, f as IdentificationData, g as IdentificationDataIdOneOf, I as IdentityType, h as InvalidArgumentWixError, R as RealtimePermissionsProviderConfig, d as SpiBaseUri, S as Subscriber, b as SubscriberType } from './service-plugins-error-classes-Bx0JDqp7.mjs';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
7
7
  *
8
8
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
9
9
  *
10
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
10
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
11
11
  *
12
12
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
13
13
  *
14
- * Error handling:
15
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
16
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
17
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
14
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
18
15
  * @throws InvalidArgumentWixError
19
16
  */
20
17
  declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
@@ -12,9 +12,11 @@ var InvalidArgumentWixError = class extends Error {
12
12
  applicationCode: "INVALID_ARGUMENT"
13
13
  };
14
14
  }
15
+ static {
16
+ /** @hidden */
17
+ this.__type = "wix_spi_error";
18
+ }
15
19
  };
16
- /** @hidden */
17
- InvalidArgumentWixError.__type = "wix_spi_error";
18
20
 
19
21
  // src/service-plugins-types.ts
20
22
  var SubscriberType = /* @__PURE__ */ ((SubscriberType2) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AAAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
1
+ {"version":3,"sources":["../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n /**\n * When `true`, the subscriber may **send** client events on the channel.\n * Internal. Currently unused.\n * @internal\n */\n write?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Extension ID in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionId?: string | null;\n /**\n * Extension type in Dev Center.\n * @internal\n * @maxLength 256\n */\n appExtensionType?: string | null;\n /**\n * Invoked function.\n * @internal\n * @maxLength 256\n */\n functionName?: 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;AAAA,EAGA;AAAA;AAAA,SAAgB,SAAS;AAAA;AAC3B;;;ACcO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AAoHL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
@@ -29,7 +29,7 @@ interface Channel {
29
29
  /** Subscriber to a channel or resource. */
30
30
  interface Subscriber {
31
31
  /**
32
- * Subscriber ID.
32
+ * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
33
33
  * @maxLength 1000
34
34
  */
35
35
  _id?: string;
@@ -193,14 +193,11 @@ declare const provideHandlers: ServicePluginDefinition<{
193
193
  *
194
194
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
195
195
  *
196
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
196
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
197
197
  *
198
198
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
199
199
  *
200
- * Error handling:
201
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
202
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
203
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
200
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
204
201
  checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
205
202
  }>;
206
203
 
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.js';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-BUWgDF3H.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-BUWgDF3H.js';
3
3
  import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
4
 
5
5
  declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
@@ -1,5 +1,5 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.js';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-BUWgDF3H.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-BUWgDF3H.js';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
7
7
  *
8
8
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
9
9
  *
10
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
10
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
11
11
  *
12
12
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
13
13
  *
14
- * Error handling:
15
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
16
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
17
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
14
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
18
15
  * @throws InvalidArgumentWixError
19
16
  */
20
17
  declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
@@ -29,7 +29,7 @@ interface Channel {
29
29
  /** Subscriber to a channel or resource. */
30
30
  interface Subscriber {
31
31
  /**
32
- * Subscriber ID.
32
+ * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
33
33
  * @maxLength 1000
34
34
  */
35
35
  _id?: string;
@@ -55,6 +55,12 @@ declare enum SubscriberType {
55
55
  interface CheckSubscriberPermissionsResponse {
56
56
  /** Whether the subscriber may receive messages on the channel. */
57
57
  read?: boolean;
58
+ /**
59
+ * When `true`, the subscriber may **send** client events on the channel.
60
+ * Internal. Currently unused.
61
+ * @internal
62
+ */
63
+ write?: boolean;
58
64
  }
59
65
  /** Configuration for the Realtime Permissions Provider service plugin. */
60
66
  interface RealtimePermissionsProviderConfig {
@@ -126,6 +132,24 @@ interface Context {
126
132
  * @format GUID
127
133
  */
128
134
  instanceId?: string | null;
135
+ /**
136
+ * Extension ID in Dev Center.
137
+ * @internal
138
+ * @maxLength 256
139
+ */
140
+ appExtensionId?: string | null;
141
+ /**
142
+ * Extension type in Dev Center.
143
+ * @internal
144
+ * @maxLength 256
145
+ */
146
+ appExtensionType?: string | null;
147
+ /**
148
+ * Invoked function.
149
+ * @internal
150
+ * @maxLength 256
151
+ */
152
+ functionName?: string | null;
129
153
  }
130
154
  declare enum IdentityType {
131
155
  UNKNOWN = "UNKNOWN",
@@ -193,14 +217,11 @@ declare const provideHandlers: ServicePluginDefinition<{
193
217
  *
194
218
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
195
219
  *
196
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
220
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
197
221
  *
198
222
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
199
223
  *
200
- * Error handling:
201
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
202
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
203
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
224
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
204
225
  checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
205
226
  }>;
206
227
 
@@ -1,5 +1,5 @@
1
- import { p as provideHandlers$1 } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.mjs';
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-BUWgDF3H.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-BUWgDF3H.mjs';
3
3
  import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
4
 
5
5
  declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
@@ -1,5 +1,5 @@
1
- import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-B7a57gue.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-B7a57gue.mjs';
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-BUWgDF3H.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-BUWgDF3H.mjs';
3
3
  import '@wix/sdk-types';
4
4
 
5
5
  /**
@@ -7,14 +7,11 @@ import '@wix/sdk-types';
7
7
  *
8
8
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
9
9
  *
10
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
10
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
11
11
  *
12
12
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
13
13
  *
14
- * Error handling:
15
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
16
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
17
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.
14
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code.
18
15
  * @throws InvalidArgumentWixError
19
16
  */
20
17
  declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
@@ -29,7 +29,7 @@ interface Channel {
29
29
  /** Subscriber to a channel or resource. */
30
30
  interface Subscriber {
31
31
  /**
32
- * Subscriber ID.
32
+ * Subscriber ID. For `ADMIN` and `MEMBER` subscribers, this is the member ID from the [Members API](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/introduction). May be empty for `VISITOR` subscribers.
33
33
  * @maxLength 1000
34
34
  */
35
35
  _id?: string;
@@ -55,6 +55,12 @@ declare enum SubscriberType {
55
55
  interface CheckSubscriberPermissionsResponse {
56
56
  /** Whether the subscriber may receive messages on the channel. */
57
57
  read?: boolean;
58
+ /**
59
+ * When `true`, the subscriber may **send** client events on the channel.
60
+ * Internal. Currently unused.
61
+ * @internal
62
+ */
63
+ write?: boolean;
58
64
  }
59
65
  /** Configuration for the Realtime Permissions Provider service plugin. */
60
66
  interface RealtimePermissionsProviderConfig {
@@ -126,6 +132,24 @@ interface Context {
126
132
  * @format GUID
127
133
  */
128
134
  instanceId?: string | null;
135
+ /**
136
+ * Extension ID in Dev Center.
137
+ * @internal
138
+ * @maxLength 256
139
+ */
140
+ appExtensionId?: string | null;
141
+ /**
142
+ * Extension type in Dev Center.
143
+ * @internal
144
+ * @maxLength 256
145
+ */
146
+ appExtensionType?: string | null;
147
+ /**
148
+ * Invoked function.
149
+ * @internal
150
+ * @maxLength 256
151
+ */
152
+ functionName?: string | null;
129
153
  }
130
154
  declare enum IdentityType {
131
155
  UNKNOWN = "UNKNOWN",
@@ -193,14 +217,11 @@ declare const provideHandlers: ServicePluginDefinition<{
193
217
  *
194
218
  * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.
195
219
  *
196
- * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.
220
+ * Wix uses the `read` value in your response to allow or deny the subscription. Return `{ read: true }` to allow the subscriber to receive messages on the specified channel or resource, or `{ read: false }` to deny.
197
221
  *
198
222
  * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).
199
223
  *
200
- * Error handling:
201
- * - Don't throw an error for normal denials. Use `{ read: false }` instead.
202
- * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.
203
- * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */
224
+ * *Error handling:** Use `{ read: false }` for normal policy denials. Don't throw an error to deny access. Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. For any other failure (thrown error, timeout, or unreachable service), Wix denies the subscription with a 503 HTTP status code. */
204
225
  checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
205
226
  }>;
206
227
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/auto_sdk_duplexer_realtime-permissions-provider",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -16,22 +16,15 @@
16
16
  "require": "./build/cjs/index.js",
17
17
  "types": "./build/es/index.d.mts"
18
18
  },
19
- "./package.json": "./package.json",
20
- "./meta": {
21
- "import": "./build/es/meta.mjs",
22
- "require": "./build/cjs/meta.js",
23
- "types": "./build/es/meta.d.mts"
24
- }
19
+ "./package.json": "./package.json"
25
20
  },
26
21
  "files": [
27
22
  "build",
28
- "meta",
29
23
  "service-plugins"
30
24
  ],
31
25
  "dependencies": {
32
- "@wix/sdk-runtime": "^1.0.12",
33
- "@wix/sdk-types": "^1.17.7",
34
- "zod": "^4.3.6"
26
+ "@wix/sdk-runtime": "^1.0.24",
27
+ "@wix/sdk-types": "^1.17.11"
35
28
  },
36
29
  "devDependencies": {
37
30
  "tsup": "^8.4.0",
@@ -51,5 +44,5 @@
51
44
  "fqdn": "wix.interfaces.realtime.v1.realtime_permissions_provider"
52
45
  }
53
46
  },
54
- "falconPackageHash": "b926ad6417d5220b49c22c8f512eec6eb6f1babea0a0b79e9ad392a6"
47
+ "falconPackageHash": "683bbd4f504cfdbdc2bf29fbc3962d0fd8e91840676a21ea15818496"
55
48
  }
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- IdentityType: () => IdentityType,
24
- InvalidArgumentWixError: () => InvalidArgumentWixError,
25
- SubscriberType: () => SubscriberType,
26
- provideHandlers: () => provideHandlers2,
27
- publicProvideHandlers: () => provideHandlers
28
- });
29
- module.exports = __toCommonJS(index_exports);
30
-
31
- // src/service-plugins-types.ts
32
- var SubscriberType = /* @__PURE__ */ ((SubscriberType2) => {
33
- SubscriberType2["SUBSCRIBER_TYPE_UNSPECIFIED"] = "SUBSCRIBER_TYPE_UNSPECIFIED";
34
- SubscriberType2["ADMIN"] = "ADMIN";
35
- SubscriberType2["MEMBER"] = "MEMBER";
36
- SubscriberType2["VISITOR"] = "VISITOR";
37
- return SubscriberType2;
38
- })(SubscriberType || {});
39
- var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
40
- IdentityType2["UNKNOWN"] = "UNKNOWN";
41
- IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
42
- IdentityType2["MEMBER"] = "MEMBER";
43
- IdentityType2["WIX_USER"] = "WIX_USER";
44
- IdentityType2["APP"] = "APP";
45
- return IdentityType2;
46
- })(IdentityType || {});
47
-
48
- // src/interfaces-realtime-v1-realtime-permissions-provider.public.ts
49
- var import_sdk_types = require("@wix/sdk-types");
50
- var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
51
- var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("REALTIME_PERMISSIONS_PROVIDER", [
52
- {
53
- name: "checkSubscriberPermissions",
54
- primaryHttpMappingPath: "/v1/check-subscriber-permissions",
55
- transformations: {
56
- toREST: (payload) => {
57
- const toRestResponse = payload;
58
- return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
59
- },
60
- fromREST: (payload) => {
61
- const fromRestRequest = payload;
62
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
63
- }
64
- }
65
- }
66
- ]);
67
-
68
- // src/interfaces-realtime-v1-realtime-permissions-provider.context.ts
69
- var import_service_plugin_modules = require("@wix/sdk-runtime/service-plugin-modules");
70
- var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(
71
- provideHandlers
72
- );
73
-
74
- // src/service-plugins-error-classes.ts
75
- var InvalidArgumentWixError = class extends Error {
76
- constructor() {
77
- super("InvalidArgumentError");
78
- this.httpCode = 400;
79
- this.statusCode = "INVALID_ARGUMENT";
80
- this.applicationCode = "INVALID_ARGUMENT";
81
- this.name = "InvalidArgumentError";
82
- this.errorType = "SPI";
83
- this.spiErrorData = {
84
- name: "InvalidArgumentError",
85
- applicationCode: "INVALID_ARGUMENT"
86
- };
87
- }
88
- };
89
- /** @hidden */
90
- InvalidArgumentWixError.__type = "wix_spi_error";
91
- // Annotate the CommonJS export names for ESM import in node:
92
- 0 && (module.exports = {
93
- IdentityType,
94
- InvalidArgumentWixError,
95
- SubscriberType,
96
- provideHandlers,
97
- publicProvideHandlers
98
- });
99
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../index.ts","../../../src/service-plugins-types.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC4CO,IAAK,iBAAL,kBAAKC,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // index.typings.ts
21
- var index_typings_exports = {};
22
- __export(index_typings_exports, {
23
- IdentityType: () => IdentityType,
24
- InvalidArgumentWixError: () => InvalidArgumentWixError,
25
- SubscriberType: () => SubscriberType
26
- });
27
- module.exports = __toCommonJS(index_typings_exports);
28
-
29
- // src/service-plugins-error-classes.ts
30
- var InvalidArgumentWixError = class extends Error {
31
- constructor() {
32
- super("InvalidArgumentError");
33
- this.httpCode = 400;
34
- this.statusCode = "INVALID_ARGUMENT";
35
- this.applicationCode = "INVALID_ARGUMENT";
36
- this.name = "InvalidArgumentError";
37
- this.errorType = "SPI";
38
- this.spiErrorData = {
39
- name: "InvalidArgumentError",
40
- applicationCode: "INVALID_ARGUMENT"
41
- };
42
- }
43
- };
44
- /** @hidden */
45
- InvalidArgumentWixError.__type = "wix_spi_error";
46
-
47
- // src/service-plugins-types.ts
48
- var SubscriberType = /* @__PURE__ */ ((SubscriberType2) => {
49
- SubscriberType2["SUBSCRIBER_TYPE_UNSPECIFIED"] = "SUBSCRIBER_TYPE_UNSPECIFIED";
50
- SubscriberType2["ADMIN"] = "ADMIN";
51
- SubscriberType2["MEMBER"] = "MEMBER";
52
- SubscriberType2["VISITOR"] = "VISITOR";
53
- return SubscriberType2;
54
- })(SubscriberType || {});
55
- var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
56
- IdentityType2["UNKNOWN"] = "UNKNOWN";
57
- IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
58
- IdentityType2["MEMBER"] = "MEMBER";
59
- IdentityType2["WIX_USER"] = "WIX_USER";
60
- IdentityType2["APP"] = "APP";
61
- return IdentityType2;
62
- })(IdentityType || {});
63
- // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- IdentityType,
66
- InvalidArgumentWixError,
67
- SubscriberType
68
- });
69
- //# sourceMappingURL=index.typings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../index.typings.ts","../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it.\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
@@ -1,71 +0,0 @@
1
- // src/service-plugins-types.ts
2
- var SubscriberType = /* @__PURE__ */ ((SubscriberType2) => {
3
- SubscriberType2["SUBSCRIBER_TYPE_UNSPECIFIED"] = "SUBSCRIBER_TYPE_UNSPECIFIED";
4
- SubscriberType2["ADMIN"] = "ADMIN";
5
- SubscriberType2["MEMBER"] = "MEMBER";
6
- SubscriberType2["VISITOR"] = "VISITOR";
7
- return SubscriberType2;
8
- })(SubscriberType || {});
9
- var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
10
- IdentityType2["UNKNOWN"] = "UNKNOWN";
11
- IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
12
- IdentityType2["MEMBER"] = "MEMBER";
13
- IdentityType2["WIX_USER"] = "WIX_USER";
14
- IdentityType2["APP"] = "APP";
15
- return IdentityType2;
16
- })(IdentityType || {});
17
-
18
- // src/interfaces-realtime-v1-realtime-permissions-provider.public.ts
19
- import { ServicePluginDefinition } from "@wix/sdk-types";
20
- import {
21
- renameKeysFromSDKRequestToRESTRequest,
22
- renameKeysFromRESTResponseToSDKResponse
23
- } from "@wix/sdk-runtime/rename-all-nested-keys";
24
- var provideHandlers = ServicePluginDefinition("REALTIME_PERMISSIONS_PROVIDER", [
25
- {
26
- name: "checkSubscriberPermissions",
27
- primaryHttpMappingPath: "/v1/check-subscriber-permissions",
28
- transformations: {
29
- toREST: (payload) => {
30
- const toRestResponse = payload;
31
- return renameKeysFromSDKRequestToRESTRequest(toRestResponse);
32
- },
33
- fromREST: (payload) => {
34
- const fromRestRequest = payload;
35
- return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);
36
- }
37
- }
38
- }
39
- ]);
40
-
41
- // src/interfaces-realtime-v1-realtime-permissions-provider.context.ts
42
- import { createServicePluginModule } from "@wix/sdk-runtime/service-plugin-modules";
43
- var provideHandlers2 = createServicePluginModule(
44
- provideHandlers
45
- );
46
-
47
- // src/service-plugins-error-classes.ts
48
- var InvalidArgumentWixError = class extends Error {
49
- constructor() {
50
- super("InvalidArgumentError");
51
- this.httpCode = 400;
52
- this.statusCode = "INVALID_ARGUMENT";
53
- this.applicationCode = "INVALID_ARGUMENT";
54
- this.name = "InvalidArgumentError";
55
- this.errorType = "SPI";
56
- this.spiErrorData = {
57
- name: "InvalidArgumentError",
58
- applicationCode: "INVALID_ARGUMENT"
59
- };
60
- }
61
- };
62
- /** @hidden */
63
- InvalidArgumentWixError.__type = "wix_spi_error";
64
- export {
65
- IdentityType,
66
- InvalidArgumentWixError,
67
- SubscriberType,
68
- provideHandlers2 as provideHandlers,
69
- provideHandlers as publicProvideHandlers
70
- };
71
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-plugins-types.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to receive messages on a Wix Realtime channel.\n *\n * Wix calls this method when a subscriber from another app attempts a [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) to one of your app's channels. The call is synchronous: Wix waits for your response before allowing or denying the subscription.\n *\n * To allow the subscriber to receive messages on the specified channel or resource, return `{ read: true }`. To deny, return `{ read: false }`.\n *\n * Learn more about [the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n *\n * Error handling:\n * - Don't throw an error for normal denials. Use `{ read: false }` instead.\n * - If your service throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.\n * - Return `InvalidArgumentError` only when the request contains invalid or missing data that prevents your service from processing it. */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA4CO,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxIZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAoB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACpDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
@@ -1,40 +0,0 @@
1
- // src/service-plugins-error-classes.ts
2
- var InvalidArgumentWixError = class extends Error {
3
- constructor() {
4
- super("InvalidArgumentError");
5
- this.httpCode = 400;
6
- this.statusCode = "INVALID_ARGUMENT";
7
- this.applicationCode = "INVALID_ARGUMENT";
8
- this.name = "InvalidArgumentError";
9
- this.errorType = "SPI";
10
- this.spiErrorData = {
11
- name: "InvalidArgumentError",
12
- applicationCode: "INVALID_ARGUMENT"
13
- };
14
- }
15
- };
16
- /** @hidden */
17
- InvalidArgumentWixError.__type = "wix_spi_error";
18
-
19
- // src/service-plugins-types.ts
20
- var SubscriberType = /* @__PURE__ */ ((SubscriberType2) => {
21
- SubscriberType2["SUBSCRIBER_TYPE_UNSPECIFIED"] = "SUBSCRIBER_TYPE_UNSPECIFIED";
22
- SubscriberType2["ADMIN"] = "ADMIN";
23
- SubscriberType2["MEMBER"] = "MEMBER";
24
- SubscriberType2["VISITOR"] = "VISITOR";
25
- return SubscriberType2;
26
- })(SubscriberType || {});
27
- var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
28
- IdentityType2["UNKNOWN"] = "UNKNOWN";
29
- IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
30
- IdentityType2["MEMBER"] = "MEMBER";
31
- IdentityType2["WIX_USER"] = "WIX_USER";
32
- IdentityType2["APP"] = "APP";
33
- return IdentityType2;
34
- })(IdentityType || {});
35
- export {
36
- IdentityType,
37
- InvalidArgumentWixError,
38
- SubscriberType
39
- };
40
- //# sourceMappingURL=index.typings.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/service-plugins-error-classes.ts","../../../src/service-plugins-types.ts"],"sourcesContent":["export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** [Channel or resource](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) that the subscriber is attempting to join. */\n channel?: Channel;\n /** [Subscriber](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) attempting the subscription. */\n subscriber?: Subscriber;\n /**\n * ID of the app attempting the [cross-app subscription](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions). When empty, the app context is unavailable.\n * @format GUID\n */\n requestingAppId?: string | null;\n}\n\n/** Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them. */\nexport interface Channel {\n /**\n * Channel name. Supports only alphanumeric characters, hyphens, and underscores.\n * @maxLength 140\n */\n name?: string;\n /**\n * Resource ID. Resources are independent sub-channels within a channel.\n * A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa.\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\n/** Subscriber to a channel or resource. */\nexport interface Subscriber {\n /**\n * Subscriber ID.\n * @maxLength 1000\n */\n _id?: string;\n /**\n * Subscriber identity type.\n *\n * Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).\n */\n type?: SubscriberType;\n}\n\n/** Subscriber identity type. Learn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities). */\nexport enum SubscriberType {\n /** Unknown subscriber type. */\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** [Wix user](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#wix-user). */\n ADMIN = 'ADMIN',\n /** Logged-in [site member](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#member). */\n MEMBER = 'MEMBER',\n /** [Site visitor](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities#visitor). */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber may receive messages on the channel. */\n read?: boolean;\n}\n\n/** Configuration for the Realtime Permissions Provider service plugin. */\nexport interface RealtimePermissionsProviderConfig {\n /** URI configuration for this service plugin. Wix calls your service plugin methods at these URIs. */\n deploymentUri?: SpiBaseUri;\n /**\n * Display name for this permissions provider in the [app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-workspace/about-the-app-dashboard).\n * @maxLength 100\n */\n providerName?: string;\n}\n\n/** Base URI configuration for a service plugin. Wix uses these URIs to call your service plugin methods. */\nexport interface SpiBaseUri {\n /**\n * Base URI for your service plugin. Wix appends each method's path to this URI.\n *\n * For example, to receive requests at `https://my-app.com/v1/my-method`, set this field to `https://my-app.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternative URIs for specific methods. Use these to override the default URI for individual methods. */\n alternativeUris?: AlternativeUri[];\n}\n\n/** Custom URI for the specified service plugin method. */\nexport interface AlternativeUri {\n /**\n * Name of the method to call at the absolute URI, in PascalCase. For example, to call [Get Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/shipping-rates/shipping-rates-integration-service-plugin/get-shipping-rates) on an alternative URI, specify `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Absolute URI that Wix calls for this method. Wix doesn't append any path to this URI.\n *\n * The URI must begin with `https://`, such as `https://my-app.com/v1/my-custom-method`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AAAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACepB,IAAK,iBAAL,kBAAKA,oBAAL;AAEL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AARA,SAAAA;AAAA,GAAA;AA4FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}