@api-client/core 0.4.4 → 0.5.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.
Files changed (42) hide show
  1. package/build/browser.d.ts +5 -2
  2. package/build/browser.js +3 -1
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +5 -2
  5. package/build/index.js +3 -1
  6. package/build/index.js.map +1 -1
  7. package/build/src/mocking/ProjectMock.d.ts +1 -1
  8. package/build/src/mocking/lib/User.d.ts +1 -6
  9. package/build/src/mocking/lib/User.js +1 -15
  10. package/build/src/mocking/lib/User.js.map +1 -1
  11. package/build/src/models/Backend.d.ts +10 -2
  12. package/build/src/models/Workspace.d.ts +5 -35
  13. package/build/src/models/Workspace.js +13 -35
  14. package/build/src/models/Workspace.js.map +1 -1
  15. package/build/src/models/store/File.d.ts +88 -0
  16. package/build/src/models/store/File.js +82 -0
  17. package/build/src/models/store/File.js.map +1 -0
  18. package/build/src/models/store/Group.d.ts +21 -0
  19. package/build/src/models/store/Group.js +2 -0
  20. package/build/src/models/store/Group.js.map +1 -0
  21. package/build/src/models/store/Permission.d.ts +189 -0
  22. package/build/src/models/store/Permission.js +211 -0
  23. package/build/src/models/store/Permission.js.map +1 -0
  24. package/build/src/models/{User.d.ts → store/User.d.ts} +12 -59
  25. package/build/src/models/{User.js → store/User.js} +0 -0
  26. package/build/src/models/store/User.js.map +1 -0
  27. package/build/src/runtime/store/SpacesSdk.d.ts +4 -4
  28. package/build/src/runtime/store/SpacesSdk.js.map +1 -1
  29. package/build/src/runtime/store/UsersSdk.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/src/mocking/ProjectMock.ts +1 -1
  32. package/src/mocking/lib/User.ts +1 -21
  33. package/src/models/Backend.ts +10 -2
  34. package/src/models/Workspace.ts +16 -54
  35. package/src/models/store/File.ts +135 -0
  36. package/src/models/store/Group.ts +21 -0
  37. package/src/models/store/Permission.ts +318 -0
  38. package/src/models/store/User.ts +83 -0
  39. package/src/runtime/store/SpacesSdk.ts +5 -5
  40. package/src/runtime/store/UsersSdk.ts +1 -1
  41. package/build/src/models/User.js.map +0 -1
  42. package/src/models/User.ts +0 -138
@@ -2,8 +2,8 @@ import { JsonPatch } from 'json8-patch';
2
2
  import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN, E_RESPONSE_LOCATION } from './SdkBase.js';
3
3
  import { RouteBuilder } from './RouteBuilder.js';
4
4
  import { IListOptions, IListResponse } from '../../models/Backend.js';
5
- import { IWorkspace, IUserWorkspace, Workspace, Kind as WorkspaceKind } from '../../models/Workspace.js';
6
- import { UserAccessOperation } from '../../models/User.js';
5
+ import { IWorkspace, Workspace, Kind as WorkspaceKind } from '../../models/Workspace.js';
6
+ import { AccessOperation } from '../../models/store/Permission.js';
7
7
 
