@rimelight/cms 0.0.15 → 0.0.17

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.
@@ -27,32 +27,24 @@ function rimelightCms(options = {}) {
27
27
  let resolvedAuthCode;
28
28
  if (typeof options.auth === "string") {
29
29
  const resolvedAuthPath = path.isAbsolute(options.auth) ? options.auth : path.resolve(rootDir, options.auth);
30
- resolvedAuthCode = `export { authAdapter, authAdapter as default } from ${JSON.stringify(resolvedAuthPath)};`;
30
+ if (fs.existsSync(resolvedAuthPath)) resolvedAuthCode = `export { authAdapter, authAdapter as default } from ${JSON.stringify(resolvedAuthPath)};`;
31
+ else resolvedAuthCode = `import { authAdapter } from "virtual:rimelight-auth";
32
+ export { authAdapter, authAdapter as default };`;
31
33
  } else if (options.auth && typeof options.auth === "object") {
32
34
  const authObj = options.auth;
33
- const adapterName = authObj.name || "mock";
35
+ const adapterName = authObj.name || authObj.adapter || "mock";
34
36
  const adapterOpts = authObj.options || {};
35
37
  if (adapterName === "cf-access") resolvedAuthCode = `import { cfAccessAuth } from "@rimelight/auth/cf-access";
36
38
  export const authAdapter = cfAccessAuth(${JSON.stringify(adapterOpts)});
37
39
  export default authAdapter;`;
38
- else if (adapterName === "auth0") resolvedAuthCode = `import { auth0Auth } from "@rimelight/auth/auth0";
39
- export const authAdapter = auth0Auth(${JSON.stringify(adapterOpts)});
40
+ else if (adapterName === "auth0") resolvedAuthCode = `import { createAuth0FromEnv } from "@rimelight/auth/auth0";
41
+ export const authAdapter = createAuth0FromEnv(${JSON.stringify(adapterOpts)});
40
42
  export default authAdapter;`;
41
43
  else resolvedAuthCode = `import { mockAuth } from "@rimelight/auth/mock";
42
44
  export const authAdapter = mockAuth(${JSON.stringify(adapterOpts)});
43
45
  export default authAdapter;`;
44
- } else resolvedAuthCode = `import { mockAuth } from "@rimelight/auth/mock";
45
- export const authAdapter = mockAuth({
46
- session: {
47
- userId: "cms-admin",
48
- name: "CMS Administrator",
49
- email: "admin@rimelight.com",
50
- roles: ["admin", "editor"],
51
- permissions: ["*"],
52
- userType: "employee"
53
- }
54
- });
55
- export default authAdapter;`;
46
+ } else resolvedAuthCode = `import { authAdapter } from "virtual:rimelight-auth";
47
+ export { authAdapter, authAdapter as default };`;
56
48
  injectRoute({
57
49
  pattern: `${routePrefix}`,
58
50
  entrypoint: "@rimelight/cms/admin/pages/dashboard.astro"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/cms",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment's Content Management System Package",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -75,16 +75,16 @@
75
75
  "access": "public"
76
76
  },
77
77
  "dependencies": {
78
- "@rimelight/auth": "0.0.9",
79
- "@rimelight/i18n": "0.0.16",
80
- "@rimelight/ui": "0.0.56",
78
+ "@rimelight/auth": "0.0.10",
79
+ "@rimelight/i18n": "0.0.17",
80
+ "@rimelight/ui": "0.0.57",
81
81
  "drizzle-orm": "0.45.2",
82
82
  "solid-js": "1.9.15",
83
83
  "sortablejs": "1.15.7"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@astrojs/check": "0.9.10",
87
- "@rimelight/config": "0.0.13",
87
+ "@rimelight/config": "0.0.15",
88
88
  "@types/sortablejs": "1.15.9",
89
89
  "astro": "7.3.3",
90
90
  "typescript": "6.0.3",
@@ -79,10 +79,15 @@ export function rimelightCms(options: RimelightCmsOptions = {}): AstroIntegratio
79
79
  const resolvedAuthPath = path.isAbsolute(options.auth)
80
80
  ? options.auth
81
81
  : path.resolve(rootDir, options.auth)
82
- resolvedAuthCode = `export { authAdapter, authAdapter as default } from ${JSON.stringify(resolvedAuthPath)};`
82
+ if (fs.existsSync(resolvedAuthPath)) {
83
+ resolvedAuthCode = `export { authAdapter, authAdapter as default } from ${JSON.stringify(resolvedAuthPath)};`
84
+ } else {
85
+ resolvedAuthCode = `import { authAdapter } from "virtual:rimelight-auth";
86
+ export { authAdapter, authAdapter as default };`
87
+ }
83
88
  } else if (options.auth && typeof options.auth === "object") {
84
89
  const authObj = options.auth as any
85
- const adapterName = authObj.name || "mock"
90
+ const adapterName = authObj.name || authObj.adapter || "mock"
86
91
  const adapterOpts = authObj.options || {}
87
92
 
88
93
  if (adapterName === "cf-access") {
@@ -90,8 +95,8 @@ export function rimelightCms(options: RimelightCmsOptions = {}): AstroIntegratio
90
95
  export const authAdapter = cfAccessAuth(${JSON.stringify(adapterOpts)});
91
96
  export default authAdapter;`
92
97
  } else if (adapterName === "auth0") {
93
- resolvedAuthCode = `import { auth0Auth } from "@rimelight/auth/auth0";
94
- export const authAdapter = auth0Auth(${JSON.stringify(adapterOpts)});
98
+ resolvedAuthCode = `import { createAuth0FromEnv } from "@rimelight/auth/auth0";
99
+ export const authAdapter = createAuth0FromEnv(${JSON.stringify(adapterOpts)});
95
100
  export default authAdapter;`
96
101
  } else {
97
102
  resolvedAuthCode = `import { mockAuth } from "@rimelight/auth/mock";
@@ -99,19 +104,8 @@ export const authAdapter = mockAuth(${JSON.stringify(adapterOpts)});
99
104
  export default authAdapter;`
100
105
  }
101
106
  } else {
102
- // Default fallback mock admin adapter for development
103
- resolvedAuthCode = `import { mockAuth } from "@rimelight/auth/mock";
104
- export const authAdapter = mockAuth({
105
- session: {
106
- userId: "cms-admin",
107
- name: "CMS Administrator",
108
- email: "admin@rimelight.com",
109
- roles: ["admin", "editor"],
110
- permissions: ["*"],
111
- userType: "employee"
112
- }
113
- });
114
- export default authAdapter;`
107
+ resolvedAuthCode = `import { authAdapter } from "virtual:rimelight-auth";
108
+ export { authAdapter, authAdapter as default };`
115
109
  }
116
110
 
117
111
  // 1. Inject CMS admin routes