@api-client/core 0.5.0 → 0.5.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.
Files changed (65) hide show
  1. package/build/browser.d.ts +4 -5
  2. package/build/browser.js +4 -4
  3. package/build/browser.js.map +1 -1
  4. package/build/index.d.ts +4 -5
  5. package/build/index.js +4 -4
  6. package/build/index.js.map +1 -1
  7. package/build/src/models/Backend.d.ts +2 -1
  8. package/build/src/models/Project.d.ts +41 -0
  9. package/build/src/models/Project.js +94 -0
  10. package/build/src/models/Project.js.map +1 -0
  11. package/build/src/models/RevisionInfo.d.ts +5 -0
  12. package/build/src/models/RevisionInfo.js.map +1 -1
  13. package/build/src/models/Thing.js +1 -1
  14. package/build/src/models/Thing.js.map +1 -1
  15. package/build/src/models/Workspace.d.ts +0 -28
  16. package/build/src/models/Workspace.js +4 -29
  17. package/build/src/models/Workspace.js.map +1 -1
  18. package/build/src/models/store/Deletion.d.ts +24 -0
  19. package/build/src/models/store/Deletion.js +2 -0
  20. package/build/src/models/store/Deletion.js.map +1 -0
  21. package/build/src/models/store/File.d.ts +81 -8
  22. package/build/src/models/store/File.js +126 -16
  23. package/build/src/models/store/File.js.map +1 -1
  24. package/build/src/models/store/Modification.d.ts +24 -0
  25. package/build/src/models/store/Modification.js +2 -0
  26. package/build/src/models/store/Modification.js.map +1 -0
  27. package/build/src/models/store/Permission.d.ts +17 -10
  28. package/build/src/models/store/Permission.js +10 -0
  29. package/build/src/models/store/Permission.js.map +1 -1
  30. package/build/src/runtime/store/RouteBuilder.d.ts +1 -0
  31. package/build/src/runtime/store/RouteBuilder.js +3 -0
  32. package/build/src/runtime/store/RouteBuilder.js.map +1 -1
  33. package/build/src/runtime/store/Sdk.d.ts +5 -0
  34. package/build/src/runtime/store/Sdk.js +8 -0
  35. package/build/src/runtime/store/Sdk.js.map +1 -1
  36. package/build/src/runtime/store/SharedSdk.d.ts +9 -0
  37. package/build/src/runtime/store/SharedSdk.js +35 -0
  38. package/build/src/runtime/store/SharedSdk.js.map +1 -0
  39. package/build/src/runtime/store/SpacesSdk.d.ts +13 -1
  40. package/build/src/runtime/store/SpacesSdk.js +11 -2
  41. package/build/src/runtime/store/SpacesSdk.js.map +1 -1
  42. package/build/src/runtime/store/StoreSdkNode.d.ts +2 -0
  43. package/build/src/runtime/store/StoreSdkNode.js.map +1 -1
  44. package/build/src/runtime/store/StoreSdkWeb.d.ts +2 -0
  45. package/build/src/runtime/store/StoreSdkWeb.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/models/Backend.ts +2 -1
  48. package/src/models/Project.ts +110 -0
  49. package/src/models/RevisionInfo.ts +6 -0
  50. package/src/models/Thing.ts +1 -1
  51. package/src/models/Workspace.ts +6 -44
  52. package/src/models/store/Deletion.ts +24 -0
  53. package/src/models/store/File.ts +155 -21
  54. package/src/models/store/Modification.ts +24 -0
  55. package/src/models/store/Permission.ts +24 -10
  56. package/src/runtime/store/RouteBuilder.ts +4 -0
  57. package/src/runtime/store/Sdk.ts +8 -0
  58. package/src/runtime/store/SharedSdk.ts +35 -0
  59. package/src/runtime/store/SpacesSdk.ts +21 -2
  60. package/src/runtime/store/StoreSdkNode.ts +3 -0
  61. package/src/runtime/store/StoreSdkWeb.ts +3 -0
  62. package/build/src/models/HttpProjectListItem.d.ts +0 -23
  63. package/build/src/models/HttpProjectListItem.js +0 -2
  64. package/build/src/models/HttpProjectListItem.js.map +0 -1
  65. package/src/models/HttpProjectListItem.ts +0 -23
