@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 +2 -1
- package/build/index.js +2 -1
- package/build/web-methods.d.ts +8 -0
- package/build/web-methods.js +14 -0
- package/cjs/build/index.d.ts +2 -1
- package/cjs/build/index.js +20 -8
- package/cjs/build/web-methods.d.ts +8 -0
- package/cjs/build/web-methods.js +18 -0
- package/package.json +7 -7
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -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 = {}));
|
package/cjs/build/index.d.ts
CHANGED
package/cjs/build/index.js
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
46
|
+
"@types/node": "^20.17.9",
|
|
47
47
|
"@vitest/ui": "^1.6.0",
|
|
48
|
-
"@wix/sdk": "1.14.
|
|
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.
|
|
55
|
-
"typescript": "^5.
|
|
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": "
|
|
76
|
+
"falconPackageHash": "89b3fc54d75286af87e57b252a4f02bc1fc55b7fc2d44a71e9faf0b4"
|
|
77
77
|
}
|