@objectstack/client 3.2.1 → 3.2.3

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/src/index.ts CHANGED
@@ -820,10 +820,10 @@ export class ObjectStackClient {
820
820
  */
821
821
  check: async (request: CheckPermissionRequest): Promise<CheckPermissionResponse> => {
822
822
  const route = this.getRoute('permissions');
823
- const res = await this.fetch(`${this.baseUrl}${route}/check`, {
824
- method: 'POST',
825
- body: JSON.stringify(request)
826
- });
823
+ const params = new URLSearchParams({ object: request.object, action: request.action });
824
+ if (request.recordId !== undefined) params.set('recordId', request.recordId);
825
+ if (request.field !== undefined) params.set('field', request.field);
826
+ const res = await this.fetch(`${this.baseUrl}${route}/check?${params.toString()}`);
827
827
  return this.unwrapResponse<CheckPermissionResponse>(res);
828
828
  },
829
829
 
@@ -832,7 +832,7 @@ export class ObjectStackClient {
832
832
  */
833
833
  getObjectPermissions: async (object: string): Promise<GetObjectPermissionsResponse> => {
834
834
  const route = this.getRoute('permissions');
835
- const res = await this.fetch(`${this.baseUrl}${route}/permissions/${encodeURIComponent(object)}`);
835
+ const res = await this.fetch(`${this.baseUrl}${route}/objects/${encodeURIComponent(object)}`);
836
836
  return this.unwrapResponse<GetObjectPermissionsResponse>(res);
837
837
  },
838
838
 
@@ -841,7 +841,7 @@ export class ObjectStackClient {
841
841
  */
842
842
  getEffectivePermissions: async (): Promise<GetEffectivePermissionsResponse> => {
843
843
  const route = this.getRoute('permissions');
844
- const res = await this.fetch(`${this.baseUrl}${route}/permissions/effective`);
844
+ const res = await this.fetch(`${this.baseUrl}${route}/effective`);
845
845
  return this.unwrapResponse<GetEffectivePermissionsResponse>(res);
846
846
  }
847
847
  };
@@ -1679,7 +1679,7 @@ export class ObjectStackClient {
1679
1679
  storage: '/api/v1/storage',
1680
1680
  automation: '/api/v1/automation',
1681
1681
  packages: '/api/v1/packages',
1682
- permissions: '/api/v1/auth', // Permission endpoints are under /api/v1/auth per spec
1682
+ permissions: '/api/v1/permissions',
1683
1683
  realtime: '/api/v1/realtime',
1684
1684
  workflow: '/api/v1/workflow',
1685
1685
  views: '/api/v1/ui/views',
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ // Exclude integration tests that require a running server
6
+ exclude: [
7
+ '**/node_modules/**',
8
+ '**/dist/**',
9
+ 'tests/integration/**',
10
+ ],
11
+ environment: 'node',
12
+ }
13
+ });