@abloatai/cli 0.59.1 → 0.60.0
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/cli.cjs +26 -69
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -3976,7 +3976,7 @@ var init_observeCliError = __esm({
|
|
|
3976
3976
|
import_errorObservation = require("@abloatai/transaction/errorObservation");
|
|
3977
3977
|
import_errors5 = require("@abloatai/transaction/errors");
|
|
3978
3978
|
dsn = process.env.ABLO_CLI_SENTRY_DSN ?? "https://1ac154bff10b06836e1ea9de9e0d92f0@o4510928209772544.ingest.de.sentry.io/4511660691423312" ?? "";
|
|
3979
|
-
release = process.env.ABLO_CLI_RELEASE ?? "@abloatai/cli@0.
|
|
3979
|
+
release = process.env.ABLO_CLI_RELEASE ?? "@abloatai/cli@0.60.0";
|
|
3980
3980
|
initialized = false;
|
|
3981
3981
|
nativeProcessExit = process.exit.bind(process);
|
|
3982
3982
|
exitBoundaryInstalled = false;
|
|
@@ -4311,7 +4311,7 @@ var init_src2 = __esm({
|
|
|
4311
4311
|
|
|
4312
4312
|
// src/cliEnvironment.ts
|
|
4313
4313
|
function cliVersion() {
|
|
4314
|
-
return "0.
|
|
4314
|
+
return "0.60.0";
|
|
4315
4315
|
}
|
|
4316
4316
|
function cliOs() {
|
|
4317
4317
|
const value = (0, import_node_os.platform)();
|
|
@@ -289581,7 +289581,7 @@ async function upgrade(argv) {
|
|
|
289581
289581
|
const stale = jsx.getAttributes().some(
|
|
289582
289582
|
(a) => import_ts_morph.Node.isJsxAttribute(a) && ["schema", "teamIds", "authEndpoint", "scope", "apiKey"].includes(a.getNameNode().getText())
|
|
289583
289583
|
);
|
|
289584
|
-
if (stale) flag2(jsx, "<AbloProvider> props", "AbloProvider takes only `client` (+ userId/fallback/onError). Build `const ablo = Ablo({ schema,
|
|
289584
|
+
if (stale) flag2(jsx, "<AbloProvider> props", "AbloProvider takes only `client` (+ userId/fallback/onError). Build `const ablo = Ablo({ schema, session: { endpoint } })` and pass `client={ablo}`.");
|
|
289585
289585
|
}
|
|
289586
289586
|
}
|
|
289587
289587
|
const cwd = process.cwd();
|
|
@@ -290409,7 +290409,7 @@ import Ablo from '@abloatai/ablo';
|
|
|
290409
290409
|
import { AbloProvider } from '@abloatai/ablo/react';
|
|
290410
290410
|
import { schema } from '@/ablo/schema';
|
|
290411
290411
|
|
|
290412
|
-
const ablo = Ablo({ schema,
|
|
290412
|
+
const ablo = Ablo({ schema, session: { endpoint: '/api/ablo-session' } });
|
|
290413
290413
|
|
|
290414
290414
|
export function Providers({ children }: { children: React.ReactNode }) {
|
|
290415
290415
|
return <AbloProvider client={ablo}>{children}</AbloProvider>;
|
|
@@ -290418,77 +290418,34 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|
|
290418
290418
|
}
|
|
290419
290419
|
function generateSessionRoute() {
|
|
290420
290420
|
return `import { headers } from 'next/headers';
|
|
290421
|
-
import
|
|
290422
|
-
|
|
290423
|
-
credentialEndpointSuccessSchema,
|
|
290424
|
-
} from '@abloatai/ablo/auth';
|
|
290425
|
-
import { sync } from '@/ablo';
|
|
290421
|
+
import Sessions from '@abloatai/ablo/sessions';
|
|
290422
|
+
import { schema } from '@/ablo/schema';
|
|
290426
290423
|
import { auth } from '@/lib/auth';
|
|
290427
290424
|
|
|
290428
|
-
const
|
|
290429
|
-
|
|
290430
|
-
export async function POST(request: Request): Promise<Response> {
|
|
290431
|
-
if (!(await isSameOrigin(request))) {
|
|
290432
|
-
return Response.json(
|
|
290433
|
-
credentialEndpointErrorSchema.parse({
|
|
290434
|
-
error: { code: 'origin_mismatch', message: 'Cross-origin mint rejected' },
|
|
290435
|
-
}),
|
|
290436
|
-
{ status: 403, headers: noStore },
|
|
290437
|
-
);
|
|
290438
|
-
}
|
|
290439
|
-
|
|
290440
|
-
const user = await getCurrentUser();
|
|
290441
|
-
if (!user) {
|
|
290442
|
-
return Response.json(
|
|
290443
|
-
credentialEndpointErrorSchema.parse({
|
|
290444
|
-
error: { code: 'session_expired', message: 'Sign in again' },
|
|
290445
|
-
}),
|
|
290446
|
-
{ status: 401, headers: noStore },
|
|
290447
|
-
);
|
|
290448
|
-
}
|
|
290449
|
-
|
|
290450
|
-
const authorizedScope = await authorizeActiveWorkspace(user.id);
|
|
290451
|
-
if (!authorizedScope) {
|
|
290452
|
-
return Response.json(
|
|
290453
|
-
credentialEndpointErrorSchema.parse({
|
|
290454
|
-
error: { code: 'policy_denied', message: 'Workspace membership is stale or revoked' },
|
|
290455
|
-
}),
|
|
290456
|
-
{ status: 403, headers: noStore },
|
|
290457
|
-
);
|
|
290458
|
-
}
|
|
290459
|
-
|
|
290460
|
-
const { token, expiresAt } = await sync.sessions.create({
|
|
290461
|
-
user: { id: user.id },
|
|
290462
|
-
// These ids came from the server-side membership lookup below. Never take
|
|
290463
|
-
// organization, workspace, team, or group ids from the request body.
|
|
290464
|
-
syncGroups: authorizedScope.syncGroups,
|
|
290465
|
-
can: { records: ['read', 'create', 'update'] },
|
|
290466
|
-
});
|
|
290467
|
-
return Response.json(
|
|
290468
|
-
credentialEndpointSuccessSchema.parse({
|
|
290469
|
-
token,
|
|
290470
|
-
expiresAt,
|
|
290471
|
-
credentialKind: 'ephemeral',
|
|
290472
|
-
}),
|
|
290473
|
-
{ headers: noStore },
|
|
290474
|
-
);
|
|
290475
|
-
}
|
|
290425
|
+
const sessions = Sessions({ schema, apiKey: process.env.ABLO_API_KEY });
|
|
290476
290426
|
|
|
290477
|
-
|
|
290478
|
-
|
|
290479
|
-
|
|
290480
|
-
|
|
290481
|
-
|
|
290482
|
-
}
|
|
290427
|
+
export const POST = sessions.handler({
|
|
290428
|
+
async authenticate() {
|
|
290429
|
+
const session = await auth.api.getSession({ headers: await headers() });
|
|
290430
|
+
return session?.user ?? null;
|
|
290431
|
+
},
|
|
290432
|
+
async grant({ principal: user }) {
|
|
290433
|
+
const authorizedScope = await authorizeActiveWorkspace(user.id);
|
|
290434
|
+
if (!authorizedScope) return null;
|
|
290483
290435
|
|
|
290484
|
-
|
|
290485
|
-
|
|
290486
|
-
|
|
290487
|
-
|
|
290436
|
+
return {
|
|
290437
|
+
user: { id: user.id },
|
|
290438
|
+
// These ids came from the server-side membership lookup below. Never take
|
|
290439
|
+
// organization, workspace, team, or group ids from the request body.
|
|
290440
|
+
groups: authorizedScope.groups,
|
|
290441
|
+
can: { records: ['read', 'create', 'update'] },
|
|
290442
|
+
};
|
|
290443
|
+
},
|
|
290444
|
+
});
|
|
290488
290445
|
|
|
290489
290446
|
type AuthorizedWorkspace = {
|
|
290490
290447
|
workspaceId: string;
|
|
290491
|
-
|
|
290448
|
+
groups: readonly [\`workspace:\${string}\`, ...\`\${string}:\${string}\`[]];
|
|
290492
290449
|
};
|
|
290493
290450
|
|
|
290494
290451
|
async function authorizeActiveWorkspace(userId: string): Promise<AuthorizedWorkspace | null> {
|
|
@@ -290502,7 +290459,7 @@ async function authorizeActiveWorkspace(userId: string): Promise<AuthorizedWorks
|
|
|
290502
290459
|
// Example after your membership query:
|
|
290503
290460
|
// return {
|
|
290504
290461
|
// workspaceId: membership.workspaceId,
|
|
290505
|
-
//
|
|
290462
|
+
// groups: [\`workspace:\${membership.workspaceId}\`],
|
|
290506
290463
|
// };
|
|
290507
290464
|
return null;
|
|
290508
290465
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abloatai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "The ablo command line: set up Ablo, connect your database, and push your schema from the terminal.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://docs.abloatai.com/cli",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@sentry/node": "^10.18.0",
|
|
44
|
-
"@abloatai/transaction": "^0.
|
|
44
|
+
"@abloatai/transaction": "^0.60.0",
|
|
45
45
|
"jiti": "^2.7.0",
|
|
46
46
|
"zod": "^4.4.3",
|
|
47
|
-
"@abloatai/humans": "^0.
|
|
47
|
+
"@abloatai/humans": "^0.60.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@ablo/product-analytics": "file:../product-analytics",
|