@wirechunk/cli 0.0.2 → 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.
@@ -13,8 +13,8 @@ export type CreateExtensionVersionMutation = {
13
13
  signedUrl: string;
14
14
  extensionVersion: { __typename: 'ExtensionVersion'; id: string };
15
15
  }
16
- | { __typename: 'GenericInternalError'; message: string }
17
- | { __typename: 'GenericUserError'; message: string };
16
+ | { __typename: 'InternalError'; message: string }
17
+ | { __typename: 'UserError'; message: string };
18
18
  };
19
19
 
20
20
  export const CreateExtensionVersionDocument = {
@@ -1,11 +1,9 @@
1
1
  import { cleanSmallId } from '@wirechunk/lib/clean-small-id.ts';
2
- import { PermissionName } from '@wirechunk/lib/graphql-api-enums.ts';
2
+ import { allPermissions } from '@wirechunk/lib/permissions.ts';
3
3
  import type { CommonQueryMethods } from 'slonik';
4
4
  import { sql } from 'slonik';
5
5
  import { voidSelectSchema } from '../util.ts';
6
6
 
7
- export const allPermissions = Object.values(PermissionName);
8
-
9
7
  export const revokeAllUserPlatformPermissions = async (
10
8
  {
11
9
  platformAdminId,
@@ -17,7 +15,7 @@ export const revokeAllUserPlatformPermissions = async (
17
15
  await db.query(
18
16
  sql.type(
19
17
  voidSelectSchema,
20
- )`delete from "PlatformAdminPermissions" where "id" = ${platformAdminId}`,
18
+ )`delete from "Permissions" where "platformAdminId" = ${platformAdminId}`,
21
19
  );
22
20
  };
23
21
 
@@ -32,11 +30,12 @@ export const grantAllUserPlatformPermissions = async (
32
30
  await db.query(
33
31
  sql.type(
34
32
  voidSelectSchema,
35
- )`insert into "PlatformAdminPermissions" ("id", "platformAdminId", "permission") values ${sql.join(
33
+ )`insert into "Permissions" ("id", "platformAdminId", "object", "action") values ${sql.join(
36
34
  allPermissions.map(
37
- (permission) => sql.fragment`(${cleanSmallId()}, ${platformAdminId}, ${permission})`,
35
+ (permission) =>
36
+ sql.fragment`(${cleanSmallId()}, ${platformAdminId}, ${permission.object}, ${permission.action})`,
38
37
  ),
39
38
  sql.fragment`,`,
40
- )} on conflict ("platformAdminId", "permission") do nothing`,
39
+ )} on conflict ("platformAdminId", "object", "action") do nothing`,
41
40
  );
42
41
  };