tinacms-clerk 0.0.0-77978b2-20250317000610 → 0.0.0-788e9fd-20250604064006

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.d.ts CHANGED
@@ -1 +1,16 @@
1
- export * from "../src/index"
1
+ import type { IncomingMessage, ServerResponse } from 'http';
2
+ export declare const ClerkBackendAuthentication: ({ secretKey, allowList, orgId, }: {
3
+ secretKey: string;
4
+ allowList?: string[];
5
+ orgId?: string;
6
+ }) => {
7
+ isAuthorized: (req: IncomingMessage, _res: ServerResponse) => Promise<{
8
+ isAuthorized: false;
9
+ errorMessage: string;
10
+ errorCode: number;
11
+ } | {
12
+ isAuthorized: true;
13
+ errorMessage?: undefined;
14
+ errorCode?: undefined;
15
+ }>;
16
+ };
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ var ClerkBackendAuthentication = ({
34
34
  return {
35
35
  isAuthorized: async (req, _res) => {
36
36
  const token = req.headers["authorization"];
37
- const tokenWithoutBearer = token == null ? void 0 : token.replace("Bearer ", "").trim();
37
+ const tokenWithoutBearer = token?.replace("Bearer ", "").trim();
38
38
  const requestState = await clerk.authenticateRequest({
39
39
  headerToken: tokenWithoutBearer
40
40
  });
@@ -43,10 +43,7 @@ var ClerkBackendAuthentication = ({
43
43
  if (orgId) {
44
44
  const membershipList = (await clerk.organizations.getOrganizationMembershipList({
45
45
  organizationId: orgId
46
- })).map((x) => {
47
- var _a;
48
- return (_a = x.publicUserData) == null ? void 0 : _a.userId;
49
- });
46
+ })).map((x) => x.publicUserData?.userId);
50
47
  if (!membershipList.includes(user.id))
51
48
  return {
52
49
  isAuthorized: false,
@@ -60,7 +57,7 @@ var ClerkBackendAuthentication = ({
60
57
  if (primaryEmail && !allowList) {
61
58
  return { isAuthorized: true };
62
59
  }
63
- if (primaryEmail && (allowList == null ? void 0 : allowList.includes(primaryEmail.emailAddress))) {
60
+ if (primaryEmail && allowList?.includes(primaryEmail.emailAddress)) {
64
61
  return { isAuthorized: true };
65
62
  }
66
63
  }
package/dist/tinacms.d.ts CHANGED
@@ -1 +1,26 @@
1
- export * from "../src/tinacms"
1
+ import { AbstractAuthProvider } from 'tinacms';
2
+ import type Clerk from '@clerk/clerk-js';
3
+ export declare class ClerkAuthProvider extends AbstractAuthProvider {
4
+ clerk: Clerk;
5
+ allowedList?: string[];
6
+ orgId?: string;
7
+ constructor({ orgId, clerk, allowedList, }: {
8
+ clerk: Clerk;
9
+ /**
10
+ * For premium Clerk users, you can use restrictions
11
+ * https://clerk.com/docs/authentication/allowlist
12
+ */
13
+ allowedList?: string[];
14
+ orgId?: string;
15
+ });
16
+ /**
17
+ * Generates a short-lived token when Tina makes a request
18
+ */
19
+ getToken(): Promise<{
20
+ id_token: string;
21
+ }>;
22
+ logout(): Promise<void>;
23
+ authenticate(): Promise<void>;
24
+ authorize(context?: any): Promise<any>;
25
+ getUser(): Promise<any>;
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms-clerk",
3
- "version": "0.0.0-77978b2-20250317000610",
3
+ "version": "0.0.0-788e9fd-20250604064006",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "files": [
@@ -22,13 +22,13 @@
22
22
  "@clerk/clerk-js": "4.56.2",
23
23
  "@types/node": "^22.13.1",
24
24
  "typescript": "^5.7.3",
25
- "@tinacms/scripts": "1.3.3",
26
- "tinacms": "0.0.0-77978b2-20250317000610"
25
+ "@tinacms/scripts": "1.3.5",
26
+ "tinacms": "0.0.0-788e9fd-20250604064006"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@clerk/backend": "0.x",
30
30
  "@clerk/clerk-js": "4.x",
31
- "tinacms": "0.0.0-77978b2-20250317000610"
31
+ "tinacms": "0.0.0-788e9fd-20250604064006"
32
32
  },
33
33
  "publishConfig": {
34
34
  "registry": "https://registry.npmjs.org"