@api-client/core 0.13.6 → 0.14.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 (46) hide show
  1. package/build/src/modeling/DomainFile.d.ts +2 -3
  2. package/build/src/modeling/DomainFile.d.ts.map +1 -1
  3. package/build/src/modeling/DomainFile.js +4 -8
  4. package/build/src/modeling/DomainFile.js.map +1 -1
  5. package/build/src/models/CertificateFile.d.ts +2 -3
  6. package/build/src/models/CertificateFile.d.ts.map +1 -1
  7. package/build/src/models/CertificateFile.js +4 -8
  8. package/build/src/models/CertificateFile.js.map +1 -1
  9. package/build/src/models/Folder.d.ts +1 -2
  10. package/build/src/models/Folder.d.ts.map +1 -1
  11. package/build/src/models/Folder.js +2 -4
  12. package/build/src/models/Folder.js.map +1 -1
  13. package/build/src/models/Project.d.ts +2 -3
  14. package/build/src/models/Project.d.ts.map +1 -1
  15. package/build/src/models/Project.js +4 -8
  16. package/build/src/models/Project.js.map +1 -1
  17. package/build/src/models/store/DataFile.d.ts +2 -4
  18. package/build/src/models/store/DataFile.d.ts.map +1 -1
  19. package/build/src/models/store/DataFile.js +4 -9
  20. package/build/src/models/store/DataFile.js.map +1 -1
  21. package/build/src/models/store/File.d.ts +1 -21
  22. package/build/src/models/store/File.d.ts.map +1 -1
  23. package/build/src/models/store/File.js +3 -23
  24. package/build/src/models/store/File.js.map +1 -1
  25. package/build/src/sdk/FilesSdk.js +1 -1
  26. package/build/src/sdk/FilesSdk.js.map +1 -1
  27. package/build/tsconfig.tsbuildinfo +1 -1
  28. package/data/models/example-generator-api.json +16 -16
  29. package/eslint.config.js +1 -0
  30. package/package.json +5 -5
  31. package/src/modeling/DomainFile.ts +4 -8
  32. package/src/models/CertificateFile.ts +4 -12
  33. package/src/models/Folder.ts +2 -4
  34. package/src/models/Project.ts +4 -8
  35. package/src/models/store/DataFile.ts +4 -9
  36. package/src/models/store/File.ts +4 -35
  37. package/src/sdk/FilesSdk.ts +1 -1
  38. package/tests/unit/modeling/domain_file.spec.ts +4 -27
  39. package/tests/unit/models/Certificate/from_name.spec.ts +3 -15
  40. package/tests/unit/models/File/constructor.spec.ts +0 -1
  41. package/tests/unit/models/File/new.spec.ts +0 -13
  42. package/tests/unit/models/File/shortcutTo.spec.ts +1 -2
  43. package/tests/unit/models/File/toJSON.spec.ts +0 -13
  44. package/tests/unit/models/File/updateByMeMeta.spec.ts +4 -6
  45. package/tests/unit/models/Folder/create.spec.ts +2 -23
  46. package/tests/unit/models/Project/create.spec.ts +6 -32
@@ -41731,10 +41731,10 @@
41731
41731
  "@id": "#197"
41732
41732
  },
41733
41733
  {
41734
- "@id": "#200"
41734
+ "@id": "#206"
41735
41735
  },
41736
41736
  {
41737
- "@id": "#206"
41737
+ "@id": "#200"
41738
41738
  },
41739
41739
  {
41740
41740
  "@id": "#203"
@@ -42470,6 +42470,9 @@
42470
42470
  "@id": "#219"
42471
42471
  },
42472
42472
  {
42473
+ "@id": "#219"
42474
+ },
42475
+ {
42473
42476
  "@id": "#210"
42474
42477
  },
42475
42478
  {
@@ -42477,9 +42480,6 @@
42477
42480
  },