8
8
  export class SpacesSdk extends SdkBase {
9
9
  /**
@@ -65,7 +65,7 @@ export class SpacesSdk extends SdkBase {
65
65
  * @param key The user space key
66
66
  * @returns The definition of the user space.
67
67
  */
68
- async read(key: string): Promise<IUserWorkspace> {
68
+ async read(key: string): Promise<IWorkspace> {
69
69
  const { token } = this.sdk;
70
70
  const url = this.sdk.getUrl(RouteBuilder.space(key));
71
71
  const result = await this.sdk.http.get(url.toString(), { token });
@@ -78,7 +78,7 @@ export class SpacesSdk extends SdkBase {
78
78
  if (!result.body) {
79
79
  throw new Error(`${E_PREFIX}${E_RESPONSE_NO_VALUE}`);
80
80
  }
81
- let data: IUserWorkspace;
81
+ let data: IWorkspace;
82
82
  try {
83
83
  data = JSON.parse(result.body);
84
84
  } catch (e) {
@@ -145,7 +145,7 @@ export class SpacesSdk extends SdkBase {
145
145
  * @param key The user space key
146
146
  * @param value The patch operation on the space's ACL
147
147
  */
148
- async patchUsers(key: string, value: UserAccessOperation[]): Promise<void> {
148
+ async patchUsers(key: string, value: AccessOperation[]): Promise<void> {
149
149
  const { token } = this.sdk;
150
150
  const url = this.sdk.getUrl(RouteBuilder.spaceUsers(key));
151
151
  const body = JSON.stringify(value);
@@ -1,7 +1,7 @@
1
1
  import { SdkBase, E_RESPONSE_STATUS, E_RESPONSE_NO_VALUE, E_INVALID_JSON, E_RESPONSE_UNKNOWN } from './SdkBase.js';
2
2
  import { RouteBuilder } from './RouteBuilder.js';
3
3
  import { IListOptions, IListResponse } from '../../models/Backend.js';
4
- import { IUser } from '../../models/User.js';
4
+ import { IUser } from '../../models/store/User.js';
5
5
 
6
6
  export class UsersSdk extends SdkBase {
7
7
  async me(): Promise<IUser> {
@@ -1 +0,0 @@
1
- {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/models/User.ts"],"names":[],"mappings":"AAgEA,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC"}
@@ -1,138 +0,0 @@
1
- export type AccessControlLevel = 'read' | 'comment' | 'write' | 'admin' | 'owner';
2
-
3
- /**
4
- * This is used in the communication with the backend to add/change user's access to the resource.
5
- */
6
- export interface IUserAccessOperation {
7
- /**
8
- * The user id.
9
- */
10
- uid: string;
11
- }
12
-
13
- export interface IUserAccessAddOperation extends IUserAccessOperation {
14
- op: "add";
15
- /**
16
- * The level that the user has access to.
17
- */
18
- value: AccessControlLevel;
19
- }
20
-
21
- export interface IUserAccessRemoveOperation extends IUserAccessOperation {
22
- op: "remove";
23
- }
24
-
25
- export type UserAccessOperation = IUserAccessAddOperation | IUserAccessRemoveOperation;
26
-
27
- /**
28
- * The definition of an access control.
29
- * The user may have access to a workspace so this is the object describing the level of the workspace.
30
- */
31
- export interface IAccessControl {
32
- /**
33
- * The data store key of the referenced object the user has access to.
34
- */
35
- key: string;
36
- /**
37
- * The level that the user has access to.
38
- */
39
- level: AccessControlLevel;
40
- }
41
-
42
- export interface IEmail {
43
- /**
44
- * When available the email of the user.
45
- */
46
- email?: string;
47
- /**
48
- * Whether the `email` was verified.
49
- * Not verified emails should have limited use in the system.
50
- */
51
- verified?: boolean;
52
- }
53
-
54
- export interface IUserPicture {
55
- /**
56
- * When available, the URL to the user's picture image.
57
- */
58
- url?: string;
59
- /**
60
- * Alternative to the `imageUrl`. When set it is a data URL value of the image.
61
- */
62
- data?: string;
63
- }
64
-
65
- export const Kind = 'Core#User';
66
-
67
- interface BaseUser {
68
- kind: typeof Kind;
69
- /**
70
- * Data store key of the user.
71
- */
72
- key: string;
73
- /**
74
- * The display name of the user.
75
- */
76
- name: string;
77
- /**
78
- * When available the email of the user.
79
- */
80
- email?: IEmail[];
81
- /**
82
- * The user picture to render.
83
- */
84
- picture?: IUserPicture;
85
- /**
86
- * General purpose tags field.
87
- */
88
- tags?: string[];
89
- /**
90
- * Optional user locale information.
91
- */
92
- locale?: string;
93
- /**
94
- * Optional metadata related to the auth provider.
95
- */
96
- provider?: unknown;
97
- }
98
-
99
- /**
100
- * Represents a user in the system.
101
- * This can be embedded in various situations like project's revision history,
102
- * ACL, Authorization, etc.
103
- *
104
- * Note, the store implementation may have additional fields that support external
105
- * identity providers. However, this is not exposed to the user through the API.
106
- */
107
- export interface IUser extends BaseUser {
108
- /**
109
- * Optional metadata related to the auth provider.
110
- */
111
- provider?: unknown;
112
- }
113
-
114
- /**
115
- * This object may be created for each user in the system.
116
- * It describes to which spaces user has access to.
117
- */
118
- export interface IUserSpaces {
119
- /**
120
- * The list of access to the spaces for the user.
121
- */
122
- spaces: IAccessControl[];
123
- /**
124
- * The data store key of the user that has access to the space.
125
- * This is also the key of the entry.
126
- */
127
- user: string;
128
- }
129
-
130
- /**
131
- * An abstract user object that contains access information to a space.
132
- */
133
- export interface ISpaceUser extends BaseUser {
134
- /**
135
- * The level that the user has access to.
136
- */
137
- level: AccessControlLevel;
138
- }