@zjazj/server 0.0.3 → 0.0.4
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/{chunk-SVZCJQNB.js → chunk-PIZAN32W.js} +1 -1
- package/dist/{chunk-6IYKARAJ.js → chunk-UWDDQH25.js} +4 -0
- package/dist/{db-CWKXPFWA.d.ts → db-BmTPWKyI.d.ts} +8 -1
- package/dist/db.d.ts +1 -1
- package/dist/db.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -3
- package/dist/testing.js +2 -2
- package/package.json +1 -1
|
@@ -93,6 +93,9 @@ function isValidAppName(value) {
|
|
|
93
93
|
function isValidAppId(value) {
|
|
94
94
|
return typeof value === "string" && APP_ID_PATTERN.test(value);
|
|
95
95
|
}
|
|
96
|
+
function appBasePath(name) {
|
|
97
|
+
return `/apps/${name}/`;
|
|
98
|
+
}
|
|
96
99
|
function assertValidAppId(value) {
|
|
97
100
|
if (!isValidAppId(value)) {
|
|
98
101
|
throw new Error(
|
|
@@ -136,6 +139,7 @@ export {
|
|
|
136
139
|
isUuid,
|
|
137
140
|
isValidAppName,
|
|
138
141
|
isValidAppId,
|
|
142
|
+
appBasePath,
|
|
139
143
|
assertValidAppId,
|
|
140
144
|
generateAppId,
|
|
141
145
|
uuidv7
|
|
@@ -12,6 +12,13 @@ declare const APP_ID_PATTERN: RegExp;
|
|
|
12
12
|
declare function isUuid(value: unknown): value is string;
|
|
13
13
|
declare function isValidAppName(value: unknown): value is string;
|
|
14
14
|
declare function isValidAppId(value: unknown): value is string;
|
|
15
|
+
/**
|
|
16
|
+
* Where the app of this name is served on the platform's address, with a trailing slash:
|
|
17
|
+
* `/apps/<name>/`. A deployed app uses it unless `BASE_URL` says otherwise. The control
|
|
18
|
+
* plane uses it to route an app and to tell the build which path to build for. An app
|
|
19
|
+
* itself never needs it: links and API calls already carry the base path.
|
|
20
|
+
*/
|
|
21
|
+
declare function appBasePath(name: string): string;
|
|
15
22
|
/** Generate a new app id. Called once, by `platform create`. */
|
|
16
23
|
declare function generateAppId(): string;
|
|
17
24
|
/** A time-ordered UUID (version 7). Use it for primary keys. */
|
|
@@ -127,4 +134,4 @@ type GlobalTable<TName extends string, TColumns extends Record<string, PgColumnB
|
|
|
127
134
|
*/
|
|
128
135
|
declare function globalTable<TName extends string, TColumns extends Record<string, PgColumnBuilderBase>>(schema: PgSchema<string>, name: TName, columns: TColumns): GlobalTable<TName, TColumns>;
|
|
129
136
|
|
|
130
|
-
export { APP_ID_PATTERN as A, type CreateDatabaseOptions as C, type Database as D, type GlobalTable as G, type MigrateOptions as M, type TenantTable as T, APP_NAME_PATTERN as a,
|
|
137
|
+
export { APP_ID_PATTERN as A, type CreateDatabaseOptions as C, type Database as D, type GlobalTable as G, type MigrateOptions as M, type TenantTable as T, APP_NAME_PATTERN as a, appBasePath as b, isValidAppId as c, isValidAppName as d, type Db as e, appSchema as f, generateAppId as g, applyTenantPolicies as h, isUuid as i, createDatabase as j, db as k, globalTable as l, migrate as m, tenantDatabase as n, tenantTable as o, withTenant as p, tenantColumns as t, uuidv7 as u, withAllTenants as w };
|
package/dist/db.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'drizzle-orm';
|
|
2
2
|
import 'drizzle-orm/pg-core';
|
|
3
3
|
import 'hono';
|
|
4
|
-
export { C as CreateDatabaseOptions, D as Database,
|
|
4
|
+
export { C as CreateDatabaseOptions, D as Database, e as Db, G as GlobalTable, M as MigrateOptions, T as TenantTable, f as appSchema, h as applyTenantPolicies, j as createDatabase, k as db, l as globalTable, m as migrate, t as tenantColumns, n as tenantDatabase, o as tenantTable, u as uuidv7, w as withAllTenants, p as withTenant } from './db-BmTPWKyI.js';
|
package/dist/db.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Hono, Context, ErrorHandler, NotFoundHandler, MiddlewareHandler } from 'hono';
|
|
2
2
|
import { V as Verifier, A as AuthUser } from './auth-DqrXYPCf.js';
|
|
3
3
|
export { a as AuthenticateOptions, O as ORGANIZATION_AUDIENCE_PREFIX, b as VerifierOptions, c as authenticate, d as bearerToken, e as createVerifier, g as getUser, r as requirePermission, f as requireRole, u as userFromClaims, v as verifierFromEnv } from './auth-DqrXYPCf.js';
|
|
4
|
-
import { D as Database } from './db-
|
|
5
|
-
export { A as APP_ID_PATTERN, a as APP_NAME_PATTERN, g as generateAppId, i as isUuid,
|
|
4
|
+
import { D as Database } from './db-BmTPWKyI.js';
|
|
5
|
+
export { A as APP_ID_PATTERN, a as APP_NAME_PATTERN, b as appBasePath, g as generateAppId, i as isUuid, c as isValidAppId, d as isValidAppName, u as uuidv7 } from './db-BmTPWKyI.js';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
8
|
import 'drizzle-orm/pg-core';
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
requireRole,
|
|
17
17
|
userFromClaims,
|
|
18
18
|
verifierFromEnv
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PIZAN32W.js";
|
|
20
20
|
import {
|
|
21
21
|
APP_ID_PATTERN,
|
|
22
22
|
APP_NAME_PATTERN,
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
NotFoundError,
|
|
27
27
|
UnauthorizedError,
|
|
28
28
|
ValidationError,
|
|
29
|
+
appBasePath,
|
|
29
30
|
assertValidAppId,
|
|
30
31
|
errorHandler,
|
|
31
32
|
generateAppId,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
notFoundHandler,
|
|
36
37
|
toErrorResponse,
|
|
37
38
|
uuidv7
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-UWDDQH25.js";
|
|
39
40
|
import {
|
|
40
41
|
isDevIdentityEnabled
|
|
41
42
|
} from "./chunk-NMKEVYGN.js";
|
|
@@ -136,7 +137,7 @@ function createApp(options) {
|
|
|
136
137
|
}
|
|
137
138
|
assertValidAppId(manifest.id);
|
|
138
139
|
const basePath = normalizeBasePath(
|
|
139
|
-
env.BASE_URL || (env.NODE_ENV === "production" ?
|
|
140
|
+
env.BASE_URL || (env.NODE_ENV === "production" ? appBasePath(manifest.name) : "/")
|
|
140
141
|
);
|
|
141
142
|
configureLog({ app: manifest.name, env: env.ENV || env.NODE_ENV || "development" });
|
|
142
143
|
const databaseOptions = typeof options.database === "object" ? options.database : options.database ? {} : void 0;
|
|
@@ -479,6 +480,7 @@ export {
|
|
|
479
480
|
UnauthorizedError,
|
|
480
481
|
UnsafeUrlError,
|
|
481
482
|
ValidationError,
|
|
483
|
+
appBasePath,
|
|
482
484
|
assertPublicUrl,
|
|
483
485
|
authenticate,
|
|
484
486
|
bearerToken,
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED