tinacms-clerk 13.0.1 → 14.0.1
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/dist/index.js +4 -28
- package/dist/tinacms.js +65 -68
- package/package.json +4 -4
- package/dist/tinacms.mjs +0 -70
package/dist/index.js
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
1
|
// src/index.ts
|
|
20
|
-
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
ClerkBackendAuthentication: () => ClerkBackendAuthentication
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(index_exports);
|
|
25
|
-
var import_backend = require("@clerk/backend");
|
|
2
|
+
import { Clerk } from "@clerk/backend";
|
|
26
3
|
var ClerkBackendAuthentication = ({
|
|
27
4
|
secretKey,
|
|
28
5
|
allowList,
|
|
29
6
|
orgId
|
|
30
7
|
}) => {
|
|
31
|
-
const clerk =
|
|
8
|
+
const clerk = Clerk({
|
|
32
9
|
secretKey
|
|
33
10
|
});
|
|
34
11
|
return {
|
|
@@ -72,7 +49,6 @@ var ClerkBackendAuthentication = ({
|
|
|
72
49
|
}
|
|
73
50
|
};
|
|
74
51
|
};
|
|
75
|
-
|
|
76
|
-
0 && (module.exports = {
|
|
52
|
+
export {
|
|
77
53
|
ClerkBackendAuthentication
|
|
78
|
-
}
|
|
54
|
+
};
|
package/dist/tinacms.js
CHANGED
|
@@ -1,73 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
await this.clerk.load();
|
|
21
|
-
if (this.clerk.session) {
|
|
22
|
-
return { id_token: await this.clerk.session.getToken() };
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async logout() {
|
|
26
|
-
var _a, _b, _c;
|
|
27
|
-
await ((_a = this.clerk) == null ? void 0 : _a.load());
|
|
28
|
-
await ((_c = (_b = this.clerk) == null ? void 0 : _b.session) == null ? void 0 : _c.remove());
|
|
29
|
-
}
|
|
30
|
-
async authenticate() {
|
|
31
|
-
this.clerk.openSignIn({
|
|
32
|
-
redirectUrl: "/admin/index.html",
|
|
33
|
-
// This should be the Tina admin path
|
|
34
|
-
appearance: {
|
|
35
|
-
elements: {
|
|
36
|
-
// Tina's sign in modal is in the way without this
|
|
37
|
-
modalBackdrop: { zIndex: 2e4 },
|
|
38
|
-
// Some styles clash with Tina's styling
|
|
39
|
-
socialButtonsBlockButton: "px-4 py-2 border border-gray-100",
|
|
40
|
-
formFieldInput: `px-4 py-2`,
|
|
41
|
-
formButtonPrimary: "bg-blue-600 text-white p-4",
|
|
42
|
-
formFieldInputShowPasswordButton: "m-2",
|
|
43
|
-
dividerText: "px-2"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
1
|
+
import { AbstractAuthProvider } from "tinacms";
|
|
2
|
+
class ClerkAuthProvider extends AbstractAuthProvider {
|
|
3
|
+
constructor({
|
|
4
|
+
orgId,
|
|
5
|
+
clerk,
|
|
6
|
+
allowedList
|
|
7
|
+
}) {
|
|
8
|
+
super();
|
|
9
|
+
this.clerk = clerk;
|
|
10
|
+
this.allowedList = allowedList;
|
|
11
|
+
this.orgId = orgId;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates a short-lived token when Tina makes a request
|
|
15
|
+
*/
|
|
16
|
+
async getToken() {
|
|
17
|
+
await this.clerk.load();
|
|
18
|
+
if (this.clerk.session) {
|
|
19
|
+
return { id_token: await this.clerk.session.getToken() };
|
|
47
20
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
21
|
+
}
|
|
22
|
+
async logout() {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
await ((_a = this.clerk) == null ? void 0 : _a.load());
|
|
25
|
+
await ((_c = (_b = this.clerk) == null ? void 0 : _b.session) == null ? void 0 : _c.remove());
|
|
26
|
+
}
|
|
27
|
+
async authenticate() {
|
|
28
|
+
this.clerk.openSignIn({
|
|
29
|
+
redirectUrl: "/admin/index.html",
|
|
30
|
+
// This should be the Tina admin path
|
|
31
|
+
appearance: {
|
|
32
|
+
elements: {
|
|
33
|
+
// Tina's sign in modal is in the way without this
|
|
34
|
+
modalBackdrop: { zIndex: 2e4 },
|
|
35
|
+
// Some styles clash with Tina's styling
|
|
36
|
+
socialButtonsBlockButton: "px-4 py-2 border border-gray-100",
|
|
37
|
+
formFieldInput: `px-4 py-2`,
|
|
38
|
+
formButtonPrimary: "bg-blue-600 text-white p-4",
|
|
39
|
+
formFieldInputShowPasswordButton: "m-2",
|
|
40
|
+
dividerText: "px-2"
|
|
60
41
|
}
|
|
61
|
-
return true;
|
|
62
42
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async authorize(context) {
|
|
46
|
+
await this.clerk.load();
|
|
47
|
+
if (this.clerk.user) {
|
|
48
|
+
if (this.allowedList && !this.allowedList.includes(
|
|
49
|
+
this.clerk.user.primaryEmailAddress.emailAddress
|
|
50
|
+
)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (this.orgId && !this.clerk.user.organizationMemberships.find(
|
|
54
|
+
(x) => x.id === this.orgId
|
|
55
|
+
)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
69
59
|
}
|
|
60
|
+
await this.clerk.session.end();
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
async getUser() {
|
|
64
|
+
await this.clerk.load();
|
|
65
|
+
return this.clerk.user;
|
|
70
66
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
ClerkAuthProvider
|
|
70
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms-clerk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.
|
|
5
|
+
"module": "./dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"@types/node": "^22.13.1",
|
|
24
24
|
"typescript": "^5.7.3",
|
|
25
25
|
"@tinacms/scripts": "1.4.1",
|
|
26
|
-
"tinacms": "
|
|
26
|
+
"tinacms": "3.0.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@clerk/backend": "0.x",
|
|
30
30
|
"@clerk/clerk-js": "4.x",
|
|
31
|
-
"tinacms": "
|
|
31
|
+
"tinacms": "3.0.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"registry": "https://registry.npmjs.org"
|
package/dist/tinacms.mjs
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { AbstractAuthProvider } from "tinacms";
|
|
2
|
-
class ClerkAuthProvider extends AbstractAuthProvider {
|
|
3
|
-
constructor({
|
|
4
|
-
orgId,
|
|
5
|
-
clerk,
|
|
6
|
-
allowedList
|
|
7
|
-
}) {
|
|
8
|
-
super();
|
|
9
|
-
this.clerk = clerk;
|
|
10
|
-
this.allowedList = allowedList;
|
|
11
|
-
this.orgId = orgId;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Generates a short-lived token when Tina makes a request
|
|
15
|
-
*/
|
|
16
|
-
async getToken() {
|
|
17
|
-
await this.clerk.load();
|
|
18
|
-
if (this.clerk.session) {
|
|
19
|
-
return { id_token: await this.clerk.session.getToken() };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async logout() {
|
|
23
|
-
var _a, _b, _c;
|
|
24
|
-
await ((_a = this.clerk) == null ? void 0 : _a.load());
|
|
25
|
-
await ((_c = (_b = this.clerk) == null ? void 0 : _b.session) == null ? void 0 : _c.remove());
|
|
26
|
-
}
|
|
27
|
-
async authenticate() {
|
|
28
|
-
this.clerk.openSignIn({
|
|
29
|
-
redirectUrl: "/admin/index.html",
|
|
30
|
-
// This should be the Tina admin path
|
|
31
|
-
appearance: {
|
|
32
|
-
elements: {
|
|
33
|
-
// Tina's sign in modal is in the way without this
|
|
34
|
-
modalBackdrop: { zIndex: 2e4 },
|
|
35
|
-
// Some styles clash with Tina's styling
|
|
36
|
-
socialButtonsBlockButton: "px-4 py-2 border border-gray-100",
|
|
37
|
-
formFieldInput: `px-4 py-2`,
|
|
38
|
-
formButtonPrimary: "bg-blue-600 text-white p-4",
|
|
39
|
-
formFieldInputShowPasswordButton: "m-2",
|
|
40
|
-
dividerText: "px-2"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
async authorize(context) {
|
|
46
|
-
await this.clerk.load();
|
|
47
|
-
if (this.clerk.user) {
|
|
48
|
-
if (this.allowedList && !this.allowedList.includes(
|
|
49
|
-
this.clerk.user.primaryEmailAddress.emailAddress
|
|
50
|
-
)) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (this.orgId && !this.clerk.user.organizationMemberships.find(
|
|
54
|
-
(x) => x.id === this.orgId
|
|
55
|
-
)) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
await this.clerk.session.end();
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
async getUser() {
|
|
64
|
-
await this.clerk.load();
|
|
65
|
-
return this.clerk.user;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
ClerkAuthProvider
|
|
70
|
-
};
|