42478
42481
  {
42479
42482
  "@id": "#216"
42480
- },
42481
- {
42482
- "@id": "#219"
42483
42483
  }
42484
42484
  ],
42485
42485
  "doc:root": false,
@@ -43159,7 +43159,7 @@
43159
43159
  "doc:ExternalDomainElement",
43160
43160
  "doc:DomainElement"
43161
43161
  ],
43162
- "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43162
+ "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43163
43163
  "core:mediaType": "application/yaml",
43164
43164
  "sourcemaps:sources": [
43165
43165
  {
@@ -43201,7 +43201,7 @@
43201
43201
  "doc:ExternalDomainElement",
43202
43202
  "doc:DomainElement"
43203
43203
  ],
43204
- "doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
43204
+ "doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
43205
43205
  "core:mediaType": "application/yaml",
43206
43206
  "sourcemaps:sources": [
43207
43207
  {
@@ -43892,7 +43892,7 @@
43892
43892
  "doc:ExternalDomainElement",
43893
43893
  "doc:DomainElement"
43894
43894
  ],
43895
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
43895
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
43896
43896
  "core:mediaType": "application/yaml",
43897
43897
  "sourcemaps:sources": [
43898
43898
  {
@@ -43913,7 +43913,7 @@
43913
43913
  "doc:ExternalDomainElement",
43914
43914
  "doc:DomainElement"
43915
43915
  ],
43916
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
43916
+ "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
43917
43917
  "core:mediaType": "application/yaml",
43918
43918
  "sourcemaps:sources": [
43919
43919
  {
@@ -43934,7 +43934,7 @@
43934
43934
  "doc:ExternalDomainElement",
43935
43935
  "doc:DomainElement"
43936
43936
  ],
43937
- "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
43937
+ "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
43938
43938
  "core:mediaType": "application/yaml",
43939
43939
  "sourcemaps:sources": [
43940
43940
  {
@@ -43955,7 +43955,7 @@
43955
43955
  "doc:ExternalDomainElement",
43956
43956
  "doc:DomainElement"
43957
43957
  ],
43958
- "doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
43958
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\n",
43959
43959
  "core:mediaType": "application/yaml",
43960
43960
  "sourcemaps:sources": [
43961
43961
  {
@@ -44431,7 +44431,7 @@
44431
44431
  {
44432
44432
  "@id": "#202/source-map/lexical/element_0",
44433
44433
  "sourcemaps:element": "amf://id#202",
44434
- "sourcemaps:value": "[(1,0)-(5,0)]"
44434
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44435
44435
  },
44436
44436
  {
44437
44437
  "@id": "#205/source-map/lexical/element_0",
@@ -44441,7 +44441,7 @@
44441
44441
  {
44442
44442
  "@id": "#208/source-map/lexical/element_0",
44443
44443
  "sourcemaps:element": "amf://id#208",
44444
- "sourcemaps:value": "[(1,0)-(3,0)]"
44444
+ "sourcemaps:value": "[(1,0)-(5,0)]"
44445
44445
  },
44446
44446
  {
44447
44447
  "@id": "#223/source-map/lexical/element_0",
@@ -44781,17 +44781,17 @@
44781
44781
  {
44782
44782
  "@id": "#215/source-map/lexical/element_0",
44783
44783
  "sourcemaps:element": "amf://id#215",
44784
- "sourcemaps:value": "[(1,0)-(6,0)]"
44784
+ "sourcemaps:value": "[(1,0)-(7,0)]"
44785
44785
  },
44786
44786
  {
44787
44787
  "@id": "#218/source-map/lexical/element_0",
44788
44788
  "sourcemaps:element": "amf://id#218",
44789
- "sourcemaps:value": "[(1,0)-(7,0)]"
44789
+ "sourcemaps:value": "[(1,0)-(3,0)]"
44790
44790
  },
44791
44791
  {
44792
44792
  "@id": "#221/source-map/lexical/element_0",
44793
44793
  "sourcemaps:element": "amf://id#221",
44794
- "sourcemaps:value": "[(1,0)-(3,0)]"
44794
+ "sourcemaps:value": "[(1,0)-(6,0)]"
44795
44795
  },
44796
44796
  {
44797
44797
  "@id": "#338/source-map/synthesized-field/element_1",
package/eslint.config.js CHANGED
@@ -14,6 +14,7 @@ export const GLOBAL_IGNORE_LIST = [
14
14
  '.github/',
15
15
  '.husky/',
16
16
  '.tmp/',
17
+ '.rollup.cache/',
17
18
  '.vscode/',
18
19
  '.wireit/',
19
20
  'amf-models/',
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.13.6",
4
+ "version": "0.14.0",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -208,7 +208,7 @@
208
208
  ],
209
209
  "output": [
210
210
  ".tmp/**",
211
- ".tsbuildinfo"
211
+ ".tmp/testing/tsconfig.browser.tsbuildinfo"
212
212
  ]
213
213
  },
214
214
  "build:ts": {
@@ -220,7 +220,7 @@
220
220
  ],
221
221
  "output": [
222
222
  "build/**",
223
- ".tsbuildinfo"
223
+ "build/tsconfig.tsbuildinfo"
224
224
  ]
225
225
  },
226
226
  "build:browser": {
@@ -233,7 +233,7 @@
233
233
  ],
234
234
  "output": [
235
235
  ".tmp/testing/**",
236
- ".tsbuildinfo"
236
+ ".tmp/testing/tsconfig.browser.tsbuildinfo"
237
237
  ]
238
238
  },
239
239
  "build:node": {
@@ -246,7 +246,7 @@
246
246
  ],
247
247
  "output": [
248
248
  ".tmp/node/**",
249
- ".tsbuildinfo"
249
+ ".tmp/node/tsconfig.node.tsbuildinfo"
250
250
  ]
251
251
  },
252
252
  "lint:eslint": {
@@ -14,17 +14,16 @@ export interface IDomainFile extends IFile {
14
14
  export class DomainFile extends File {
15
15
  override kind = DomainFileKind
16
16
 
17
- static override fromName(name: string, organization: string, owner?: string): DomainFile {
18
- return super.fromName(name, organization, owner, DomainFileKind) as DomainFile
17
+ static override fromName(name: string): DomainFile {
18
+ return super.fromName(name, DomainFileKind) as DomainFile
19
19
  }
20
20
 
21
21
  /**
22
22
  * Creates the file definition for a DataNamespace contents.
23
23
  *
24
24
  * @param input The data namespace instance or schema.
25
- * @param owner Optional owner to set.
26
25
  */
27
- static fromDataDomain(input: DataDomain | DataDomainSchema, organization: string, owner?: string): DomainFile {
26
+ static fromDataDomain(input: DataDomain | DataDomainSchema): DomainFile {
28
27
  let final: DataDomainSchema
29
28
  if (typeof (input as DataDomain).toJSON === 'function') {
30
29
  final = (input as DataDomain).toJSON()
@@ -34,10 +33,8 @@ export class DomainFile extends File {
34
33
  const init: IDomainFile = {
35
34
  kind: DomainFileKind,
36
35
  key: final.key,
37
- organization,
38
36
  info: { ...final.info },
39
- lastModified: { user: owner || '', time: 0, byMe: false },
40
- owner,
37
+ lastModified: { user: '', time: 0, byMe: false },
41
38
  parents: [],
42
39
  permissionIds: [],
43
40
  permissions: [],
@@ -56,7 +53,6 @@ export class DomainFile extends File {
56
53
  init = {
57
54
  kind: DomainFileKind,
58
55
  key: nanoid(),
59
- organization: '',
60
56
  info: Thing.fromName('').toJSON(),
61
57
  parents: [],
62
58
  permissionIds: [],
@@ -11,18 +11,12 @@ export interface ICertificateFile extends IFile {
11
11
  export class CertificateFile extends File {
12
12
  override kind = CertificateFileKind
13
13
 
14
- static fromCertificate(
15
- certificate: ICertificate | Certificate,
16
- organization: string,
17
- owner?: string
18
- ): CertificateFile {
14
+ static fromCertificate(certificate: ICertificate | Certificate): CertificateFile {
19
15
  const init: ICertificateFile = {
20
16
  kind: CertificateFileKind,
21
17
  key: certificate.key,
22
- organization,
23
18
  info: Thing.fromName(certificate.name).toJSON(),
24
- lastModified: { user: owner || '', time: 0, byMe: false },
25
- owner,
19
+ lastModified: { user: '', time: 0, byMe: false },
26
20
  parents: [],
27
21
  permissionIds: [],
28
22
  permissions: [],
@@ -32,10 +26,9 @@ export class CertificateFile extends File {
32
26
 
33
27
  /**
34
28
  * @param name The name to set.
35
- * @param owner The user id that is the owner of the file.
36
29
  */
37
- static override fromName(name: string, organization: string, owner?: string): CertificateFile {
38
- return super.fromName(name, organization, owner, CertificateFileKind) as CertificateFile
30
+ static override fromName(name: string): CertificateFile {
31
+ return super.fromName(name, CertificateFileKind) as CertificateFile
39
32
  }
40
33
 
41
34
  constructor(input?: string | ICertificateFile) {
@@ -49,7 +42,6 @@ export class CertificateFile extends File {
49
42
  init = {
50
43
  kind: CertificateFileKind,
51
44
  key: nanoid(),
52
- organization: '',
53
45
  info: Thing.fromName('').toJSON(),
54
46
  parents: [],
55
47
  permissionIds: [],
@@ -20,10 +20,9 @@ export class Folder extends File {
20
20
  * Creates a new Folder object from a name.
21
21
  *
22
22
  * @param name The name to set.
23
- * @param owner The user id that is the owner of the folder.
24
23
  */
25
- static override fromName(name: string, organization: string, owner?: string): Folder {
26
- return super.fromName(name, organization, owner, FolderKind) as Folder
24
+ static override fromName(name: string): Folder {
25
+ return super.fromName(name, FolderKind) as Folder
27
26
  }
28
27
 
29
28
  /**
@@ -40,7 +39,6 @@ export class Folder extends File {
40
39
  init = {
41
40
  kind: FolderKind,
42
41
  key: nanoid(),
43
- organization: '',
44
42
  info: Thing.fromName('').toJSON(),
45
43
  parents: [],
46
44
  permissionIds: [],
@@ -19,7 +19,7 @@ export interface IProject extends IFile {
19
19
  export class Project extends File {
20
20
  override kind = ProjectKind
21
21
 
22
- static fromProject(project: HttpProject | IHttpProject, organization: string, owner?: string): Project {
22
+ static fromProject(project: HttpProject | IHttpProject): Project {
23
23
  let final: IHttpProject
24
24
  if (typeof (project as HttpProject).toJSON === 'function') {
25
25
  final = (project as HttpProject).toJSON()
@@ -29,10 +29,8 @@ export class Project extends File {
29
29
  const init: IProject = {
30
30
  kind: ProjectKind,
31
31
  key: project.key,
32
- organization,
33
32
  info: { ...final.info },
34
- lastModified: { user: owner || '', time: 0, byMe: false },
35
- owner,
33
+ lastModified: { user: '', time: 0, byMe: false },
36
34
  parents: [],
37
35
  permissionIds: [],
38
36
  permissions: [],
@@ -42,10 +40,9 @@ export class Project extends File {
42
40
 
43
41
  /**
44
42
  * @param name The name to set.
45
- * @param owner The user id that is the owner of the file.
46
43
  */
47
- static override fromName(name: string, organization: string, owner?: string): Project {
48
- return super.fromName(name, organization, owner, ProjectKind) as Project
44
+ static override fromName(name: string): Project {
45
+ return super.fromName(name, ProjectKind) as Project
49
46
  }
50
47
 
51
48
  constructor(input?: string | IProject) {
@@ -59,7 +56,6 @@ export class Project extends File {
59
56
  init = {
60
57
  kind: ProjectKind,
61
58
  key: nanoid(),
62
- organization: '',
63
59
  info: Thing.fromName('').toJSON(),
64
60
  parents: [],
65
61
  permissionIds: [],
@@ -19,10 +19,9 @@ export class DataFile extends File {
19
19
  * Creates the file definition for a DataNamespace contents.
20
20
  *
21
21
  * @param input The data namespace instance or schema.
22
- * @param owner Optional owner to set.
23
22
  * @deprecated Use DomainFile instead.
24
23
  */
25
- static fromDataNamespace(input: DataNamespace | IDataNamespace, organization: string, owner?: string): DataFile {
24
+ static fromDataNamespace(input: DataNamespace | IDataNamespace): DataFile {
26
25
  let final: IDataNamespace
27
26
  if (typeof (input as DataNamespace).toJSON === 'function') {
28
27
  final = (input as DataNamespace).toJSON()
@@ -32,10 +31,8 @@ export class DataFile extends File {
32
31
  const init: IDataFile = {
33
32
  kind: Kind,
34
33
  key: final.key,
35
- organization,
36
34
  info: { ...final.info },
37
- lastModified: { user: owner || '', time: 0, byMe: false },
38
- owner,
35
+ lastModified: { user: '', time: 0, byMe: false },
39
36
  parents: [],
40
37
  permissionIds: [],
41
38
  permissions: [],
@@ -45,10 +42,9 @@ export class DataFile extends File {
45
42
 
46
43
  /**
47
44
  * @param name The name to set.
48
- * @param owner The user id that is the owner of the file.
49
45
  */
50
- static override fromName(name: string, organization: string, owner?: string): DataFile {
51
- return super.fromName(name, organization, owner, Kind) as DataFile
46
+ static override fromName(name: string): DataFile {
47
+ return super.fromName(name, Kind) as DataFile
52
48
  }
53
49
 
54
50
  constructor(input?: string | IDataFile) {
@@ -62,7 +58,6 @@ export class DataFile extends File {
62
58
  init = {
63
59
  kind: Kind,
64
60
  key: nanoid(),
65
- organization: '',
66
61
  info: Thing.fromName('').toJSON(),
67
62
  parents: [],
68
63
  permissionIds: [],
@@ -51,19 +51,10 @@ export interface IStoredFile {
51
51
  * The identifier of the entity
52
52
  */
53
53
  key: string
54
- /**
55
- * The parent organization of the file.
56
- */
57
- organization: string
58
54
  /**
59
55
  * The file's meta info.
60
56
  */
61
57
  info: IThing
62
- /**
63
- * The owner of this object. The id of the User object.
64
- * Once the File is persistent by the API this is always populated.
65
- */
66
- owner?: string
67
58
  /**
68
59
  * The color of the icon to render for this file in the file explorer.
69
60
  * This should be a hex format, e.g.: #c00 for red.
@@ -144,7 +135,6 @@ export interface IFile extends IStoredFile {
144
135
  const parentsSymbol = Symbol('parents')
145
136
  const deletedSymbol = Symbol('deleted')
146
137
  const deletedInfoSymbol = Symbol('deletedInfo')
147
- const ownerSymbol = Symbol('owner')
148
138
  const lastModifiedSymbol = Symbol('lastModified')
149
139
  const capabilitiesSymbol = Symbol('capabilities')
150
140
  const permissionsSymbol = Symbol('permissions')
@@ -160,24 +150,10 @@ export class StoredFile {
160
150
  * The identifier of the entity
161
151
  */
162
152
  key = ''
163
- /**
164
- * The parent organization of the file.
165
- */
166
- organization = ''
167
153
  /**
168
154
  * The name of the environment.
169
155
  */
170
- info: Thing = Thing.fromName('');
171
-
172
- [ownerSymbol]?: string
173
-
174
- /**
175
- * The owner of this file. This is the id of the User object.
176
- * Set to `default` when there are no users in the system (no authentication).
177
- */
178
- get owner(): string | undefined {
179
- return this[ownerSymbol]
180
- }
156
+ info: Thing = Thing.fromName('')
181
157
 
182
158
  /**
183
159
  * The color of the icon to render for this file in the file explorer.
@@ -206,11 +182,9 @@ export class StoredFile {
206
182
  }
207
183
 
208
184
  new(init: IStoredFile): this {
209
- const { key = nanoid(), info, kind, owner, iconColor, organization, shortcutTarget } = init
185
+ const { key = nanoid(), info, kind, iconColor, shortcutTarget } = init
210
186
  this.key = key
211
- this.organization = organization
212
187
  this.kind = kind
213
- this[ownerSymbol] = owner
214
188
  if (info) {
215
189
  this.info = new Thing(info)
216
190
  } else {
@@ -230,13 +204,10 @@ export class StoredFile {
230
204
  }
231
205
 
232
206
  toJSON(): IStoredFile {
233
- const { owner } = this
234
207
  const result: IStoredFile = {
235
208
  key: this.key,
236
- organization: this.organization,
237
209
  kind: this.kind,
238
210
  info: this.info.toJSON(),
239
- owner,
240
211
  }
241
212
  if (this.iconColor) {
242
213
  result.iconColor = this.iconColor
@@ -484,19 +455,17 @@ export class File extends StoredFile {
484
455
  * @param name The name to set.
485
456
  * @param owner The user id that is the owner of the file.
486
457
  */
487
- static fromName(name: string, organization: string, owner?: string, kind = ''): File {
458
+ static fromName(name: string, kind = ''): File {
488
459
  const key = nanoid()
489
460
  const definition = new File()
490
461
  definition.new({
491
462
  key,
492
463
  kind,
493
- organization,
494
464
  info: Thing.fromName(name).toJSON(),
495
- owner,
496
465
  parents: [],
497
466
  permissionIds: [],
498
467
  permissions: [],
499
- lastModified: { user: owner || '', time: 0, byMe: false },
468
+ lastModified: { user: '', time: 0, byMe: false },
500
469
  })
501
470
  return definition
502
471
  }
@@ -200,7 +200,7 @@ export class FilesSdk extends SdkBase {
200
200
  opts: IMetaCreateOptions = {},
201
201
  request: SdkOptions = {}
202
202
  ): Promise<IFolder> {
203
- const file = Folder.fromName(name, organization)
203
+ const file = Folder.fromName(name)
204
204
  const { token } = request
205
205
  const url = this.sdk.getUrl(RouteBuilder.files(organization))
206
206
  if (opts.parent) {
@@ -1,42 +1,28 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { DomainFile, IDomainFile, ThingKind, DomainFileKind, DataDomain } from '../../../src/index.js'
3
3
 
4
- const organization = 'test-organization'
5
-
6
4
  test.group('DomainFile.fromDataDomain()', () => {
7
5
  test('sets the kind', ({ assert }) => {
8
6
  const p1 = new DataDomain({ info: { name: 'p1' } })
9
- const result = DomainFile.fromDataDomain(p1, organization)
7
+ const result = DomainFile.fromDataDomain(p1)
10
8
  assert.equal(result.kind, DomainFileKind)
11
9
  })
12
10
 
13
- test('sets the organization', ({ assert }) => {
14
- const p1 = new DataDomain({ info: { name: 'p1' } })
15
- const result = DomainFile.fromDataDomain(p1, organization)
16
- assert.equal(result.organization, organization)
17
- })
18
-
19
11
  test('sets the name', ({ assert }) => {
20
12
  const p1 = new DataDomain({ info: { name: 'p1' } })
21
- const result = DomainFile.fromDataDomain(p1, organization)
13
+ const result = DomainFile.fromDataDomain(p1)
22
14
  assert.equal(result.info.name, 'p1')
23
15
  })
24
16
 
25
17
  test('sets the key', ({ assert }) => {
26
18
  const p1 = new DataDomain({ info: { name: 'p1' } })
27
- const result = DomainFile.fromDataDomain(p1, organization)
19
+ const result = DomainFile.fromDataDomain(p1)
28
20
  assert.equal(result.key, p1.key)
29
21
  })
30
22
 
31
- test('sets the configured owner', ({ assert }) => {
32
- const p1 = new DataDomain({ info: { name: 'p1' } })
33
- const result = DomainFile.fromDataDomain(p1, organization, 'other')
34
- assert.equal(result.owner, 'other')
35
- })
36
-
37
23
  test('respects schema instead of instance', ({ assert }) => {
38
24
  const p1 = new DataDomain({ info: { name: 'p1' } })
39
- const result = DomainFile.fromDataDomain(p1.toJSON(), organization)
25
+ const result = DomainFile.fromDataDomain(p1.toJSON())
40
26
  assert.equal(result.info.name, 'p1')
41
27
  })
42
28
  })
@@ -45,7 +31,6 @@ test.group('constructor()', () => {
45
31
  test('creates a default data file', ({ assert }) => {
46
32
  const result = new DomainFile()
47
33
  assert.equal(result.kind, DomainFileKind)
48
- assert.isUndefined(result.owner)
49
34
  assert.typeOf(result.key, 'string')
50
35
  assert.typeOf(result.lastModified, 'object')
51
36
  })
@@ -53,13 +38,11 @@ test.group('constructor()', () => {
53
38
  test('creates a data file from the schema values', ({ assert }) => {
54
39
  const schema: IDomainFile = {
55
40
  kind: DomainFileKind,
56
- organization,
57
41
  info: {
58
42
  kind: ThingKind,
59
43
  name: 'hello',
60
44
  description: 'a desc',
61
45
  },
62
- owner: 'me',
63
46
  key: '123',
64
47
  parents: ['p1'],
65
48
  permissionIds: ['pr1'],
@@ -81,9 +64,7 @@ test.group('constructor()', () => {
81
64
  }
82
65
  const result = new DomainFile(schema)
83
66
  assert.equal(result.kind, DomainFileKind)
84
- assert.equal(result.organization, organization)
85
67
  assert.equal(result.info.name, 'hello')
86
- assert.equal(result.owner, 'me')
87
68
  assert.equal(result.key, '123')
88
69
  assert.deepEqual(result.parents, ['p1'])
89
70
  assert.deepEqual(result.permissionIds, ['pr1'])
@@ -95,13 +76,11 @@ test.group('constructor()', () => {
95
76
  test('creates a data file from the JSON schema string', ({ assert }) => {
96
77
  const schema: IDomainFile = {
97
78
  kind: DomainFileKind,
98
- organization,
99
79
  info: {
100
80
  kind: ThingKind,
101
81
  name: 'hello',
102
82
  description: 'a desc',
103
83
  },
104
- owner: 'me',
105
84
  key: '123',
106
85
  parents: ['p1'],
107
86
  permissionIds: ['pr1'],
@@ -122,9 +101,7 @@ test.group('constructor()', () => {
122
101
  }
123
102
  const result = new DomainFile(JSON.stringify(schema))
124
103
  assert.equal(result.kind, DomainFileKind)
125
- assert.equal(result.organization, organization)
126
104
  assert.equal(result.info.name, 'hello')
127
- assert.equal(result.owner, 'me')
128
105
  assert.equal(result.key, '123')
129
106
  assert.deepEqual(result.lastModified, schema.lastModified)
130
107
  })
@@ -1,32 +1,20 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { CertificateFile, CertificateFileKind } from '../../../../src/index.js'
3
3
 
4
- const organization = 'test-organization'
5
-
6
4
  test.group('CertificateFile.fromName()', () => {
7
5
  test('sets the kind', ({ assert }) => {
8
- const result = CertificateFile.fromName('name', organization)
6
+ const result = CertificateFile.fromName('name')
9
7
  assert.equal(result.kind, CertificateFileKind)
10
8
  })
11
9
 
12
- test('sets the organization', ({ assert }) => {
13
- const result = CertificateFile.fromName('name', organization)
14
- assert.equal(result.organization, organization)
15
- })
16
-
17
10
  test('sets the name', ({ assert }) => {
18
- const result = CertificateFile.fromName('name', organization)
11
+ const result = CertificateFile.fromName('name')
19
12
  assert.equal(result.info.name, 'name')
20
13
  })
21
14
 
22
15
  test('sets the key', ({ assert }) => {
23
- const result = CertificateFile.fromName('name', organization)
16
+ const result = CertificateFile.fromName('name')
24
17
  assert.typeOf(result.key, 'string')
25
18
  assert.notEqual(result.key, '')
26
19
  })
27
-
28
- test('sets the owner', ({ assert }) => {
29
- const result = CertificateFile.fromName('name', organization, 'other')
30
- assert.equal(result.owner, 'other')
31
- })
32
20
  })
@@ -5,7 +5,6 @@ test.group('File.constructor()', () => {
5
5
  test('creates a default File', ({ assert }) => {
6
6
  const result = new File()
7
7
  assert.equal(result.kind, '')
8
- assert.isUndefined(result.owner)
9
8
  assert.equal(result.key, '')
10
9
  assert.deepEqual(result.info.toJSON(), { kind: ThingKind, name: '' })
11
10
  assert.deepEqual(result.parents, [])
@@ -4,18 +4,15 @@ import { File, ThingKind, IFile } from '../../../../src/index.js'
4
4
  test.group('File.new()', (group) => {
5
5
  let file: File
6
6
  let base: IFile
7
- const organization = 'test123'
8
7
  group.each.setup(async () => {
9
8
  file = new File()
10
9
  base = {
11
10
  kind: 'test-kind',
12
- organization,
13
11
  info: {
14
12
  kind: ThingKind,
15
13
  name: 'hello',
16
14
  description: 'a desc',
17
15
  },
18
- owner: 'me',
19
16
  key: '123',
20
17
  parents: ['p1'],
21
18
  permissionIds: ['pr1'],
@@ -45,11 +42,6 @@ test.group('File.new()', (group) => {
45
42
  assert.equal(file.key, '123')
46
43
  })
47
44
 
48
- test('sets the organization', ({ assert }) => {
49
- file.new({ ...base })
50
- assert.equal(file.organization, organization)
51
- })
52
-
53
45
  test('sets a new key when missing', ({ assert }) => {
54
46
  const iFile = { ...base }
55
47
  Reflect.deleteProperty(iFile, 'key')
@@ -99,11 +91,6 @@ test.group('File.new()', (group) => {
99
91
  assert.deepEqual(file.permissionIds, [])
100
92
  })
101
93
 
102
- test('sets the owner', ({ assert }) => {
103
- file.new({ ...base })
104
- assert.equal(file.owner, 'me')
105
- })
106
-
107
94
  test('sets the lastModified', ({ assert }) => {
108
95
  file.new({ ...base })
109
96
  assert.deepEqual(file.lastModified, base.lastModified)
@@ -46,8 +46,7 @@ test.group('File.shortcutTo()', () => {
46
46
  })
47
47
 
48
48
  test('creates a shortcut from a name with fromName()', ({ assert }) => {
49
- const organization = 'test-org'
50
- const file = File.fromName('test-file', organization)
49
+ const file = File.fromName('test-file')
51
50
  const targetId = 'target-file-id'
52
51
  file.shortcutTo(targetId)
53
52
  assert.equal(file.shortcutTarget, targetId)