@api-client/core 0.12.0 → 0.12.1
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/build/src/amf/AmfShapeGenerator.js +3 -3
- package/build/src/amf/AmfShapeGenerator.js.map +1 -1
- package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
- package/build/src/amf/DataValueGenerator.js +3 -2
- package/build/src/amf/DataValueGenerator.js.map +1 -1
- package/build/src/amf/models/AmfDataNode.d.ts.map +1 -1
- package/build/src/amf/models/AmfDataNode.js +2 -2
- package/build/src/amf/models/AmfDataNode.js.map +1 -1
- package/build/src/lib/uuid.d.ts +1 -1
- package/build/src/lib/uuid.js +1 -1
- package/build/src/lib/uuid.js.map +1 -1
- package/build/src/mocking/lib/History.js +8 -8
- package/build/src/mocking/lib/History.js.map +1 -1
- package/build/src/mocking/lib/HostRules.js +1 -1
- package/build/src/mocking/lib/HostRules.js.map +1 -1
- package/build/src/mocking/lib/User.js +2 -2
- package/build/src/mocking/lib/User.js.map +1 -1
- package/build/src/modeling/DataDomain.d.ts.map +1 -1
- package/build/src/modeling/DataDomain.js +2 -3
- package/build/src/modeling/DataDomain.js.map +1 -1
- package/build/src/modeling/DomainFile.js +2 -2
- package/build/src/modeling/DomainFile.js.map +1 -1
- package/build/src/modeling/legacy/DataAssociation.js +3 -3
- package/build/src/modeling/legacy/DataAssociation.js.map +1 -1
- package/build/src/modeling/legacy/DataEntity.js +3 -3
- package/build/src/modeling/legacy/DataEntity.js.map +1 -1
- package/build/src/modeling/legacy/DataEntityBuilder.js +2 -2
- package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -1
- package/build/src/modeling/legacy/DataModel.js +3 -3
- package/build/src/modeling/legacy/DataModel.js.map +1 -1
- package/build/src/modeling/legacy/DataNamespace.js +3 -3
- package/build/src/modeling/legacy/DataNamespace.js.map +1 -1
- package/build/src/modeling/legacy/DataProperty.js +3 -3
- package/build/src/modeling/legacy/DataProperty.js.map +1 -1
- package/build/src/models/AuthorizationData.js +3 -3
- package/build/src/models/AuthorizationData.js.map +1 -1
- package/build/src/models/CertificateFile.js +2 -2
- package/build/src/models/CertificateFile.js.map +1 -1
- package/build/src/models/ClientCertificate.js +5 -5
- package/build/src/models/ClientCertificate.js.map +1 -1
- package/build/src/models/Environment.js +6 -6
- package/build/src/models/Environment.js.map +1 -1
- package/build/src/models/Folder.js +2 -2
- package/build/src/models/Folder.js.map +1 -1
- package/build/src/models/HostRule.js +4 -4
- package/build/src/models/HostRule.js.map +1 -1
- package/build/src/models/HttpProject.js +12 -12
- package/build/src/models/HttpProject.js.map +1 -1
- package/build/src/models/Project.d.ts.map +1 -1
- package/build/src/models/Project.js +2 -2
- package/build/src/models/Project.js.map +1 -1
- package/build/src/models/ProjectFolder.d.ts.map +1 -1
- package/build/src/models/ProjectFolder.js +6 -6
- package/build/src/models/ProjectFolder.js.map +1 -1
- package/build/src/models/ProjectRequest.d.ts.map +1 -1
- package/build/src/models/ProjectRequest.js +8 -8
- package/build/src/models/ProjectRequest.js.map +1 -1
- package/build/src/models/ProjectSchema.js +6 -6
- package/build/src/models/ProjectSchema.js.map +1 -1
- package/build/src/models/store/DataFile.js +2 -2
- package/build/src/models/store/DataFile.js.map +1 -1
- package/build/src/models/store/File.d.ts.map +1 -1
- package/build/src/models/store/File.js +3 -3
- package/build/src/models/store/File.js.map +1 -1
- package/build/src/models/store/Organization.js +3 -3
- package/build/src/models/store/Organization.js.map +1 -1
- package/build/src/models/store/Permission.js +7 -7
- package/build/src/models/store/Permission.js.map +1 -1
- package/build/src/models/store/UserIdentity.js +3 -3
- package/build/src/models/store/UserIdentity.js.map +1 -1
- package/build/src/models/transformers/ArcDexieTransformer.js +4 -4
- package/build/src/models/transformers/ArcDexieTransformer.js.map +1 -1
- package/build/src/models/transformers/ArcLegacyTransformer.js +3 -3
- package/build/src/models/transformers/ArcLegacyTransformer.js.map +1 -1
- package/build/src/models/transformers/ArcPouchTransformer.js +2 -2
- package/build/src/models/transformers/ArcPouchTransformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV21Transformer.js +2 -2
- package/build/src/models/transformers/PostmanV21Transformer.js.map +1 -1
- package/build/src/models/transformers/PostmanV2Transformer.js +2 -2
- package/build/src/models/transformers/PostmanV2Transformer.js.map +1 -1
- package/build/src/patch/PatchClient.js +2 -2
- package/build/src/patch/PatchClient.js.map +1 -1
- package/build/src/runtime/store/FilesSdk.js +3 -3
- package/build/src/runtime/store/FilesSdk.js.map +1 -1
- package/data/models/example-generator-api.json +18 -18
- package/package.json +1 -1
- package/src/amf/AmfShapeGenerator.ts +3 -3
- package/src/amf/DataValueGenerator.ts +3 -2
- package/src/amf/models/AmfDataNode.ts +2 -2
- package/src/lib/uuid.ts +1 -1
- package/src/mocking/lib/History.ts +8 -8
- package/src/mocking/lib/HostRules.ts +1 -1
- package/src/mocking/lib/User.ts +2 -2
- package/src/modeling/DataDomain.ts +2 -3
- package/src/modeling/DomainFile.ts +2 -2
- package/src/modeling/legacy/DataAssociation.ts +3 -3
- package/src/modeling/legacy/DataEntity.ts +3 -3
- package/src/modeling/legacy/DataEntityBuilder.ts +2 -2
- package/src/modeling/legacy/DataModel.ts +3 -3
- package/src/modeling/legacy/DataNamespace.ts +3 -3
- package/src/modeling/legacy/DataProperty.ts +3 -3
- package/src/models/AuthorizationData.ts +3 -3
- package/src/models/CertificateFile.ts +2 -2
- package/src/models/ClientCertificate.ts +5 -5
- package/src/models/Environment.ts +6 -6
- package/src/models/Folder.ts +2 -2
- package/src/models/HostRule.ts +4 -4
- package/src/models/HttpProject.ts +12 -12
- package/src/models/Project.ts +2 -2
- package/src/models/ProjectFolder.ts +6 -6
- package/src/models/ProjectRequest.ts +8 -8
- package/src/models/ProjectSchema.ts +6 -6
- package/src/models/store/DataFile.ts +2 -2
- package/src/models/store/File.ts +3 -3
- package/src/models/store/Organization.ts +3 -3
- package/src/models/store/Permission.ts +7 -7
- package/src/models/store/UserIdentity.ts +3 -3
- package/src/models/transformers/ArcDexieTransformer.ts +4 -4
- package/src/models/transformers/ArcLegacyTransformer.ts +3 -3
- package/src/models/transformers/ArcPouchTransformer.ts +2 -2
- package/src/models/transformers/PostmanV21Transformer.ts +2 -2
- package/src/models/transformers/PostmanV2Transformer.ts +2 -2
- package/src/patch/PatchClient.ts +2 -2
- package/src/runtime/store/FilesSdk.ts +3 -3
- package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +8 -8
package/src/models/HostRule.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
|
|
3
3
|
export const Kind = 'Core#HostRule'
|
|
4
4
|
|
|
@@ -56,7 +56,7 @@ export class HostRule {
|
|
|
56
56
|
|
|
57
57
|
static fromValues(from: string, to: string): HostRule {
|
|
58
58
|
const result = new HostRule({
|
|
59
|
-
key:
|
|
59
|
+
key: nanoid(),
|
|
60
60
|
kind: Kind,
|
|
61
61
|
from,
|
|
62
62
|
to,
|
|
@@ -76,7 +76,7 @@ export class HostRule {
|
|
|
76
76
|
init = input
|
|
77
77
|
} else {
|
|
78
78
|
init = {
|
|
79
|
-
key:
|
|
79
|
+
key: nanoid(),
|
|
80
80
|
kind: Kind,
|
|
81
81
|
from: '',
|
|
82
82
|
to: '',
|
|
@@ -94,7 +94,7 @@ export class HostRule {
|
|
|
94
94
|
if (!HostRule.isHostRule(init)) {
|
|
95
95
|
throw new Error(`Not a HostRule.`)
|
|
96
96
|
}
|
|
97
|
-
const { from = '', to = '', enabled, comment, key =
|
|
97
|
+
const { from = '', to = '', enabled, comment, key = nanoid() } = init
|
|
98
98
|
this.kind = Kind
|
|
99
99
|
this.key = key
|
|
100
100
|
this.from = from
|
|
@@ -12,7 +12,7 @@ import { IProjectFolder, ProjectFolder } from './ProjectFolder.js'
|
|
|
12
12
|
import { IProjectRequest, ProjectRequest, Kind as ProjectRequestKind } from './ProjectRequest.js'
|
|
13
13
|
import { ProjectSchema, IProjectSchema } from './ProjectSchema.js'
|
|
14
14
|
import { Request } from './Request.js'
|
|
15
|
-
import
|
|
15
|
+
import { nanoid } from 'nanoid'
|
|
16
16
|
import { ARCSavedRequest, ARCHistoryRequest } from './legacy/request/ArcRequest.js'
|
|
17
17
|
import { ArcLegacyProject, ARCProject } from './legacy/models/ArcLegacyProject.js'
|
|
18
18
|
import { PostmanDataTransformer } from './transformers/PostmanDataTransformer.js'
|
|
@@ -372,7 +372,7 @@ export class HttpProject extends ProjectParent {
|
|
|
372
372
|
} else {
|
|
373
373
|
init = {
|
|
374
374
|
kind: Kind,
|
|
375
|
-
key:
|
|
375
|
+
key: nanoid(),
|
|
376
376
|
definitions: {},
|
|
377
377
|
items: [],
|
|
378
378
|
info: Thing.fromName('').toJSON(),
|
|
@@ -390,7 +390,7 @@ export class HttpProject extends ProjectParent {
|
|
|
390
390
|
if (!init || !init.definitions || !init.items) {
|
|
391
391
|
throw new Error(`Not a project.`)
|
|
392
392
|
}
|
|
393
|
-
const { key =
|
|
393
|
+
const { key = nanoid(), definitions = {}, items, info, license, provider } = init
|
|
394
394
|
this.key = key
|
|
395
395
|
if (license) {
|
|
396
396
|
this.license = new License(license)
|
|
@@ -739,7 +739,7 @@ export class HttpProject extends ProjectParent {
|
|
|
739
739
|
finalRequest = new ProjectRequest(this, request)
|
|
740
740
|
}
|
|
741
741
|
if (!finalRequest.key) {
|
|
742
|
-
finalRequest.key =
|
|
742
|
+
finalRequest.key = nanoid()
|
|
743
743
|
}
|
|
744
744
|
|
|
745
745
|
let root: ProjectFolder | HttpProject
|
|
@@ -1039,7 +1039,7 @@ export class HttpProject extends ProjectParent {
|
|
|
1039
1039
|
clone(opts: IProjectCloneOptions = {}): HttpProject {
|
|
1040
1040
|
const copy = new HttpProject(this.toJSON())
|
|
1041
1041
|
if (!opts.withoutRevalidate) {
|
|
1042
|
-
copy.key =
|
|
1042
|
+
copy.key = nanoid()
|
|
1043
1043
|
HttpProject.regenerateKeys(copy)
|
|
1044
1044
|
}
|
|
1045
1045
|
return copy
|
|
@@ -1072,7 +1072,7 @@ export class HttpProject extends ProjectParent {
|
|
|
1072
1072
|
if (!indexObject) {
|
|
1073
1073
|
return
|
|
1074
1074
|
}
|
|
1075
|
-
const newKey =
|
|
1075
|
+
const newKey = nanoid()
|
|
1076
1076
|
indexObject.key = newKey
|
|
1077
1077
|
folder.key = newKey
|
|
1078
1078
|
})
|
|
@@ -1082,15 +1082,15 @@ export class HttpProject extends ProjectParent {
|
|
|
1082
1082
|
if (!indexObject) {
|
|
1083
1083
|
return
|
|
1084
1084
|
}
|
|
1085
|
-
const newKey =
|
|
1085
|
+
const newKey = nanoid()
|
|
1086
1086
|
indexObject.key = newKey
|
|
1087
1087
|
request.key = newKey
|
|
1088
1088
|
})
|
|
1089
1089
|
;(definitions.schemas || []).forEach((schema) => {
|
|
1090
|
-
schema.key =
|
|
1090
|
+
schema.key = nanoid()
|
|
1091
1091
|
})
|
|
1092
1092
|
;(definitions.certificates || []).forEach((cert) => {
|
|
1093
|
-
cert.key =
|
|
1093
|
+
cert.key = nanoid()
|
|
1094
1094
|
})
|
|
1095
1095
|
;(definitions.environments || []).forEach((environment) => {
|
|
1096
1096
|
const oldKey = environment.key
|
|
@@ -1098,7 +1098,7 @@ export class HttpProject extends ProjectParent {
|
|
|
1098
1098
|
if (!indexObject) {
|
|
1099
1099
|
return
|
|
1100
1100
|
}
|
|
1101
|
-
const newKey =
|
|
1101
|
+
const newKey = nanoid()
|
|
1102
1102
|
indexObject.key = newKey
|
|
1103
1103
|
environment.key = newKey
|
|
1104
1104
|
})
|
|
@@ -1133,7 +1133,7 @@ export class HttpProject extends ProjectParent {
|
|
|
1133
1133
|
finalSchema = new ProjectSchema(schema)
|
|
1134
1134
|
}
|
|
1135
1135
|
if (!finalSchema.key) {
|
|
1136
|
-
finalSchema.key =
|
|
1136
|
+
finalSchema.key = nanoid()
|
|
1137
1137
|
}
|
|
1138
1138
|
const { index } = opts
|
|
1139
1139
|
const hasIndex = typeof index === 'number'
|
|
@@ -1328,7 +1328,7 @@ export class HttpProject extends ProjectParent {
|
|
|
1328
1328
|
finalEnv = new Environment(env)
|
|
1329
1329
|
}
|
|
1330
1330
|
if (!finalEnv.key) {
|
|
1331
|
-
finalEnv.key =
|
|
1331
|
+
finalEnv.key = nanoid()
|
|
1332
1332
|
}
|
|
1333
1333
|
return finalEnv
|
|
1334
1334
|
}
|
package/src/models/Project.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
1
2
|
import { IFile, File } from './store/File.js'
|
|
2
3
|
import { Thing } from './Thing.js'
|
|
3
4
|
import { HttpProject, IHttpProject } from './HttpProject.js'
|
|
4
|
-
import v4 from '../lib/uuid.js'
|
|
5
5
|
import { ProjectKind } from './kinds.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -58,7 +58,7 @@ export class Project extends File {
|
|
|
58
58
|
} else {
|
|
59
59
|
init = {
|
|
60
60
|
kind: ProjectKind,
|
|
61
|
-
key:
|
|
61
|
+
key: nanoid(),
|
|
62
62
|
organization: '',
|
|
63
63
|
info: Thing.fromName('').toJSON(),
|
|
64
64
|
parents: [],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
1
2
|
import { ProjectParent } from './ProjectParent.js'
|
|
2
3
|
import { type IProjectDefinitionProperty } from './ProjectDefinitionProperty.js'
|
|
3
4
|
import { ProjectItem, type IProjectItem } from './ProjectItem.js'
|
|
@@ -6,7 +7,6 @@ import { type HttpProject, type IEnvironmentCreateOptions } from './HttpProject.
|
|
|
6
7
|
import { type IThing, Thing } from './Thing.js'
|
|
7
8
|
import { Environment, type IEnvironment } from './Environment.js'
|
|
8
9
|
import { ProjectFolderKind } from './kinds.js'
|
|
9
|
-
import v4 from '../lib/uuid.js'
|
|
10
10
|
|
|
11
11
|
export const DefaultFolderName = 'New folder'
|
|
12
12
|
|
|
@@ -110,7 +110,7 @@ export class ProjectFolder extends ProjectParent {
|
|
|
110
110
|
created: now,
|
|
111
111
|
updated: now,
|
|
112
112
|
items: [],
|
|
113
|
-
key:
|
|
113
|
+
key: nanoid(),
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
this.new(init)
|
|
@@ -125,7 +125,7 @@ export class ProjectFolder extends ProjectParent {
|
|
|
125
125
|
if (!ProjectFolder.isProjectFolder(init)) {
|
|
126
126
|
throw new Error(`Not a project folder.`)
|
|
127
127
|
}
|
|
128
|
-
const { key =
|
|
128
|
+
const { key = nanoid(), created = Date.now(), updated = Date.now(), items, info } = init
|
|
129
129
|
this.kind = ProjectFolderKind
|
|
130
130
|
this.key = key
|
|
131
131
|
this.created = created
|
|
@@ -175,7 +175,7 @@ export class ProjectFolder extends ProjectParent {
|
|
|
175
175
|
*/
|
|
176
176
|
static fromName(project: HttpProject, name = DefaultFolderName): ProjectFolder {
|
|
177
177
|
const now = Date.now()
|
|
178
|
-
const key =
|
|
178
|
+
const key = nanoid()
|
|
179
179
|
const info = Thing.fromName(name)
|
|
180
180
|
const definition = new ProjectFolder(project, {
|
|
181
181
|
key,
|
|
@@ -350,7 +350,7 @@ export class ProjectFolder extends ProjectParent {
|
|
|
350
350
|
clone(opts: IFolderCloneOptions = {}): ProjectFolder {
|
|
351
351
|
const { targetProject = this.project, targetFolder } = opts
|
|
352
352
|
const copy = new ProjectFolder(targetProject, this.toJSON())
|
|
353
|
-
copy.key =
|
|
353
|
+
copy.key = nanoid()
|
|
354
354
|
|
|
355
355
|
const extProject = targetProject !== this.project
|
|
356
356
|
if (extProject) {
|
|
@@ -428,7 +428,7 @@ export class ProjectFolder extends ProjectParent {
|
|
|
428
428
|
return
|
|
429
429
|
}
|
|
430
430
|
const copy = new ProjectFolder(folder.getProject(), definition.toJSON())
|
|
431
|
-
copy.key =
|
|
431
|
+
copy.key = nanoid()
|
|
432
432
|
copy.items = []
|
|
433
433
|
folder.addFolder(copy)
|
|
434
434
|
if (withRequests) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
1
2
|
import { ProjectDefinitionProperty, IProjectDefinitionProperty } from './ProjectDefinitionProperty.js'
|
|
2
3
|
import { ProjectFolder } from './ProjectFolder.js'
|
|
3
4
|
import { IHttpRequest, Kind as HttpRequestKind } from './HttpRequest.js'
|
|
4
5
|
import { HttpProject } from './HttpProject.js'
|
|
5
|
-
import v4 from '../lib/uuid.js'
|
|
6
6
|
import { IRequest, Request } from './Request.js'
|
|
7
7
|
import { Environment } from './Environment.js'
|
|
8
8
|
import { Property } from './Property.js'
|
|
@@ -109,7 +109,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
109
109
|
}
|
|
110
110
|
const now: number = Date.now()
|
|
111
111
|
const request = new ProjectRequest(project, {
|
|
112
|
-
key:
|
|
112
|
+
key: nanoid(),
|
|
113
113
|
kind: Kind,
|
|
114
114
|
created: now,
|
|
115
115
|
updated: now,
|
|
@@ -136,7 +136,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
136
136
|
}
|
|
137
137
|
const now: number = Date.now()
|
|
138
138
|
const request = new ProjectRequest(project, {
|
|
139
|
-
key:
|
|
139
|
+
key: nanoid(),
|
|
140
140
|
kind: Kind,
|
|
141
141
|
created: now,
|
|
142
142
|
updated: now,
|
|
@@ -163,7 +163,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
163
163
|
}
|
|
164
164
|
const now: number = Date.now()
|
|
165
165
|
const request = new ProjectRequest(project, {
|
|
166
|
-
key:
|
|
166
|
+
key: nanoid(),
|
|
167
167
|
kind: Kind,
|
|
168
168
|
created: now,
|
|
169
169
|
updated: now,
|
|
@@ -183,7 +183,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
183
183
|
* Creates a project request for a schema of a Request.
|
|
184
184
|
*/
|
|
185
185
|
static fromRequest(request: IRequest, project: HttpProject): ProjectRequest {
|
|
186
|
-
const key =
|
|
186
|
+
const key = nanoid()
|
|
187
187
|
const init: IProjectRequest = { ...request, key, kind: Kind }
|
|
188
188
|
const result = new ProjectRequest(project, init)
|
|
189
189
|
return result
|
|
@@ -200,7 +200,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
200
200
|
} else {
|
|
201
201
|
const now: number = Date.now()
|
|
202
202
|
init = {
|
|
203
|
-
key:
|
|
203
|
+
key: nanoid(),
|
|
204
204
|
kind: Kind,
|
|
205
205
|
created: now,
|
|
206
206
|
updated: now,
|
|
@@ -219,7 +219,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
219
219
|
super.new(init)
|
|
220
220
|
|
|
221
221
|
const { key, environment } = init as IProjectRequest
|
|
222
|
-
this.key = key ||
|
|
222
|
+
this.key = key || nanoid()
|
|
223
223
|
if (environment) {
|
|
224
224
|
this.environment = environment
|
|
225
225
|
}
|
|
@@ -282,7 +282,7 @@ export class ProjectRequest extends Request implements ProjectDefinitionProperty
|
|
|
282
282
|
clone(opts: IRequestCloneOptions = {}): ProjectRequest {
|
|
283
283
|
const copy = new ProjectRequest(this.project, this.toJSON())
|
|
284
284
|
if (!opts.withoutRevalidate) {
|
|
285
|
-
copy.key =
|
|
285
|
+
copy.key = nanoid()
|
|
286
286
|
}
|
|
287
287
|
if (!opts.withoutAttach) {
|
|
288
288
|
// if the parent is the project then add the request to the project.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { Property, IProperty, PropertyType, Kind as PropertyKind } from './Property.js'
|
|
3
3
|
export const Kind = 'Core#ProjectSchema'
|
|
4
4
|
|
|
@@ -78,7 +78,7 @@ export class ProjectSchema {
|
|
|
78
78
|
const init: IProjectSchema = {
|
|
79
79
|
kind: Kind,
|
|
80
80
|
name,
|
|
81
|
-
key:
|
|
81
|
+
key: nanoid(),
|
|
82
82
|
}
|
|
83
83
|
return new ProjectSchema(init)
|
|
84
84
|
}
|
|
@@ -94,7 +94,7 @@ export class ProjectSchema {
|
|
|
94
94
|
const init: IProjectSchema = {
|
|
95
95
|
kind: Kind,
|
|
96
96
|
name,
|
|
97
|
-
key:
|
|
97
|
+
key: nanoid(),
|
|
98
98
|
content,
|
|
99
99
|
mime,
|
|
100
100
|
}
|
|
@@ -114,7 +114,7 @@ export class ProjectSchema {
|
|
|
114
114
|
init = {
|
|
115
115
|
kind: Kind,
|
|
116
116
|
name: '',
|
|
117
|
-
key:
|
|
117
|
+
key: nanoid(),
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
this.new(init)
|
|
@@ -124,7 +124,7 @@ export class ProjectSchema {
|
|
|
124
124
|
* Creates a new schema definition clearing anything that is so far defined.
|
|
125
125
|
*/
|
|
126
126
|
new(init: IProjectSchema): void {
|
|
127
|
-
const { key =
|
|
127
|
+
const { key = nanoid(), content, properties, mime, name = '' } = init
|
|
128
128
|
this.name = name
|
|
129
129
|
this.key = key
|
|
130
130
|
if (content) {
|
|
@@ -148,7 +148,7 @@ export class ProjectSchema {
|
|
|
148
148
|
const result: IProjectSchema = {
|
|
149
149
|
kind: Kind,
|
|
150
150
|
name: this.name || '',
|
|
151
|
-
key: this.key ||
|
|
151
|
+
key: this.key || nanoid(),
|
|
152
152
|
}
|
|
153
153
|
if (this.content) {
|
|
154
154
|
result.content = this.content
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { File, IFile } from './File.js'
|
|
3
3
|
import { Thing } from '../Thing.js'
|
|
4
4
|
import { DataNamespace, IDataNamespace } from '../../modeling/legacy/DataNamespace.js'
|
|
@@ -61,7 +61,7 @@ export class DataFile extends File {
|
|
|
61
61
|
} else {
|
|
62
62
|
init = {
|
|
63
63
|
kind: Kind,
|
|
64
|
-
key:
|
|
64
|
+
key: nanoid(),
|
|
65
65
|
organization: '',
|
|
66
66
|
info: Thing.fromName('').toJSON(),
|
|
67
67
|
parents: [],
|
package/src/models/store/File.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
1
2
|
import { IPermission, Permission, PermissionRole } from './Permission.js'
|
|
2
3
|
import { IModification } from './Modification.js'
|
|
3
4
|
import { IDeletion } from './Deletion.js'
|
|
4
5
|
import { IUser, Kind as UserKind } from './User.js'
|
|
5
6
|
import { IThing, Thing } from '../Thing.js'
|
|
6
|
-
import v4 from '../../lib/uuid.js'
|
|
7
7
|
import { ICapabilities } from './Capabilities.js'
|
|
8
8
|
import { FolderKind } from '../kinds.js'
|
|
9
9
|
// this causes error
|
|
@@ -206,7 +206,7 @@ export class StoredFile {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
new(init: IStoredFile): this {
|
|
209
|
-
const { key =
|
|
209
|
+
const { key = nanoid(), info, kind, owner, iconColor, organization, shortcutTarget } = init
|
|
210
210
|
this.key = key
|
|
211
211
|
this.organization = organization
|
|
212
212
|
this.kind = kind
|
|
@@ -485,7 +485,7 @@ export class File extends StoredFile {
|
|
|
485
485
|
* @param owner The user id that is the owner of the file.
|
|
486
486
|
*/
|
|
487
487
|
static fromName(name: string, organization: string, owner?: string, kind = ''): File {
|
|
488
|
-
const key =
|
|
488
|
+
const key = nanoid()
|
|
489
489
|
const definition = new File()
|
|
490
490
|
definition.new({
|
|
491
491
|
key,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import type { IDeletion } from './Deletion.js'
|
|
3
3
|
|
|
4
4
|
export const Kind = 'Core#Organization'
|
|
@@ -63,7 +63,7 @@ export class Organization implements IOrganization {
|
|
|
63
63
|
} else {
|
|
64
64
|
init = {
|
|
65
65
|
kind: Kind,
|
|
66
|
-
key:
|
|
66
|
+
key: nanoid(),
|
|
67
67
|
name: '',
|
|
68
68
|
createdBy: '',
|
|
69
69
|
createdDate: Date.now(),
|
|
@@ -79,7 +79,7 @@ export class Organization implements IOrganization {
|
|
|
79
79
|
throw new Error(`Not an Organization.`)
|
|
80
80
|
}
|
|
81
81
|
const {
|
|
82
|
-
key =
|
|
82
|
+
key = nanoid(),
|
|
83
83
|
name,
|
|
84
84
|
createdBy,
|
|
85
85
|
createdDate = Date.now(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
|
|
3
3
|
export const Kind = 'Core#Permission'
|
|
4
4
|
|
|
@@ -129,7 +129,7 @@ export class Permission {
|
|
|
129
129
|
*/
|
|
130
130
|
static fromUserRole(role: PermissionRole, itemId: string, user: string, addingUser: string): Permission {
|
|
131
131
|
const init: IPermission = {
|
|
132
|
-
key:
|
|
132
|
+
key: nanoid(),
|
|
133
133
|
kind: Kind,
|
|
134
134
|
itemId,
|
|
135
135
|
granteeId: user,
|
|
@@ -150,7 +150,7 @@ export class Permission {
|
|
|
150
150
|
*/
|
|
151
151
|
static fromGroupRole(role: PermissionRole, itemId: string, group: string, addingUser: string): Permission {
|
|
152
152
|
const init: IPermission = {
|
|
153
|
-
key:
|
|
153
|
+
key: nanoid(),
|
|
154
154
|
kind: Kind,
|
|
155
155
|
itemId,
|
|
156
156
|
granteeId: group,
|
|
@@ -175,7 +175,7 @@ export class Permission {
|
|
|
175
175
|
addingUser: string
|
|
176
176
|
): Permission {
|
|
177
177
|
const init: IPermission = {
|
|
178
|
-
key:
|
|
178
|
+
key: nanoid(),
|
|
179
179
|
kind: Kind,
|
|
180
180
|
itemId,
|
|
181
181
|
granteeId: organizationId,
|
|
@@ -192,7 +192,7 @@ export class Permission {
|
|
|
192
192
|
static fromValues(init: IBasePermission): Permission {
|
|
193
193
|
return new Permission({
|
|
194
194
|
...init,
|
|
195
|
-
key:
|
|
195
|
+
key: nanoid(),
|
|
196
196
|
kind: Kind,
|
|
197
197
|
})
|
|
198
198
|
}
|
|
@@ -206,7 +206,7 @@ export class Permission {
|
|
|
206
206
|
} else {
|
|
207
207
|
init = {
|
|
208
208
|
kind: Kind,
|
|
209
|
-
key:
|
|
209
|
+
key: nanoid(),
|
|
210
210
|
granteeId: '',
|
|
211
211
|
itemId: '',
|
|
212
212
|
role: 'reader',
|
|
@@ -221,7 +221,7 @@ export class Permission {
|
|
|
221
221
|
if (!Permission.isPermission(init)) {
|
|
222
222
|
throw new Error(`Not a permission.`)
|
|
223
223
|
}
|
|
224
|
-
const { key =
|
|
224
|
+
const { key = nanoid(), granteeId, role, type, displayName, expirationTime, addingUser, itemId } = init
|
|
225
225
|
this.kind = Kind
|
|
226
226
|
this.key = key
|
|
227
227
|
this.granteeId = granteeId
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
|
|
3
3
|
export const Kind = 'Core#UserIdentity'
|
|
4
4
|
|
|
@@ -57,7 +57,7 @@ export class UserIdentity implements IUserIdentity {
|
|
|
57
57
|
} else {
|
|
58
58
|
init = {
|
|
59
59
|
kind: Kind,
|
|
60
|
-
key:
|
|
60
|
+
key: nanoid(),
|
|
61
61
|
userId: '',
|
|
62
62
|
provider: 'google',
|
|
63
63
|
providerId: '',
|
|
@@ -71,7 +71,7 @@ export class UserIdentity implements IUserIdentity {
|
|
|
71
71
|
if (!UserIdentity.isUserIdentity(init)) {
|
|
72
72
|
throw new Error(`Not a UserIdentity.`)
|
|
73
73
|
}
|
|
74
|
-
const { key =
|
|
74
|
+
const { key = nanoid(), emailVerified, provider, providerId, userId, hostDomain } = init
|
|
75
75
|
this.kind = Kind
|
|
76
76
|
this.key = key
|
|
77
77
|
this.provider = provider
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { BaseTransformer, dataValue } from './BaseTransformer.js'
|
|
3
3
|
import { Creator, Browser, Page, Entry, Header } from './har.js'
|
|
4
4
|
import {
|
|
@@ -131,7 +131,7 @@ export class ArcDexieTransformer extends BaseTransformer {
|
|
|
131
131
|
updateData: item.requestIds,
|
|
132
132
|
legacyProject: {
|
|
133
133
|
kind: 'ARC#Project',
|
|
134
|
-
key:
|
|
134
|
+
key: nanoid(),
|
|
135
135
|
name: item.name,
|
|
136
136
|
order: item.order,
|
|
137
137
|
updated: item.updateTime,
|
|
@@ -205,7 +205,7 @@ export class ArcDexieTransformer extends BaseTransformer {
|
|
|
205
205
|
const updated = { ...item }
|
|
206
206
|
updated.updateTime = updated.updateTime || Date.now()
|
|
207
207
|
const obj: ExportArcHistoryRequest = {
|
|
208
|
-
key:
|
|
208
|
+
key: nanoid(),
|
|
209
209
|
method: updated.method,
|
|
210
210
|
url: updated.url,
|
|
211
211
|
updated: new Date(updated.updateTime).getTime(),
|
|
@@ -245,7 +245,7 @@ export class ArcDexieTransformer extends BaseTransformer {
|
|
|
245
245
|
url: item.url,
|
|
246
246
|
type: 'saved',
|
|
247
247
|
kind: 'ARC#HttpRequest',
|
|
248
|
-
key:
|
|
248
|
+
key: nanoid(),
|
|
249
249
|
}
|
|
250
250
|
// payload and headers
|
|
251
251
|
const harIndex = item.referenceEntry || 0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
3
|
import { BaseTransformer, dataValue } from './BaseTransformer.js'
|
|
4
4
|
import { ArcExportObject, ExportArcProjects, ExportArcSavedRequest } from '../legacy/DataExport.js'
|
|
5
5
|
|
|
@@ -113,7 +113,7 @@ export class ArcLegacyTransformer extends BaseTransformer {
|
|
|
113
113
|
}
|
|
114
114
|
return {
|
|
115
115
|
kind: 'ARC#ProjectData',
|
|
116
|
-
key:
|
|
116
|
+
key: nanoid(),
|
|
117
117
|
created,
|
|
118
118
|
name: item.name || 'unnamed',
|
|
119
119
|
order: 0,
|
|
@@ -153,7 +153,7 @@ export class ArcLegacyTransformer extends BaseTransformer {
|
|
|
153
153
|
|
|
154
154
|
const project = this.findProject(item.project, projects)
|
|
155
155
|
const projectId = project ? project.key : undefined
|
|
156
|
-
const id =
|
|
156
|
+
const id = nanoid()
|
|
157
157
|
let created = Number(item.time)
|
|
158
158
|
if (Number.isNaN(created)) {
|
|
159
159
|
created = Date.now()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { nanoid } from 'nanoid'
|
|
4
4
|
import { BaseTransformer, dataValue } from './BaseTransformer.js'
|
|
5
5
|
import {
|
|
6
6
|
ArcExportObject,
|
|
@@ -91,7 +91,7 @@ export class ArcPouchTransformer extends BaseTransformer {
|
|
|
91
91
|
return projects.map((item) => {
|
|
92
92
|
const project = { ...item }
|
|
93
93
|
if (!project.key) {
|
|
94
|
-
project.key =
|
|
94
|
+
project.key = nanoid()
|
|
95
95
|
}
|
|
96
96
|
return updateItemTimings(project)
|
|
97
97
|
})
|
|
@@ -4,7 +4,7 @@ import { HttpProject, IHttpProject, Kind as ProjectKind } from '../HttpProject.j
|
|
|
4
4
|
import { ProjectFolder } from '../ProjectFolder.js'
|
|
5
5
|
import { ProjectRequest } from '../ProjectRequest.js'
|
|
6
6
|
import { IMultipartBody } from '../../lib/transformers/PayloadSerializer.js'
|
|
7
|
-
import
|
|
7
|
+
import { nanoid } from 'nanoid'
|
|
8
8
|
import { Environment } from '../Environment.js'
|
|
9
9
|
import { Thing } from '../Thing.js'
|
|
10
10
|
|
|
@@ -137,7 +137,7 @@ export class PostmanV21Transformer extends PostmanTransformer {
|
|
|
137
137
|
definitions: {},
|
|
138
138
|
info: Thing.fromName(info.name || 'Unnamed Postman project').toJSON(),
|
|
139
139
|
items: [],
|
|
140
|
-
key: info._postman_id ||
|
|
140
|
+
key: info._postman_id || nanoid(),
|
|
141
141
|
}
|
|
142
142
|
if (info.description) {
|
|
143
143
|
init.info.description = info.description
|
|
@@ -4,7 +4,7 @@ import { HttpProject, IHttpProject, Kind as HttpProjectKind } from '../HttpProje
|
|
|
4
4
|
import { ProjectFolder } from '../ProjectFolder.js'
|
|
5
5
|
import { ProjectRequest } from '../ProjectRequest.js'
|
|
6
6
|
import { IMultipartBody } from '../../lib/transformers/PayloadSerializer.js'
|
|
7
|
-
import
|
|
7
|
+
import { nanoid } from 'nanoid'
|
|
8
8
|
import { Environment } from '../Environment.js'
|
|
9
9
|
import { Thing } from '../Thing.js'
|
|
10
10
|
|
|
@@ -137,7 +137,7 @@ export class PostmanV2Transformer extends PostmanTransformer {
|
|
|
137
137
|
definitions: {},
|
|
138
138
|
info: Thing.fromName(info.name || 'Unnamed Postman project').toJSON(),
|
|
139
139
|
items: [],
|
|
140
|
-
key: info._postman_id ||
|
|
140
|
+
key: info._postman_id || nanoid(),
|
|
141
141
|
}
|
|
142
142
|
if (info.description) {
|
|
143
143
|
init.info.description = info.description
|
package/src/patch/PatchClient.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Operation, JsonDocument } from '@api-client/json'
|
|
2
|
-
import
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
3
|
import type { MediaPatchInfo, PatchInfo } from './types.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -78,7 +78,7 @@ export class PatchClient<T extends object> extends JsonDocument<T> {
|
|
|
78
78
|
patch: operations,
|
|
79
79
|
app: this.app,
|
|
80
80
|
appVersion: this.appVersion,
|
|
81
|
-
id:
|
|
81
|
+
id: nanoid(),
|
|
82
82
|
}
|
|
83
83
|
if (this.version !== undefined) {
|
|
84
84
|
const casted = result as MediaPatchInfo
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
ContextListOptions,
|
|
19
19
|
} from '../../events/BaseEvents.js'
|
|
20
20
|
import { IAccessAddOperation, IAccessRemoveOperation, PermissionRole } from '../../models/store/Permission.js'
|
|
21
|
-
import
|
|
21
|
+
import { nanoid } from 'nanoid'
|
|
22
22
|
import { Folder, type IFolder } from '../../models/Folder.js'
|
|
23
23
|
import type { AccessPatchInfo, MediaPatchInfo, MediaPatchRevision, PatchInfo } from '../../patch/types.js'
|
|
24
24
|
|
|
@@ -549,7 +549,7 @@ export class FilesSdk extends SdkBase {
|
|
|
549
549
|
}
|
|
550
550
|
const patch: AccessPatchInfo = {
|
|
551
551
|
patch: [op],
|
|
552
|
-
id:
|
|
552
|
+
id: nanoid(),
|
|
553
553
|
}
|
|
554
554
|
return this.patchUsers(organization, key, patch, request)
|
|
555
555
|
}
|
|
@@ -569,7 +569,7 @@ export class FilesSdk extends SdkBase {
|
|
|
569
569
|
}
|
|
570
570
|
const patch: AccessPatchInfo = {
|
|
571
571
|
patch: [op],
|
|
572
|
-
id:
|
|
572
|
+
id: nanoid(),
|
|
573
573
|
}
|
|
574
574
|
return this.patchUsers(organization, key, patch, request)
|
|
575
575
|
}
|