@farm.js/workos 0.1.0-beta.96 → 0.1.0-beta.97
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.map +1 -1
- package/dist/index.js +13 -2
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAuC,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAWhG,OAAO,KAAK,EAAuB,oBAAoB,EAAuB,MAAM,aAAa,CAAC;AAGlG,MAAM,WAAW,sBAAsB;IACrC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpC,GAAG,CAAC,EAAE,qBAAqB,CAAC;CAC7B;AAED,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAuC,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAWhG,OAAO,KAAK,EAAuB,oBAAoB,EAAuB,MAAM,aAAa,CAAC;AAGlG,MAAM,WAAW,sBAAsB;IACrC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpC,GAAG,CAAC,EAAE,qBAAqB,CAAC;CAC7B;AAED,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAc/C,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAqFD,wBAAgB,MAAM,CAAC,KAAK,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAsJG,MAAM;;;;yBAoE7B,OAAO;;GAe3C"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,15 @@ import { defineIntegration, integrationRoute } from "@farm.js/core";
|
|
|
3
3
|
import { clearRequestCookie, createPathInferredClientApi, createDocumentNavigationMatchers, createRequestCookie, getCookieValue, getReturnTo, integrationConfig, normalizeMatchers, } from "@farm.js/integration-utils";
|
|
4
4
|
import { workosClient } from "./client.js";
|
|
5
5
|
const DEV_COOKIE_PASSWORD = "farmjs-workos-cookie-password-development-2026";
|
|
6
|
+
// The built server re-evaluates farm.config.ts at runtime to instantiate
|
|
7
|
+
// integrations, and Farm does not force NODE_ENV=production into that process.
|
|
8
|
+
// Treating an absent NODE_ENV as "development" would silently seal production
|
|
9
|
+
// sessions with the public DEV_COOKIE_PASSWORD, so only an explicit dev/test
|
|
10
|
+
// value may use it. `farm dev` runs through Vite, which sets
|
|
11
|
+
// NODE_ENV="development".
|
|
12
|
+
function isExplicitDevelopmentEnv() {
|
|
13
|
+
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
14
|
+
}
|
|
6
15
|
function createWorkOSApi(input) {
|
|
7
16
|
return createPathInferredClientApi({
|
|
8
17
|
path: input.loginPath,
|
|
@@ -24,12 +33,14 @@ function resolveEnv(input) {
|
|
|
24
33
|
const cookiePassword = input.cookiePassword ??
|
|
25
34
|
process.env.WORKOS_COOKIE_PASSWORD ??
|
|
26
35
|
process.env.FARM_WORKOS_COOKIE_PASSWORD ??
|
|
27
|
-
(
|
|
36
|
+
(isExplicitDevelopmentEnv() ? DEV_COOKIE_PASSWORD : "");
|
|
28
37
|
if (!clientId || (!input.instance && !apiKey)) {
|
|
29
38
|
throw new Error("WorkOS integration requires a client ID and either a WorkOS instance or WORKOS_API_KEY.");
|
|
30
39
|
}
|
|
31
40
|
if (!cookiePassword) {
|
|
32
|
-
throw new Error("WorkOS integration requires WORKOS_COOKIE_PASSWORD
|
|
41
|
+
throw new Error("WorkOS integration requires WORKOS_COOKIE_PASSWORD. A development-only fallback is used " +
|
|
42
|
+
'only when NODE_ENV is "development" or "test"; set WORKOS_COOKIE_PASSWORD to a random ' +
|
|
43
|
+
"32-byte value in every other environment.");
|
|
33
44
|
}
|
|
34
45
|
return {
|
|
35
46
|
clientId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm.js/workos",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.97",
|
|
4
4
|
"description": "WorkOS integration for Farm.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@workos-inc/node": "^8.9.0",
|
|
33
|
-
"@farm.js/
|
|
34
|
-
"@farm.js/
|
|
33
|
+
"@farm.js/core": "0.1.0-beta.97",
|
|
34
|
+
"@farm.js/integration-utils": "0.1.0-beta.97"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
|