@wix/auto_sdk_duplexer_realtime-permissions-provider 1.0.0

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.
@@ -0,0 +1,7 @@
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-D9-2LCrZ.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-D9-2LCrZ.js';
3
+ import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
+
5
+ declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
6
+
7
+ export { provideHandlers, provideHandlers$1 as publicProvideHandlers };
@@ -0,0 +1,99 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-realtime-v1-realtime-permissions-provider.context.js';\nexport * from './src/service-plugins-error-classes.js';\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC+BO,IAAK,iBAAL,kBAAKC,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;AC1HZ,uBAAwC;AAMxC,oCAGO;AAOA,IAAM,sBAAkB,0CAyB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACzDD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["provideHandlers","SubscriberType","IdentityType","provideHandlers"]}
@@ -0,0 +1,27 @@
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-D9-2LCrZ.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-D9-2LCrZ.js';
3
+ import '@wix/sdk-types';
4
+
5
+ /**
6
+ * Checks whether a subscriber has permission to access a realtime channel.
7
+ *
8
+ * The Realtime Permissions Provider extension allows apps to control access
9
+ * to realtime channels. When a subscriber attempts to connect to a channel,
10
+ * this method is called to determine whether the subscriber has read and/or
11
+ * write permissions for the specified channel.
12
+ *
13
+ * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
14
+ * channel and subscriber details.
15
+ * Response: A `CheckSubscriberPermissionsResponse` object containing the
16
+ * read and write permissions:
17
+ * ```json
18
+ * {
19
+ * "read": true,
20
+ * "write": false
21
+ * }
22
+ * ```
23
+ * @throws InvalidArgumentWixError
24
+ */
25
+ declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
26
+
27
+ export { CheckSubscriberPermissionsEnvelope, CheckSubscriberPermissionsResponse, checkSubscriberPermissions };
@@ -0,0 +1,69 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-error-classes.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import { CheckSubscriberPermissionsResponse } from './src/service-plugins-types.js';\nimport { CheckSubscriberPermissionsEnvelope } from './src/interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport * from './src/service-plugins-error-classes';\nexport * from './src/service-plugins-types';\nexport { CheckSubscriberPermissionsEnvelope };\n\n/**\n * Checks whether a subscriber has permission to access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ```\n * @throws InvalidArgumentWixError\n */\nexport declare function checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n","/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;;;ACEpB,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["SubscriberType","IdentityType"]}
@@ -0,0 +1,216 @@
1
+ import { ServicePluginDefinition } from '@wix/sdk-types';
2
+
3
+ /** Request to check subscriber permissions for a realtime channel. */
4
+ interface CheckSubscriberPermissionsRequest {
5
+ /** The channel to check permissions for */
6
+ channel?: Channel;
7
+ /** The subscriber requesting access */
8
+ subscriber?: Subscriber;
9
+ }
10
+ interface Channel {
11
+ /**
12
+ * Channel name. Cannot exceed 140 characters
13
+ * @maxLength 140
14
+ */
15
+ name?: string;
16
+ /**
17
+ * ID of a specific channel resource
18
+ * @maxLength 1000
19
+ */
20
+ resourceId?: string | null;
21
+ }
22
+ interface Subscriber {
23
+ /**
24
+ * The subscriber's user ID
25
+ * @maxLength 1000
26
+ */
27
+ _id?: string;
28
+ /** The type of subscriber */
29
+ type?: SubscriberType;
30
+ }
31
+ declare enum SubscriberType {
32
+ SUBSCRIBER_TYPE_UNSPECIFIED = "SUBSCRIBER_TYPE_UNSPECIFIED",
33
+ /** Subscriber is the site owner */
34
+ ADMIN = "ADMIN",
35
+ /** Subscriber is a logged-in site member */
36
+ MEMBER = "MEMBER",
37
+ /** Subscriber is not logged in */
38
+ VISITOR = "VISITOR"
39
+ }
40
+ /** Response containing the subscriber's permissions for the channel. */
41
+ interface CheckSubscriberPermissionsResponse {
42
+ /** Whether the subscriber can listen/read messages */
43
+ read?: boolean;
44
+ /** Whether the subscriber can send client events */
45
+ write?: boolean;
46
+ }
47
+ interface RealtimePermissionsProviderConfig {
48
+ /** URI where the SPI Implementer is deployed */
49
+ deploymentUri?: SpiBaseUri;
50
+ /**
51
+ * User-friendly name of the permissions provider
52
+ * @maxLength 100
53
+ */
54
+ providerName?: string;
55
+ }
56
+ interface SpiBaseUri {
57
+ /**
58
+ * Base URI where the methods are called. Wix appends the path to the `baseUri`.
59
+ * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.
60
+ * @minLength 6
61
+ * @maxLength 2048
62
+ */
63
+ baseUri?: string;
64
+ /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
65
+ alternativeUris?: AlternativeUri[];
66
+ }
67
+ interface AlternativeUri {
68
+ /**
69
+ * Name of the method to create a custom URI for.
70
+ *
71
+ * For `methodName`, use the name of the method in PascalCase.
72
+ * For example, for Get Shipping Rates use `GetShippingRates`.
73
+ * @minLength 3
74
+ * @maxLength 128
75
+ */
76
+ methodName?: string;
77
+ /**
78
+ * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.
79
+ * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.
80
+ * @minLength 6
81
+ * @maxLength 2048
82
+ */
83
+ absoluteUri?: string;
84
+ }
85
+ /**
86
+ * this message is not directly used by any service,
87
+ * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.
88
+ * e.g. SPIs, event-handlers, etc..
89
+ * NOTE: this context object MUST be provided as the last argument in each Velo method signature.
90
+ *
91
+ * Example:
92
+ * ```typescript
93
+ * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {
94
+ * ...
95
+ * }
96
+ * ```
97
+ */
98
+ interface Context {
99
+ /** 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. */
100
+ requestId?: string | null;
101
+ /**
102
+ * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.
103
+ * @format CURRENCY
104
+ */
105
+ currency?: string | null;
106
+ /** An object that describes the identity that triggered this request. */
107
+ identity?: IdentificationData;
108
+ /** 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"`. */
109
+ languages?: string[];
110
+ /**
111
+ * The service provider app's instance ID.
112
+ * @format GUID
113
+ */
114
+ instanceId?: string | null;
115
+ }
116
+ declare enum IdentityType {
117
+ UNKNOWN = "UNKNOWN",
118
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
119
+ MEMBER = "MEMBER",
120
+ WIX_USER = "WIX_USER",
121
+ APP = "APP"
122
+ }
123
+ interface IdentificationData extends IdentificationDataIdOneOf {
124
+ /**
125
+ * ID of a site visitor that has not logged in to the site.
126
+ * @format GUID
127
+ */
128
+ anonymousVisitorId?: string;
129
+ /**
130
+ * ID of a site visitor that has logged in to the site.
131
+ * @format GUID
132
+ */
133
+ memberId?: string;
134
+ /**
135
+ * ID of a Wix user (site owner, contributor, etc.).
136
+ * @format GUID
137
+ */
138
+ wixUserId?: string;
139
+ /**
140
+ * ID of an app.
141
+ * @format GUID
142
+ */
143
+ appId?: string;
144
+ /** @readonly */
145
+ identityType?: IdentityType;
146
+ }
147
+ /** @oneof */
148
+ interface IdentificationDataIdOneOf {
149
+ /**
150
+ * ID of a site visitor that has not logged in to the site.
151
+ * @format GUID
152
+ */
153
+ anonymousVisitorId?: string;
154
+ /**
155
+ * ID of a site visitor that has logged in to the site.
156
+ * @format GUID
157
+ */
158
+ memberId?: string;
159
+ /**
160
+ * ID of a Wix user (site owner, contributor, etc.).
161
+ * @format GUID
162
+ */
163
+ wixUserId?: string;
164
+ /**
165
+ * ID of an app.
166
+ * @format GUID
167
+ */
168
+ appId?: string;
169
+ }
170
+
171
+ interface CheckSubscriberPermissionsEnvelope {
172
+ request: CheckSubscriberPermissionsRequest;
173
+ metadata: Context;
174
+ }
175
+ declare const provideHandlers: ServicePluginDefinition<{
176
+ /**
177
+ *
178
+ * Checks whether a subscriber has permission to access a realtime channel.
179
+ *
180
+ * The Realtime Permissions Provider extension allows apps to control access
181
+ * to realtime channels. When a subscriber attempts to connect to a channel,
182
+ * this method is called to determine whether the subscriber has read and/or
183
+ * write permissions for the specified channel.
184
+ *
185
+ * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
186
+ * channel and subscriber details.
187
+ * Response: A `CheckSubscriberPermissionsResponse` object containing the
188
+ * read and write permissions:
189
+ * ```json
190
+ * {
191
+ * "read": true,
192
+ * "write": false
193
+ * }
194
+ * ``` */
195
+ checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
196
+ }>;
197
+
198
+ declare class InvalidArgumentWixError extends Error {
199
+ /** @hidden */
200
+ httpCode: number;
201
+ /** @hidden */
202
+ statusCode: string;
203
+ /** @hidden */
204
+ applicationCode: string;
205
+ /** @hidden */
206
+ name: string;
207
+ /** @hidden */
208
+ errorType: string;
209
+ /** @hidden */
210
+ spiErrorData: object;
211
+ constructor();
212
+ /** @hidden */
213
+ static readonly __type = "wix_spi_error";
214
+ }
215
+
216
+ export { type AlternativeUri as A, type CheckSubscriberPermissionsRequest as C, IdentityType as I, type RealtimePermissionsProviderConfig as R, type Subscriber as S, type Channel as a, SubscriberType as b, type CheckSubscriberPermissionsResponse as c, type SpiBaseUri as d, type Context as e, type IdentificationData as f, type IdentificationDataIdOneOf as g, InvalidArgumentWixError as h, type CheckSubscriberPermissionsEnvelope as i, provideHandlers as p };
@@ -0,0 +1,7 @@
1
+ import { p as provideHandlers$1 } from './service-plugins-error-classes-D9-2LCrZ.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-D9-2LCrZ.mjs';
3
+ import { BuildServicePluginDefinition } from '@wix/sdk-types';
4
+
5
+ declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
6
+
7
+ export { provideHandlers, provideHandlers$1 as publicProvideHandlers };
@@ -0,0 +1,71 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.public.ts","../../src/interfaces-realtime-v1-realtime-permissions-provider.context.ts","../../src/service-plugins-error-classes.ts"],"sourcesContent":["/** Request to check subscriber permissions for a realtime channel. */\nexport interface CheckSubscriberPermissionsRequest {\n /** The channel to check permissions for */\n channel?: Channel;\n /** The subscriber requesting access */\n subscriber?: Subscriber;\n}\n\nexport interface Channel {\n /**\n * Channel name. Cannot exceed 140 characters\n * @maxLength 140\n */\n name?: string;\n /**\n * ID of a specific channel resource\n * @maxLength 1000\n */\n resourceId?: string | null;\n}\n\nexport interface Subscriber {\n /**\n * The subscriber's user ID\n * @maxLength 1000\n */\n _id?: string;\n /** The type of subscriber */\n type?: SubscriberType;\n}\n\nexport enum SubscriberType {\n SUBSCRIBER_TYPE_UNSPECIFIED = 'SUBSCRIBER_TYPE_UNSPECIFIED',\n /** Subscriber is the site owner */\n ADMIN = 'ADMIN',\n /** Subscriber is a logged-in site member */\n MEMBER = 'MEMBER',\n /** Subscriber is not logged in */\n VISITOR = 'VISITOR',\n}\n\n/** Response containing the subscriber's permissions for the channel. */\nexport interface CheckSubscriberPermissionsResponse {\n /** Whether the subscriber can listen/read messages */\n read?: boolean;\n /** Whether the subscriber can send client events */\n write?: boolean;\n}\n\nexport interface RealtimePermissionsProviderConfig {\n /** URI where the SPI Implementer is deployed */\n deploymentUri?: SpiBaseUri;\n /**\n * User-friendly name of the permissions provider\n * @maxLength 100\n */\n providerName?: string;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** A string representing a language and region in the format of `\"xx-XX\"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash \"-\", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `\"en-US\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n CheckSubscriberPermissionsRequest,\n CheckSubscriberPermissionsResponse,\n} from './service-plugins-types.js';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface CheckSubscriberPermissionsEnvelope {\n request: CheckSubscriberPermissionsRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Checks whether a subscriber has permission to access a realtime channel.\n *\n * The Realtime Permissions Provider extension allows apps to control access\n * to realtime channels. When a subscriber attempts to connect to a channel,\n * this method is called to determine whether the subscriber has read and/or\n * write permissions for the specified channel.\n *\n * Parameter: A `CheckSubscriberPermissionsRequest` object containing the\n * channel and subscriber details.\n * Response: A `CheckSubscriberPermissionsResponse` object containing the\n * read and write permissions:\n * ```json\n * {\n * \"read\": true,\n * \"write\": false\n * }\n * ``` */\n checkSubscriberPermissions(\n payload: CheckSubscriberPermissionsEnvelope\n ):\n | CheckSubscriberPermissionsResponse\n | Promise<CheckSubscriberPermissionsResponse>;\n}>('REALTIME_PERMISSIONS_PROVIDER', [\n {\n name: 'checkSubscriberPermissions',\n primaryHttpMappingPath: '/v1/check-subscriber-permissions',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-realtime-v1-realtime-permissions-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-realtime-v1-realtime-permissions-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n","export class InvalidArgumentWixError extends Error {\n /** @hidden */\n httpCode: number;\n /** @hidden */\n statusCode: string;\n /** @hidden */\n applicationCode: string;\n /** @hidden */\n name: string;\n /** @hidden */\n errorType: string;\n /** @hidden */\n spiErrorData: object;\n\n constructor() {\n super('InvalidArgumentError');\n\n this.httpCode = 400;\n this.statusCode = 'INVALID_ARGUMENT';\n this.applicationCode = 'INVALID_ARGUMENT';\n this.name = 'InvalidArgumentError';\n this.errorType = 'SPI';\n this.spiErrorData = {\n name: 'InvalidArgumentError',\n applicationCode: 'INVALID_ARGUMENT',\n };\n }\n\n /** @hidden */\n static readonly __type = 'wix_spi_error';\n}\n"],"mappings":";AA+BO,IAAK,iBAAL,kBAAKA,oBAAL;AACL,EAAAA,gBAAA,iCAA8B;AAE9B,EAAAA,gBAAA,WAAQ;AAER,EAAAA,gBAAA,YAAS;AAET,EAAAA,gBAAA,aAAU;AAPA,SAAAA;AAAA,GAAA;AA2FL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;AC1HZ,SAAS,+BAA+B;AAMxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,kBAAkB,wBAyB5B,iCAAiC;AAAA,EAClC;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACzDD,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;;;ACZO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EAcjD,cAAc;AACZ,UAAM,sBAAsB;AAE5B,SAAK,WAAW;AAChB,SAAK,aAAa;AAClB,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,eAAe;AAAA,MAClB,MAAM;AAAA,MACN,iBAAiB;AAAA,IACnB;AAAA,EACF;AAIF;AAAA;AA9Ba,wBA6BK,SAAS;","names":["SubscriberType","IdentityType","provideHandlers"]}
@@ -0,0 +1,27 @@
1
+ import { i as CheckSubscriberPermissionsEnvelope, c as CheckSubscriberPermissionsResponse } from './service-plugins-error-classes-D9-2LCrZ.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-D9-2LCrZ.mjs';
3
+ import '@wix/sdk-types';
4
+
5
+ /**
6
+ * Checks whether a subscriber has permission to access a realtime channel.
7
+ *
8
+ * The Realtime Permissions Provider extension allows apps to control access
9
+ * to realtime channels. When a subscriber attempts to connect to a channel,
10
+ * this method is called to determine whether the subscriber has read and/or
11
+ * write permissions for the specified channel.
12
+ *
13
+ * Parameter: A `CheckSubscriberPermissionsRequest` object containing the
14
+ * channel and subscriber details.
15
+ * Response: A `CheckSubscriberPermissionsResponse` object containing the
16
+ * read and write permissions:
17
+ * ```json
18
+ * {
19
+ * "read": true,
20
+ * "write": false
21
+ * }
22
+ * ```
23
+ * @throws InvalidArgumentWixError
24
+ */
25
+ declare function checkSubscriberPermissions(payload: CheckSubscriberPermissionsEnvelope): CheckSubscriberPermissionsResponse | Promise<CheckSubscriberPermissionsResponse>;
26
+
27
+ export { CheckSubscriberPermissionsEnvelope, CheckSubscriberPermissionsResponse, checkSubscriberPermissions };
@@ -0,0 +1,40 @@
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