@trypattern/sdk 0.1.7 → 0.1.8

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.
@@ -8,4 +8,5 @@ export declare const userSchema: z.ZodObject<{
8
8
  }, z.core.$strip>;
9
9
  export type User = z.output<typeof userSchema>;
10
10
  export type StoredUser = Omit<User, 'isAdmin'>;
11
- export declare const USER_COOKIE = "pattern_user";
11
+ export declare const USER_COOKIE = "__Host-pattern_user";
12
+ export declare const SESSION_COOKIE = "__Host-pattern_session";
package/dist/auth/user.js CHANGED
@@ -6,4 +6,5 @@ export const userSchema = z.object({
6
6
  avatarUrl: z.string().nullable(),
7
7
  isAdmin: z.boolean().default(false)
8
8
  });
9
- export const USER_COOKIE = 'pattern_user';
9
+ export const USER_COOKIE = '__Host-pattern_user';
10
+ export const SESSION_COOKIE = '__Host-pattern_session';
package/dist/cli/app.js CHANGED
@@ -1283,7 +1283,7 @@ async function setup() {
1283
1283
  problems.push(`Node ${haveNode} is older than Node ${majorOf(pins.node)} (.nvmrc says ${pins.node})\n fix pnpm env use --global ${majorOf(pins.node)}`);
1284
1284
  }
1285
1285
  if (!isAtLeastMajor(havePnpm, pins.pnpm)) {
1286
- problems.push(`pnpm ${havePnpm || '(not found)'} is older than pnpm ${majorOf(pins.pnpm)} (package.json devEngines says ${pins.pnpm} or newer)\n fix npm install --global pnpm@latest`);
1286
+ problems.push(`pnpm ${havePnpm || '(not found)'} is older than pnpm ${majorOf(pins.pnpm)} (package.json devEngines says ${pins.pnpm} or newer)\n fix npm install --global pnpm@12`);
1287
1287
  }
1288
1288
  const versions = { node: haveNode, pnpm: havePnpm, expected: pins };
1289
1289
  if (problems.length > 0) {
@@ -5,6 +5,7 @@ import { basename, dirname, extname, join, matchesGlob, relative } from 'node:pa
5
5
  import { z } from 'zod';
6
6
  import { DASHBOARD_URL, UPLOAD, appSummary, isPrivatePath, loginPoll, loginStarted, nameProblem, publishMessage, publishSummary, setupCodeExchanged, sourcePathProblem } from "../publishWire.js";
7
7
  import { appInfo } from "../appTitle.js";
8
+ import { SESSION_COOKIE } from "../auth/user.js";
8
9
  import { PROJECT_FILE, readProjectFile } from "../vite/projectFile.js";
9
10
  const CONFIG_DIR = join(homedir(), '.config', 'pattern');
10
11
  const CREDENTIALS_FILE = join(CONFIG_DIR, 'credentials.json');
@@ -13,7 +14,6 @@ const LOGIN_MINUTES = 10;
13
14
  const POLL_MS = 2000;
14
15
  const LOGIN_WAIT_MS = 100_000;
15
16
  const PUBLISH_WAIT_MS = 300_000;
16
- const SESSION_COOKIE = 'pattern_session';
17
17
  const LAUNCHER = 'app';
18
18
  const STARTER_WORKSPACE = 'pnpm-workspace.yaml';
19
19
  const STARTER_BUILD_SETTINGS = 'allowBuilds:\n esbuild: false\n workerd: false\n';
@@ -258,7 +258,7 @@ async function ensurePnpm(io, cwd) {
258
258
  if (await hasPnpm(io, cwd))
259
259
  return true;
260
260
  io.say('Installing pnpm');
261
- const installed = await io.run('npm', ['install', '--global', 'pnpm@latest'], cwd);
261
+ const installed = await io.run('npm', ['install', '--global', 'pnpm@12'], cwd);
262
262
  return installed.code === 0 && (await hasPnpm(io, cwd));
263
263
  }
264
264
  function firstChange(title, url, folder) {
@@ -6,10 +6,10 @@ import { forgetSession, readPass, startSession } from "./session.js";
6
6
  import { readTitle } from "./settings.js";
7
7
  import { deleteSession } from "./sessions.js";
8
8
  import { saveUser } from "./users.js";
9
- const GOOGLE_COOKIE = 'pattern_google';
10
- const EMAIL_COOKIE = 'pattern_email';
9
+ const GOOGLE_COOKIE = '__Host-pattern_google';
10
+ const EMAIL_COOKIE = '__Host-pattern_email';
11
11
  const signInCookie = {
12
- path: '/api/auth',
12
+ path: '/',
13
13
  httpOnly: true,
14
14
  secure: true,
15
15
  sameSite: 'Lax',
@@ -1,9 +1,8 @@
1
1
  import { deleteCookie, getSignedCookie, setCookie, setSignedCookie } from 'hono/cookie';
2
2
  import { serializeSigned } from 'hono/utils/cookie';
3
3
  import { z } from 'zod';
4
- import { USER_COOKIE } from "../auth/user.js";
4
+ import { SESSION_COOKIE, USER_COOKIE } from "../auth/user.js";
5
5
  import { createSession } from "./sessions.js";
6
- const SESSION_COOKIE = 'pattern_session';
7
6
  const RECHECK_SECONDS = 15 * 60;
8
7
  const SESSION_SECONDS = 30 * 86_400;
9
8
  const cookieOptions = {
@@ -61,6 +60,6 @@ export async function readPass(c) {
61
60
  }
62
61
  export const needsRecheck = (pass) => pass.recheckAt <= nowInSeconds();
63
62
  export function forgetSession(c) {
64
- deleteCookie(c, SESSION_COOKIE, { path: '/' });
65
- deleteCookie(c, USER_COOKIE, { path: '/' });
63
+ deleteCookie(c, SESSION_COOKIE, { path: '/', secure: true });
64
+ deleteCookie(c, USER_COOKIE, { path: '/', secure: true });
66
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trypattern/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",