@wix/essentials 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as httpClient from './http-client.js';
3
- export { auth, httpClient };
3
+ import * as webMethods from './web-methods.js';
4
+ export { auth, httpClient, webMethods };
4
5
  export { i18n } from './i18n.js';
package/build/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as httpClient from './http-client.js';
3
- export { auth, httpClient };
3
+ import * as webMethods from './web-methods.js';
4
+ export { auth, httpClient, webMethods };
4
5
  export { i18n } from './i18n.js';
@@ -0,0 +1,8 @@
1
+ type Handler<T extends unknown[], R> = (...args: T) => R;
2
+ export declare function webMethod<T extends unknown[], R>(permission: Permissions, handler: Handler<T, R>): Handler<T, Promise<Awaited<R>>>;
3
+ export declare enum Permissions {
4
+ Anyone = "anyone",
5
+ Admin = "admin",
6
+ SiteMember = "site-member"
7
+ }
8
+ export {};
@@ -0,0 +1,14 @@
1
+ // https://dev.wix.com/docs/velo/api-reference/wix-web-module/introduction
2
+ export function webMethod(permission, handler) {
3
+ return {
4
+ handler,
5
+ permission,
6
+ // The type assertion is necessary so developers using this get the types they expect
7
+ };
8
+ }
9
+ export var Permissions;
10
+ (function (Permissions) {
11
+ Permissions["Anyone"] = "anyone";
12
+ Permissions["Admin"] = "admin";
13
+ Permissions["SiteMember"] = "site-member";
14
+ })(Permissions || (Permissions = {}));
@@ -1,4 +1,5 @@
1
1
  import * as auth from './auth.js';
2
2
  import * as httpClient from './http-client.js';
3
- export { auth, httpClient };
3
+ import * as webMethods from './web-methods.js';
4
+ export { auth, httpClient, webMethods };
4
5
  export { i18n } from './i18n.js';
@@ -15,18 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.i18n = exports.httpClient = exports.auth = void 0;
36
+ exports.i18n = exports.webMethods = exports.httpClient = exports.auth = void 0;
27
37
  const auth = __importStar(require("./auth.js"));
28
38
  exports.auth = auth;
29
39
  const httpClient = __importStar(require("./http-client.js"));
30
40
  exports.httpClient = httpClient;
41
+ const webMethods = __importStar(require("./web-methods.js"));
42
+ exports.webMethods = webMethods;
31
43
  var i18n_js_1 = require("./i18n.js");
32
44
  Object.defineProperty(exports, "i18n", { enumerable: true, get: function () { return i18n_js_1.i18n; } });
@@ -0,0 +1,8 @@
1
+ type Handler<T extends unknown[], R> = (...args: T) => R;
2
+ export declare function webMethod<T extends unknown[], R>(permission: Permissions, handler: Handler<T, R>): Handler<T, Promise<Awaited<R>>>;
3
+ export declare enum Permissions {
4
+ Anyone = "anyone",
5
+ Admin = "admin",
6
+ SiteMember = "site-member"
7
+ }
8
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Permissions = void 0;
4
+ exports.webMethod = webMethod;
5
+ // https://dev.wix.com/docs/velo/api-reference/wix-web-module/introduction
6
+ function webMethod(permission, handler) {
7
+ return {
8
+ handler,
9
+ permission,
10
+ // The type assertion is necessary so developers using this get the types they expect
11
+ };
12
+ }
13
+ var Permissions;
14
+ (function (Permissions) {
15
+ Permissions["Anyone"] = "anyone";
16
+ Permissions["Admin"] = "admin";
17
+ Permissions["SiteMember"] = "site-member";
18
+ })(Permissions || (exports.Permissions = Permissions = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/essentials",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "license": "UNLICENSED",
5
5
  "main": "cjs/build/index.js",
6
6
  "module": "build/index.mjs",
@@ -35,7 +35,7 @@
35
35
  "*.{js,ts}": "yarn lint"
36
36
  },
37
37
  "dependencies": {
38
- "@wix/sdk-runtime": "^0.3.23",
38
+ "@wix/sdk-runtime": "^0.3.24",
39
39
  "@wix/sdk-types": "^1.12.4"
40
40
  },
41
41
  "optionalDependencies": {
@@ -43,16 +43,16 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/is-ci": "^3.0.4",
46
- "@types/node": "^20.17.5",
46
+ "@types/node": "^20.17.9",
47
47
  "@vitest/ui": "^1.6.0",
48
- "@wix/sdk": "1.14.2",
48
+ "@wix/sdk": "1.14.4",
49
49
  "eslint": "^8.57.1",
50
50
  "eslint-config-sdk": "0.0.0",
51
51
  "graphql": "^16.8.0",
52
52
  "is-ci": "^3.0.1",
53
53
  "jsdom": "^22.1.0",
54
- "msw": "^2.6.0",
55
- "typescript": "^5.6.3",
54
+ "msw": "^2.6.6",
55
+ "typescript": "^5.7.2",
56
56
  "vitest": "^1.6.0",
57
57
  "vitest-teamcity-reporter": "^0.3.1"
58
58
  },
@@ -73,5 +73,5 @@
73
73
  ]
74
74
  }
75
75
  },
76
- "falconPackageHash": "548bb4c73eaa8f466416942621fe28493745e7ef88c7f4af7ad4f84a"
76
+ "falconPackageHash": "89b3fc54d75286af87e57b252a4f02bc1fc55b7fc2d44a71e9faf0b4"
77
77
  }