@vibesdotdev/kit 1.0.0-rc.3 → 1.0.0-rc.5

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.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * SvelteKit `version` config for a Vibes app.
3
+ *
4
+ * `version.name` is a build identity: the client offers a reload only when it
5
+ * changes, and the deploy smoke probe compares it with the commit it shipped.
6
+ * The deploy's build version therefore wins; an app label is only a fallback
7
+ * for a build that has none, and a timestamp keeps local builds changing.
8
+ *
9
+ * `svelte.config.js` imports this at config-load time (plain Node/Bun, no Vite
10
+ * transform), so it reads no environment: the caller passes the build version
11
+ * it read through its own tooling runtime.
12
+ */
13
+ export declare function createKitVersion({ buildVersion, name, pollInterval, now }?: {
14
+ /** VIBES_BUILD_VERSION (or the host's commit sha) as the caller read it. */
15
+ buildVersion?: string;
16
+ name?: string;
17
+ pollInterval?: number;
18
+ now?: () => number;
19
+ }): {
20
+ name: string;
21
+ pollInterval: number;
22
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * SvelteKit `version` config for a Vibes app.
3
+ *
4
+ * `version.name` is a build identity: the client offers a reload only when it
5
+ * changes, and the deploy smoke probe compares it with the commit it shipped.
6
+ * The deploy's build version therefore wins; an app label is only a fallback
7
+ * for a build that has none, and a timestamp keeps local builds changing.
8
+ *
9
+ * `svelte.config.js` imports this at config-load time (plain Node/Bun, no Vite
10
+ * transform), so it reads no environment: the caller passes the build version
11
+ * it read through its own tooling runtime.
12
+ */
13
+ export function createKitVersion({ buildVersion, name, pollInterval = 60_000, now = Date.now } = {}) {
14
+ return { name: buildVersion || name || String(now()), pollInterval };
15
+ }
@@ -47,6 +47,18 @@ interface ActiveOrgCookieOptions {
47
47
  maxAge: number;
48
48
  domain?: string;
49
49
  }
50
+ /**
51
+ * The caller's validated org-membership id set, or `null` when NEITHER
52
+ * userContext (account-web) nor a JWT `orgs` claim is available to validate
53
+ * against (legacy token). Header validation treats `null` as fail-closed, and
54
+ * so must any other caller deciding whether a request may name an org.
55
+ */
56
+ export declare function verifiedMembershipOrgIds(locals: {
57
+ userContext?: unknown;
58
+ user?: {
59
+ orgs?: unknown;
60
+ } | null;
61
+ }): Set<string> | null;
50
62
  /**
51
63
  * Create a handle that reads the activeOrg cookie and populates
52
64
  * event.locals.activeOrgId.
@@ -43,9 +43,10 @@ export const ACTIVE_ORG_HEADER_NAME = 'x-vibes-active-org';
43
43
  /**
44
44
  * The caller's validated org-membership id set, or `null` when NEITHER
45
45
  * userContext (account-web) nor a JWT `orgs` claim is available to validate
46
- * against (legacy token). Header validation treats `null` as fail-closed.
46
+ * against (legacy token). Header validation treats `null` as fail-closed, and
47
+ * so must any other caller deciding whether a request may name an org.
47
48
  */
48
- function membershipIds(locals) {
49
+ export function verifiedMembershipOrgIds(locals) {
49
50
  const orgs = readUserContext(locals)?.organizations;
50
51
  if (orgs) {
51
52
  return new Set(orgs.map((org) => org.id));
@@ -96,7 +97,7 @@ export function createActiveOrgHandle() {
96
97
  // user-scoped data while believing it acts as the org.
97
98
  const headerOrgId = event.request.headers.get(ACTIVE_ORG_HEADER_NAME)?.trim();
98
99
  if (headerOrgId) {
99
- const members = membershipIds(locals);
100
+ const members = verifiedMembershipOrgIds(locals);
100
101
  if (!members || !members.has(headerOrgId)) {
101
102
  return forbiddenActiveOrgResponse();
102
103
  }
@@ -28,7 +28,7 @@ export { createUserContextHandle, invalidateUserContext } from './user-context.j
28
28
  export type { UserContextHandleOptions } from './user-context.js';
29
29
  export { checkProjectAccessViaProjectsApi, createActiveProjectHandle, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME } from './active-project.js';
30
30
  export type { ActiveProjectHandleOptions, ProjectAccessFetcher } from './active-project.js';
31
- export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME } from './active-org.js';
31
+ export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME, verifiedMembershipOrgIds } from './active-org.js';
32
32
  export { createOrgMembershipHandle } from './org-membership.js';
33
33
  export { scopeFromLocals, tryScopeFromLocals } from './scope.js';
34
34
  export type { VibesScope } from './scope.js';
@@ -26,7 +26,7 @@
26
26
  */
27
27
  export { createUserContextHandle, invalidateUserContext } from './user-context.js';
28
28
  export { checkProjectAccessViaProjectsApi, createActiveProjectHandle, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME } from './active-project.js';
29
- export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME } from './active-org.js';
29
+ export { createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, ACTIVE_ORG_HEADER_NAME, verifiedMembershipOrgIds } from './active-org.js';
30
30
  export { createOrgMembershipHandle } from './org-membership.js';
31
31
  export { scopeFromLocals, tryScopeFromLocals } from './scope.js';
32
32
  export { actingScopeFromLocals, matchesActingOwner } from './acting-scope.js';
@@ -40,7 +40,7 @@ export type { FormActionConfig } from './action';
40
40
  export { vibesLayoutLoad as vibesLayout, vibesLayoutAuth, vibesLayoutFeature } from './layout/load';
41
41
  export type { VibesLayoutLoadOptions, FeatureGateOptions } from './layout/load';
42
42
  export { createVibesHandle, createBasicVibesHandle, createVibesErrorHandler, createMaintenanceHandle, createAuthHandle, createAuthWrapperHandle, createActivityHandle, applySecurityHeaders, matchSecurityProfile, applySecurityProfile, enhanceUserContext, createPreferenceLoader, shouldSkipActivityLogging, isPublicRoute, isAssetRequest, serializeError, createCacheControlHandle, applyCacheControl, createCorsHandle } from './hooks';
43
- export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
43
+ export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, verifiedMembershipOrgIds, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
44
44
  export type { UserContextHandleOptions, AuthEnforcementOptions, ActiveUserGateOptions, ActiveUserStatus, PermissionFetchHandleOptions, VibesScope, ActingScope } from './handles';
45
45
  export type { VibesHandleConfig, SecurityConfig, MaintenanceConfig, AuthConfig, ActivityConfig, ActivityLogEntry, ActivityLoggerFunction, CSPConfig, SecurityHeadersConfig, SecurityPattern, ContextLoaders, UserContextConfig, ErrorHandlerConfig, CacheControlOptions } from './hooks';
46
46
  export type { VibesConfig, VibesHandler, VibesContext, AuthConfig as VibesAuthConfig, RateLimitConfig, CachingConfig, BillingConfig, ValidationConfig, MetadataConfig } from '../types';
@@ -44,7 +44,7 @@ export { vibesLayoutLoad as vibesLayout, vibesLayoutAuth, vibesLayoutFeature } f
44
44
  // Hooks integration for SvelteKit
45
45
  export { createVibesHandle, createBasicVibesHandle, createVibesErrorHandler, createMaintenanceHandle, createAuthHandle, createAuthWrapperHandle, createActivityHandle, applySecurityHeaders, matchSecurityProfile, applySecurityProfile, enhanceUserContext, createPreferenceLoader, shouldSkipActivityLogging, isPublicRoute, isAssetRequest, serializeError, createCacheControlHandle, applyCacheControl, createCorsHandle } from './hooks';
46
46
  // Composable handles for the handle chain
47
- export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
47
+ export { createUserContextHandle, invalidateUserContext, createActiveProjectHandle, checkProjectAccessViaProjectsApi, invalidateActiveProjectAccess, readActiveProjectCookie, setActiveProjectCookie, ACTIVE_PROJECT_COOKIE_NAME, createActiveOrgHandle, readActiveOrgCookie, setActiveOrgCookie, ACTIVE_ORG_COOKIE_NAME, verifiedMembershipOrgIds, createOrgMembershipHandle, scopeFromLocals, tryScopeFromLocals, actingScopeFromLocals, matchesActingOwner, createAuthEnforcementHandle, createActiveUserGateHandle, createDemoAwareAuthEnforcementHandle, createDemoAwareActiveUserGateHandle, createDemoBannerHandle, createPermissionFetchHandle, invalidatePermissionCache } from './handles';
48
48
  // Helper functions
49
49
  export {
50
50
  // Authentication helpers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibesdotdev/kit",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0-rc.5",
4
4
  "dependencies": {
5
5
  "@codemirror/autocomplete": "^6.20.4",
6
6
  "@codemirror/commands": "^6.11.1",
@@ -47,23 +47,23 @@
47
47
  "tailwind-variants": "^3.3.1",
48
48
  "tw-animate-css": "^1.4.0",
49
49
  "vaul-svelte": "^1.0.0-next.7",
50
- "@vibesdotdev/surface-sveltekit": "^1.0.0-rc.3"
50
+ "@vibesdotdev/surface-sveltekit": "^1.0.0-rc.6"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@humanspeak/svelte-markdown": "^1.9.5",
54
54
  "@iconify/svelte": "^5.2.3",
55
55
  "@sveltejs/kit": "^2.70.3",
56
- "@vibesdotdev/config": "^1.0.0-rc.3",
57
- "@vibesdotdev/infra-core": "^1.0.0-rc.3",
58
- "@vibesdotdev/kernel": "^1.0.0-rc.6",
56
+ "@vibesdotdev/config": "^1.0.0-rc.0",
57
+ "@vibesdotdev/infra-core": "^1.0.0-rc.0",
58
+ "@vibesdotdev/kernel": "^1.0.0-rc.0",
59
59
  "drizzle-orm": "^0.45.4",
60
60
  "svelte": "^5.57.2",
61
61
  "tailwindcss": "^4.3.3",
62
62
  "zod": "^4.6.7",
63
- "@vibesdotdev/design-tokens": "^1.0.0-rc.2",
64
- "@vibesdotdev/filesystem": "^1.0.0-rc.2",
65
- "@vibesdotdev/paths": "^1.0.0-rc.3",
66
- "@vibesdotdev/shared": "^1.0.0-rc.4"
63
+ "@vibesdotdev/design-tokens": "^1.0.0-rc.0",
64
+ "@vibesdotdev/filesystem": "^1.0.0-rc.0",
65
+ "@vibesdotdev/paths": "^1.0.0-rc.0",
66
+ "@vibesdotdev/shared": "^1.0.0-rc.0"
67
67
  },
68
68
  "main": "./dist/lib/index.js",
69
69
  "exports": {
@@ -956,6 +956,12 @@
956
956
  "import": "./dist/lib/config/css-hash.js",
957
957
  "default": "./dist/lib/config/css-hash.js"
958
958
  },
959
+ "./config/sveltekit-version": {
960
+ "types": "./dist/lib/config/sveltekit-version.d.ts",
961
+ "bun": "./dist/lib/config/sveltekit-version.js",
962
+ "import": "./dist/lib/config/sveltekit-version.js",
963
+ "default": "./dist/lib/config/sveltekit-version.js"
964
+ },
959
965
  "./config/sveltekit-browser-csp": {
960
966
  "types": "./dist/lib/config/sveltekit-browser-csp.d.ts",
961
967
  "bun": "./dist/lib/config/sveltekit-browser-csp.js",
@@ -1363,10 +1369,10 @@
1363
1369
  "ui-components",
1364
1370
  "typescript"
1365
1371
  ],
1366
- "gitHead": "2497670f26b07dcb1509d8d3d9a8cdb6d3c48ad2",
1372
+ "gitHead": "5b9a620a037cea8a45d0492ea6e346875c84c6c4",
1367
1373
  "_vibes_source": {
1368
1374
  "repo": "ssh://git@git.vibes.dev/vibesdotdev/kit.git",
1369
- "sha": "2497670f26b07dcb1509d8d3d9a8cdb6d3c48ad2",
1370
- "workspaceDigest": "sha256:1074d90f7afb4b90cadf570abc635c4c592019898cc7e547706e7553261e97de"
1375
+ "sha": "5b9a620a037cea8a45d0492ea6e346875c84c6c4",
1376
+ "workspaceDigest": "sha256:44aa7d9701e939721471f7b830f303df963e9a90603baf9d43d645dba2b7e1de"
1371
1377
  }
1372
1378
  }