@@ -1 +1 @@
1
- {"version":3,"file":"SpacesSdk.js","sourceRoot":"","sources":["../../../../src/runtime/store/SpacesSdk.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxI,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAyB,IAAI,IAAI,aAAa,EA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,CAAC,MAAM,EAAE,CAAC,CAAC;SACpE;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,GAAG,mBAAmB,EAAE,CAAC,CAAC;SACtD;QACD,IAAI,IAAmB,CAAC;QACxB,IAAI;YACF,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAChC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,GAAG,cAAc,GAAG,CAAC,CAAC;SAClD;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC7B,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,GAAG,kBAAkB,GAAG,CAAC,CAAC;SACtD;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACjB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -1,6 +1,8 @@
1
1
  import { Sdk } from './Sdk.js';
2
2
  import { Http } from './Http.js';
3
3
  import { WsClient } from './WsClient.js';
4
+ export { IStoreTokenInfo, IStoreResponse, IStoreRequestOptions } from './SdkBase.js';
5
+ export { ISpaceCreateOptions } from './SpacesSdk.js';
4
6
  /**
5
7
  * NodeJS API for API Client's net-store module.
6
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"StoreSdkNode.js","sourceRoot":"","sources":["../../../../src/runtime/store/StoreSdkNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,GAAG;IAC/B,IAAI,GAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,EAAE,GAAa,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"StoreSdkNode.js","sourceRoot":"","sources":["../../../../src/runtime/store/StoreSdkNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAO/B;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,GAAG;IAC/B,IAAI,GAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,EAAE,GAAa,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;CACvC"}
@@ -1,6 +1,8 @@
1
1
  import { Sdk } from './Sdk.js';
2
2
  import { Http } from './Http.js';
3
3
  import { WsClient } from './WsClient.js';
4
+ export { IStoreTokenInfo, IStoreResponse, IStoreRequestOptions } from './SdkBase.js';
5
+ export { ISpaceCreateOptions } from './SpacesSdk.js';
4
6
  /**
5
7
  * NodeJS API for API Client's net-store module.
6
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"StoreSdkWeb.js","sourceRoot":"","sources":["../../../../src/runtime/store/StoreSdkWeb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,GAAG;IAC/B,IAAI,GAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,EAAE,GAAa,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;CACtC"}
1
+ {"version":3,"file":"StoreSdkWeb.js","sourceRoot":"","sources":["../../../../src/runtime/store/StoreSdkWeb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAO/B;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,GAAG;IAC/B,IAAI,GAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,EAAE,GAAa,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;CACtC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.5.0",
4
+ "version": "0.5.3",
5
5
  "license": "Apache-2.0",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",
@@ -106,7 +106,8 @@ export interface IListOptions {
106
106
  */
107
107
  queryField?: string[];
108
108
  /**
109
- * @deprecated Not sure what this is.
109
+ * General purpose type property to filer the results.
110
+ * This is used, for example, by the history store to list history for a specific type of requests,
110
111
  */
111
112
  type?: string;
112
113
  /**
@@ -0,0 +1,110 @@
1
+ import { IFile, File, DefaultOwner } from "./store/File.js";
2
+ import { Kind as ThingKind } from './Thing.js';
3
+ import { HttpProject, IHttpProject } from './HttpProject.js';
4
+ import v4 from '../lib/uuid.js';
5
+
6
+ export const Kind = 'Core#Project';
7
+
8
+ /**
9
+ * This model represents a meta data for an HTTP project stored with the data store.
10
+ * This does not include the HTTP project entity, though, it is referenced through the same key.
11
+ *
12
+ * A concept of a project is similar to a Workspace. It is an object that is rendered in the UIs
13
+ * like a workspace but has a different meaning. On the store side, when listing workspace items,
14
+ * both spaces and projects are returned in a single query.
15
+ */
16
+ export interface IProject extends IFile {
17
+ kind: typeof Kind;
18
+ }
19
+
20
+ /**
21
+ * This model represents a meta data for an HTTP project stored with the data store.
22
+ * This does not include the HTTP project entity, though, it is referenced through the same key.
23
+ *
24
+ * A concept of a project is similar to a Workspace. It is an object that is rendered in the UIs
25
+ * like a workspace but has a different meaning. On the store side, when listing workspace items,
26
+ * both spaces and projects are returned in a single query.
27
+ */
28
+ export class Project extends File {
29
+ kind = Kind;
30
+
31
+ static fromProject(project: HttpProject | IHttpProject): Project {
32
+ let final: IHttpProject;
33
+ if (typeof (project as HttpProject).toJSON === 'function') {
34
+ final = (project as HttpProject).toJSON();
35
+ } else {
36
+ final = project as IHttpProject;
37
+ }
38
+ const init: IProject = {
39
+ kind: Kind,
40
+ key: final.key,
41
+ info: { ...final.info },
42
+ lastModified: { user: '', time: 0, byMe: false },
43
+ owner: DefaultOwner,
44
+ parents: [],
45
+ permissionIds: [],
46
+ permissions: [],
47
+ };
48
+ return new Project(init);
49
+ }
50
+
51
+ /**
52
+ * @param input The environment definition used to restore the state.
53
+ */
54
+ constructor(input?: string | IProject) {
55
+ super();
56
+ let init: IProject;
57
+ if (typeof input === 'string') {
58
+ init = JSON.parse(input);
59
+ } else if (typeof input === 'object') {
60
+ init = input;
61
+ } else {
62
+ init = {
63
+ kind: Kind,
64
+ key: v4(),
65
+ info: {
66
+ kind: ThingKind,
67
+ name: '',
68
+ },
69
+ owner: DefaultOwner,
70
+ parents: [],
71
+ permissionIds: [],
72
+ permissions: [],
73
+ lastModified: { user: '', time: 0, byMe: false },
74
+ };
75
+ }
76
+ this.new(init);
77
+ }
78
+
79
+ /**
80
+ * Creates a new environment clearing anything that is so far defined.
81
+ *
82
+ * Note, this throws an error when the environment is not a space.
83
+ */
84
+ new(init: IProject): void {
85
+ if (!Project.isWorkspace(init)) {
86
+ throw new Error(`Not a space.`);
87
+ }
88
+ super.new(init);
89
+ this.kind = Kind;
90
+ }
91
+
92
+ /**
93
+ * Checks whether the input is a definition of an user space.
94
+ */
95
+ static isWorkspace(input: unknown): boolean {
96
+ const typed = input as IProject;
97
+ if (!input || typed.kind !== Kind) {
98
+ return false;
99
+ }
100
+ return true;
101
+ }
102
+
103
+ toJSON(): IProject {
104
+ const result: IProject = {
105
+ ...super.toJSON(),
106
+ kind: Kind,
107
+ };
108
+ return result;
109
+ }
110
+ }
@@ -1,3 +1,5 @@
1
+ import { IModification } from './store/Modification.js';
2
+
1
3
  export const Kind = 'Core#Revision';
2
4
 
3
5
  /**
@@ -34,4 +36,8 @@ export interface IRevisionInfo {
34
36
  * The `json8-patch` revisions object used to restore the previous state.
35
37
  */
36
38
  patch: any[];
39
+ /**
40
+ * The modification record for this revision.
41
+ */
42
+ modification: IModification;
37
43
  }
@@ -96,7 +96,7 @@ export class Thing {
96
96
  const result: IThing = {
97
97
  kind: Kind,
98
98
  };
99
- if (this.name) {
99
+ if (typeof this.name === 'string') {
100
100
  result.name = this.name;
101
101
  }
102
102
  if (this.description) {
@@ -1,5 +1,5 @@
1
- import { IFile, File } from "./store/File.js";
2
- import { IThing, Thing, Kind as ThingKind } from './Thing.js';
1
+ import { IFile, File, DefaultOwner } from "./store/File.js";
2
+ import { Thing, Kind as ThingKind } from './Thing.js';
3
3
  import v4 from '../lib/uuid.js';
4
4
 
5
5
  export const Kind = 'Core#Space';
@@ -11,23 +11,8 @@ export const Kind = 'Core#Space';
11
11
  */
12
12
  export interface IWorkspace extends IFile {
13
13
  kind: typeof Kind;
14
- /**
15
- * The space identifier.
16
- */
17
- key: string;
18
- /**
19
- * The environment's meta info.
20
- */
21
- info: IThing;
22
- /**
23
- * The owner of this space. The id of the User object.
24
- * Set to `default` when there are no users in the system (no authentication).
25
- */
26
- owner: string;
27
14
  }
28
15
 
29
- export const DefaultOwner = 'default';
30
-
31
16
  /**
32
17
  * A definition of the working space for users.
33
18
  *
@@ -36,20 +21,7 @@ export const DefaultOwner = 'default';
36
21
  */
37
22
  export class Workspace extends File {
38
23
  kind = Kind;
39
- /**
40
- * The space identifier.
41
- */
42
- key = '';
43
- /**
44
- * The name of the environment.
45
- */
46
- info: Thing = new Thing({ kind: ThingKind });
47
- /**
48
- * The owner of this space. The id of the User object.
49
- * Set to `default` when there are no users in the system (no authentication).
50
- */
51
- owner = '';
52
-
24
+
53
25
  /**
54
26
  * Creates a new Space object from a name.
55
27
  *
@@ -67,6 +39,7 @@ export class Workspace extends File {
67
39
  parents: [],
68
40
  permissionIds: [],
69
41
  permissions: [],
42
+ lastModified: { user: '', time: 0, byMe: false },
70
43
  });
71
44
  return definition;
72
45
  }
@@ -93,6 +66,7 @@ export class Workspace extends File {
93
66
  parents: [],
94
67
  permissionIds: [],
95
68
  permissions: [],
69
+ lastModified: { user: '', time: 0, byMe: false },
96
70
  };
97
71
  }
98
72
  this.new(init);
@@ -108,15 +82,7 @@ export class Workspace extends File {
108
82
  throw new Error(`Not a space.`);
109
83
  }
110
84
  super.new(init);
111
- const { key = v4(), info, owner = DefaultOwner } = init;
112
85
  this.kind = Kind;
113
- this.key = key;
114
- this.owner = owner;
115
- if (info) {
116
- this.info = new Thing(info);
117
- } else {
118
- this.info = new Thing({ kind: ThingKind, name: '' });
119
- }
120
86
  }
121
87
 
122
88
  /**
@@ -131,13 +97,9 @@ export class Workspace extends File {
131
97
  }
132
98
 
133
99
  toJSON(): IWorkspace {
134
- const { owner = DefaultOwner } = this;
135
100
  const result: IWorkspace = {
136
- kind: Kind,
137
- key: this.key,
138
- info: this.info.toJSON(),
139
- owner,
140
101
  ...super.toJSON(),
102
+ kind: Kind,
141
103
  };
142
104
  return result;
143
105
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A schema describing the delete action performed on an entity.
3
+ */
4
+ export interface IDeletion {
5
+ /**
6
+ * The timestamp of when the entity was deleted.
7
+ */
8
+ time: number;
9
+ /**
10
+ * The id of the user that has deleted the entity.
11
+ */
12
+ user?: string;
13
+ /**
14
+ * User name deleting the entity. May not be set when there's no actual user.
15
+ */
16
+ name?: string;
17
+ /**
18
+ * Whether the deletion was performed by the requesting the data user.
19
+ *
20
+ * Note for store implementers, this field should not be stored and populated every time the
21
+ * record is requested.
22
+ */
23
+ byMe: boolean;
24
+ }
@@ -1,6 +1,25 @@
1
1
  import { IPermission } from './Permission.js';
2
+ import { IModification } from './Modification.js';
3
+ import { IDeletion } from './Deletion.js';
4
+ import { IUser, Kind as UserKind } from './User.js';
5
+ import { IThing, Thing } from '../Thing.js';
6
+ import v4 from '../../lib/uuid.js';
7
+
8
+ export const DefaultOwner = 'default';
2
9
 
3
10
  export interface IStoredFile {
11
+ /**
12
+ * The kind of the File
13
+ */
14
+ kind: string;
15
+ /**
16
+ * The identifier of the entity
17
+ */
18
+ key: string;
19
+ /**
20
+ * The projects's meta info.
21
+ */
22
+ info: IThing;
4
23
  /**
5
24
  * The list of parents of the object. It is an ordered list of parents
6
25
  * from the top (first element) to the lowest parent in the tree (last element).
@@ -21,13 +40,22 @@ export interface IStoredFile {
21
40
  */
22
41
  deleted?: boolean;
23
42
  /**
24
- * The timestamp of when the file was deleted.
43
+ * The information about the delete information.
44
+ * Always set when the `delete` is true.
25
45
  */
26
- deletedTime?: number;
46
+ deletedInfo?: IDeletion;
27
47
  /**
28
- * The id of the user that has deleted the file.
48
+ * The owner of this object. The id of the User object.
29
49
  */
30
- deletingUser?: string;
50
+ owner: string;
51
+ /**
52
+ * The last modification made to this file.
53
+ */
54
+ lastModified: IModification;
55
+ /**
56
+ * An arbitrary list of labels applied to the file.
57
+ */
58
+ labels?: string[];
31
59
  }
32
60
 
33
61
  /**
@@ -48,6 +76,18 @@ export interface IFile extends IStoredFile {
48
76
  }
49
77
 
50
78
  export class StoredFile {
79
+ /**
80
+ * The kind of the File
81
+ */
82
+ kind = '';
83
+ /**
84
+ * The identifier of the entity
85
+ */
86
+ key = '';
87
+ /**
88
+ * The name of the environment.
89
+ */
90
+ info: Thing = Thing.fromName('');
51
91
  /**
52
92
  * The list of parents of the object. It is an ordered list of parents
53
93
  * from the top (first element) to the lowest parent in the tree (last element).
@@ -68,46 +108,140 @@ export class StoredFile {
68
108
  */
69
109
  deleted?: boolean;
70
110
  /**
71
- * The timestamp of when the file was deleted.
111
+ * The information about the delete information.
112
+ * Always set when the `delete` is true.
113
+ */
114
+ deletedInfo?: IDeletion;
115
+ /**
116
+ * The owner of this space. The id of the User object.
117
+ * Set to `default` when there are no users in the system (no authentication).
118
+ */
119
+ owner = DefaultOwner;
120
+ /**
121
+ * The last modification made to this file.
72
122
  */
73
- deletedTime?: number;
123
+ lastModified: IModification = { user: '', time: 0, byMe: false };
74
124
  /**
75
- * The id of the user that has deleted the file.
125
+ * An arbitrary list of labels applied to the file.
76
126
  */
77
- deletingUser?: string;
127
+ labels?: string[];
78
128
 
79
129
  new(init: IStoredFile): void {
80
- const { parents=[], permissionIds=[], deleted, deletedTime, deletingUser } = init;
130
+ const { key = v4(), info, kind, parents=[], permissionIds=[], deleted, deletedInfo, owner = DefaultOwner, lastModified, labels } = init;
131
+ this.key = key;
132
+ this.kind = kind;
133
+ if (info) {
134
+ this.info = new Thing(info);
135
+ } else {
136
+ this.info = Thing.fromName('');
137
+ }
81
138
  this.parents = parents;
82
139
  this.permissionIds = permissionIds;
140
+ this.owner = owner;
141
+ this.lastModified = lastModified || { user: '', time: 0, byMe: false };
83
142
  if (typeof deleted === 'boolean') {
84
143
  this.deleted = deleted;
85
- this.deletedTime = deletedTime;
86
- this.deletingUser = deletingUser;
144
+ this.deletedInfo = deletedInfo;
87
145
  } else {
88
146
  this.deleted = undefined;
89
- this.deletedTime = undefined;
90
- this.deletingUser = undefined;
147
+ this.deletedInfo = undefined;
148
+ }
149
+ if (Array.isArray(labels)) {
150
+ this.labels = labels;
151
+ } else {
152
+ this.labels = undefined;
91
153
  }
92
154
  }
93
155
 
94
156
  toJSON(): IStoredFile {
157
+ const { owner = DefaultOwner } = this;
95
158
  const result: IStoredFile = {
159
+ key: this.key,
160
+ kind: this.kind,
161
+ info: this.info.toJSON(),
96
162
  parents: this.parents,
97
163
  permissionIds: this.permissionIds,
164
+ lastModified: this.lastModified,
165
+ owner,
98
166
  };
99
- if (typeof this.deleted === 'boolean') {
167
+ if (this.deleted) {
100
168
  result.deleted = this.deleted;
101
-
102
- if (this.deletedTime) {
103
- result.deletedTime = this.deletedTime;
104
- }
105
- if (this.deletingUser) {
106
- result.deletingUser = this.deletingUser;
107
- }
169
+ result.deletedInfo = this.deletedInfo;
170
+ }
171
+ if (Array.isArray(this.labels)) {
172
+ result.labels = this.labels;
108
173
  }
109
174
  return result;
110
175
  }
176
+
177
+ /**
178
+ * Updates the "lastModified" value.
179
+ * A helper method for a common task.
180
+ *
181
+ * @param user The user that modifies the entity.
182
+ */
183
+ setLastModified(user: IUser): void {
184
+ if (!user) {
185
+ throw new Error(`The user is required.`);
186
+ }
187
+ if (user.kind !== UserKind) {
188
+ throw new Error(`Invalid value for the user when setting "lastModified".`);
189
+ }
190
+ this.lastModified = {
191
+ byMe: false,
192
+ time: Date.now(),
193
+ user: user.key,
194
+ name: user.name,
195
+ };
196
+ }
197
+
198
+ /**
199
+ * Adds a label to the list of labels.
200
+ *
201
+ * It makes sure the value is a valid, non-empty string and the `labels` array is set.
202
+ *
203
+ * It does nothing when the label already exists.
204
+ *
205
+ * @param label The label to set.
206
+ */
207
+ addLabel(label: string): void {
208
+ if (typeof label !== 'string') {
209
+ throw new Error(`The label must be a string.`);
210
+ }
211
+ if (!label.trim()) {
212
+ throw new Error(`The label is required.`);
213
+ }
214
+ if (!Array.isArray(this.labels)) {
215
+ this.labels = [];
216
+ }
217
+ if (this.labels.includes(label)) {
218
+ return;
219
+ }
220
+ this.labels.push(label);
221
+ }
222
+
223
+ /**
224
+ * Marks the entity as deleted.
225
+ *
226
+ * A helper method for a common task.
227
+ *
228
+ * @param user The user that deletes the entity.
229
+ */
230
+ setDeleted(user: IUser): void {
231
+ if (!user) {
232
+ throw new Error(`The user is required.`);
233
+ }
234
+ if (user.kind !== UserKind) {
235
+ throw new Error(`Invalid value for the user when setting "lastModified".`);
236
+ }
237
+ this.deleted = true;
238
+ this.deletedInfo = {
239
+ byMe: false,
240
+ time: Date.now(),
241
+ user: user.key,
242
+ name: user.name,
243
+ };
244
+ }
111
245
  }
112
246
 
113
247
  export class File extends StoredFile {
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Information about a modification of a File.
3
+ */
4
+ export interface IModification {
5
+ /**
6
+ * The key of the user modifying the record.
7
+ */
8
+ user: string;
9
+ /**
10
+ * User name modifying the record. May not be set when there's no actual user.
11
+ */
12
+ name?: string;
13
+ /**
14
+ * Whether the modification was performed by the requesting the data user.
15
+ *
16
+ * Note for store implementers, this field should not be stored and populated every time the
17
+ * record is requested.
18
+ */
19
+ byMe: boolean;
20
+ /**
21
+ * A timestamp when the object was modified.
22
+ */
23
+ time: number;
24
+ }
@@ -5,16 +5,7 @@ export const Kind = 'Core#Permission';
5
5
  export type PermissionType = 'user' | 'group' | 'anyone';
6
6
  export type PermissionRole = 'owner' | 'reader' | 'commenter' | 'writer';
7
7
 
8
- /**
9
- * A schema describing a permission to a store object.
10
- */
11
- export interface IPermission {
12
- kind: typeof Kind;
13
- /**
14
- * The data store key of the permission.
15
- * This property is generated by the store and is not writable.
16
- */
17
- key: string;
8
+ interface IBasePermission {
18
9
  /**
19
10
  * The type of the permission.
20
11
  *
@@ -71,6 +62,18 @@ export interface IPermission {
71
62
  deletingUser?: string;
72
63
  }
73
64
 
65
+ /**
66
+ * A schema describing a permission to a store object.
67
+ */
68
+ export interface IPermission extends IBasePermission{
69
+ kind: typeof Kind;
70
+ /**
71
+ * The data store key of the permission.
72
+ * This property is generated by the store and is not writable.
73
+ */
74
+ key: string;
75
+ }
76
+
74
77
  export class Permission {
75
78
  kind = Kind;
76
79
  /**
@@ -187,6 +190,17 @@ export class Permission {
187
190
  return new Permission(init);
188
191
  }
189
192
 
193
+ /**
194
+ * Creates a permission object from other than key and kind values.
195
+ */
196
+ static fromValues(init: IBasePermission): Permission {
197
+ return new Permission({
198
+ ...init,
199
+ key: v4(),
200
+ kind: Kind,
201
+ });
202
+ }
203
+
190
204
  constructor(input?: string | IPermission) {
191
205
  let init: IPermission;
192
206
  if (typeof input === 'string') {
@@ -86,4 +86,8 @@ export class RouteBuilder {
86
86
  static historyItem(key: string): string {
87
87
  return `/history/${key}`;
88
88
  }
89
+
90
+ static sharedSpaces(): string {
91
+ return '/shared/spaces';
92
+ }
89
93
  }