@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
|
@@ -41731,10 +41731,10 @@
|
|
|
41731
41731
|
"@id": "#197"
|
|
41732
41732
|
},
|
|
41733
41733
|
{
|
|
41734
|
-
"@id": "#
|
|
41734
|
+
"@id": "#200"
|
|
41735
41735
|
},
|
|
41736
41736
|
{
|
|
41737
|
-
"@id": "#
|
|
41737
|
+
"@id": "#203"
|
|
41738
41738
|
},
|
|
41739
41739
|
{
|
|
41740
41740
|
"@id": "#206"
|
|
@@ -42470,16 +42470,16 @@
|
|
|
42470
42470
|
"@id": "#219"
|
|
42471
42471
|
},
|
|
42472
42472
|
{
|
|
42473
|
-
"@id": "#
|
|
42473
|
+
"@id": "#210"
|
|
42474
42474
|
},
|
|
42475
42475
|
{
|
|
42476
|
-
"@id": "#
|
|
42476
|
+
"@id": "#213"
|
|
42477
42477
|
},
|
|
42478
42478
|
{
|
|
42479
|
-
"@id": "#
|
|
42479
|
+
"@id": "#216"
|
|
42480
42480
|
},
|
|
42481
42481
|
{
|
|
42482
|
-
"@id": "#
|
|
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": "
|
|
43162
|
+
"doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
|
|
43163
43163
|
"core:mediaType": "application/yaml",
|
|
43164
43164
|
"sourcemaps:sources": [
|
|
43165
43165
|
{
|
|
@@ -43180,7 +43180,7 @@
|
|
|
43180
43180
|
"doc:ExternalDomainElement",
|
|
43181
43181
|
"doc:DomainElement"
|
|
43182
43182
|
],
|
|
43183
|
-
"doc:raw": "
|
|
43183
|
+
"doc:raw": "code: 'J'\ndescription: 'Information and communication'\n",
|
|
43184
43184
|
"core:mediaType": "application/yaml",
|
|
43185
43185
|
"sourcemaps:sources": [
|
|
43186
43186
|
{
|
|
@@ -43892,7 +43892,7 @@
|
|
|
43892
43892
|
"doc:ExternalDomainElement",
|
|
43893
43893
|
"doc:DomainElement"
|
|
43894
43894
|
],
|
|
43895
|
-
"doc:raw": "
|
|
43895
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '22'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)22 000000'\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:
|
|
43916
|
+
"doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\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": "type: 'GENERAL'\
|
|
43937
|
+
"doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@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:
|
|
43958
|
+
"doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
|
|
43959
43959
|
"core:mediaType": "application/yaml",
|
|
43960
43960
|
"sourcemaps:sources": [
|
|
43961
43961
|
{
|
|
@@ -44431,12 +44431,12 @@
|
|
|
44431
44431
|
{
|
|
44432
44432
|
"@id": "#202/source-map/lexical/element_0",
|
|
44433
44433
|
"sourcemaps:element": "amf://id#202",
|
|
44434
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44434
|
+
"sourcemaps:value": "[(1,0)-(5,0)]"
|
|
44435
44435
|
},
|
|
44436
44436
|
{
|
|
44437
44437
|
"@id": "#205/source-map/lexical/element_0",
|
|
44438
44438
|
"sourcemaps:element": "amf://id#205",
|
|
44439
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44439
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44440
44440
|
},
|
|
44441
44441
|
{
|
|
44442
44442
|
"@id": "#208/source-map/lexical/element_0",
|
|
@@ -44776,22 +44776,22 @@
|
|
|
44776
44776
|
{
|
|
44777
44777
|
"@id": "#212/source-map/lexical/element_0",
|
|
44778
44778
|
"sourcemaps:element": "amf://id#212",
|
|
44779
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44779
|
+
"sourcemaps:value": "[(1,0)-(6,0)]"
|
|
44780
44780
|
},
|
|
44781
44781
|
{
|
|
44782
44782
|
"@id": "#215/source-map/lexical/element_0",
|
|
44783
44783
|
"sourcemaps:element": "amf://id#215",
|
|
44784
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44784
|
+
"sourcemaps:value": "[(1,0)-(6,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)-(
|
|
44789
|
+
"sourcemaps:value": "[(1,0)-(7,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)-(
|
|
44794
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44795
44795
|
},
|
|
44796
44796
|
{
|
|
44797
44797
|
"@id": "#338/source-map/synthesized-field/element_1",
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
unionShape,
|
|
26
26
|
} from './definitions/Shapes.js'
|
|
27
27
|
import { AmfDataNode } from './models/AmfDataNode.js'
|
|
28
|
-
import
|
|
28
|
+
import { nanoid } from 'nanoid'
|
|
29
29
|
import { DataEntityKind, DataPropertyKind } from '../models/kinds.js'
|
|
30
30
|
import { DataValueGenerator } from './DataValueGenerator.js'
|
|
31
31
|
|
|
@@ -318,7 +318,7 @@ export class AmfShapeGenerator {
|
|
|
318
318
|
return examples.map((current) => {
|
|
319
319
|
const value = AmfDataNode.scalar(current, type).toJSON()
|
|
320
320
|
const item: IApiDataExample = {
|
|
321
|
-
id:
|
|
321
|
+
id: nanoid(),
|
|
322
322
|
customDomainProperties: [],
|
|
323
323
|
strict: true,
|
|
324
324
|
types: IAmfExampleTypes,
|
|
@@ -330,7 +330,7 @@ export class AmfShapeGenerator {
|
|
|
330
330
|
|
|
331
331
|
protected _generateArrayExamples(examples: string[], type: string): IApiDataExample[] {
|
|
332
332
|
const item: IApiDataExample = {
|
|
333
|
-
id:
|
|
333
|
+
id: nanoid(),
|
|
334
334
|
customDomainProperties: [],
|
|
335
335
|
strict: true,
|
|
336
336
|
types: IAmfExampleTypes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
1
2
|
import uuidV4 from '../lib/uuid.js'
|
|
2
|
-
import { randomString } from '../lib/math/Random.js'
|
|
3
3
|
import { DomainPropertyType } from '../modeling/DataFormat.js'
|
|
4
4
|
|
|
5
5
|
export const noValue = Symbol('noValue')
|
|
@@ -53,7 +53,8 @@ export class DataValueGenerator {
|
|
|
53
53
|
protected generateString(fn: string): string | typeof noValue {
|
|
54
54
|
switch (fn) {
|
|
55
55
|
case 'random':
|
|
56
|
-
|
|
56
|
+
// TODO: we need more settings controlling the random string generation.
|
|
57
|
+
return nanoid(8)
|
|
57
58
|
case 'uuid-v4':
|
|
58
59
|
return uuidV4()
|
|
59
60
|
default:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { IAmfArrayNodeTypes, IAmfObjectNodeTypes, IAmfScalarNodeTypes } from '../AmfTypes.js'
|
|
3
3
|
import { IApiCustomDomainProperty } from '../definitions/Base.js'
|
|
4
4
|
import { AmfNamespace } from '../definitions/Namespace.js'
|
|
@@ -16,7 +16,7 @@ export type IDataNodeInit = 'scalar' | 'object' | 'array'
|
|
|
16
16
|
* A class that manipulates the AMF's DataNode node.
|
|
17
17
|
*/
|
|
18
18
|
export class AmfDataNode {
|
|
19
|
-
id =
|
|
19
|
+
id = nanoid()
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* AMF domain types.
|
package/src/lib/uuid.ts
CHANGED
|
@@ -8,7 +8,7 @@ for (let i = 0; i < 256; i++) {
|
|
|
8
8
|
*
|
|
9
9
|
* @see http://stackoverflow.com/a/21963136/1127848
|
|
10
10
|
* @example "92329D39-6F5C-4520-ABFC-AAB64544E172"
|
|
11
|
-
* @return
|
|
11
|
+
* @return Generated value
|
|
12
12
|
*/
|
|
13
13
|
export default function v4(): string {
|
|
14
14
|
const d0 = (Math.random() * 0xffffffff) | 0
|
|
@@ -106,7 +106,7 @@ export class History {
|
|
|
106
106
|
} else if (Array.isArray(init.user)) {
|
|
107
107
|
result.user = this.random.pickOne(init.user)
|
|
108
108
|
} else {
|
|
109
|
-
result.user = this.types.
|
|
109
|
+
result.user = this.types.string(21)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
if (typeof init.project === 'string') {
|
|
@@ -114,7 +114,7 @@ export class History {
|
|
|
114
114
|
} else if (Array.isArray(init.project)) {
|
|
115
115
|
result.project = this.random.pickOne(init.project)
|
|
116
116
|
} else if (init.project) {
|
|
117
|
-
result.project = this.types.
|
|
117
|
+
result.project = this.types.string(21)
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
if (typeof init.request === 'string') {
|
|
@@ -122,7 +122,7 @@ export class History {
|
|
|
122
122
|
} else if (Array.isArray(init.request)) {
|
|
123
123
|
result.request = this.random.pickOne(init.request)
|
|
124
124
|
} else if (init.request) {
|
|
125
|
-
result.request = this.types.
|
|
125
|
+
result.request = this.types.string(21)
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
if (typeof init.app === 'string') {
|
|
@@ -130,7 +130,7 @@ export class History {
|
|
|
130
130
|
} else if (Array.isArray(init.app)) {
|
|
131
131
|
result.app = this.random.pickOne(init.app)
|
|
132
132
|
} else if (init.app) {
|
|
133
|
-
result.app = this.types.
|
|
133
|
+
result.app = this.types.string(21)
|
|
134
134
|
}
|
|
135
135
|
return result
|
|
136
136
|
}
|
|
@@ -141,7 +141,7 @@ export class History {
|
|
|
141
141
|
if (usersSize && typeof init.user === 'undefined') {
|
|
142
142
|
const users: string[] = []
|
|
143
143
|
for (let i = 0; i < usersSize; i++) {
|
|
144
|
-
users.push(this.types.
|
|
144
|
+
users.push(this.types.string(21))
|
|
145
145
|
}
|
|
146
146
|
copy.user = users
|
|
147
147
|
}
|
|
@@ -155,21 +155,21 @@ export class History {
|
|
|
155
155
|
if (projectsSize && typeof init.project === 'undefined') {
|
|
156
156
|
const project: string[] = []
|
|
157
157
|
for (let i = 0; i < projectsSize; i++) {
|
|
158
|
-
project.push(this.types.
|
|
158
|
+
project.push(this.types.string(21))
|
|
159
159
|
}
|
|
160
160
|
copy.project = project
|
|
161
161
|
}
|
|
162
162
|
if (requestsSize && typeof init.request === 'undefined') {
|
|
163
163
|
const requests: string[] = []
|
|
164
164
|
for (let i = 0; i < requestsSize; i++) {
|
|
165
|
-
requests.push(this.types.
|
|
165
|
+
requests.push(this.types.string(21))
|
|
166
166
|
}
|
|
167
167
|
copy.request = requests
|
|
168
168
|
}
|
|
169
169
|
if (appsSize && typeof init.app === 'undefined') {
|
|
170
170
|
const apps: string[] = []
|
|
171
171
|
for (let i = 0; i < appsSize; i++) {
|
|
172
|
-
apps.push(this.types.
|
|
172
|
+
apps.push(this.types.string(21))
|
|
173
173
|
}
|
|
174
174
|
copy.app = apps
|
|
175
175
|
}
|
package/src/mocking/lib/User.ts
CHANGED
|
@@ -23,7 +23,7 @@ export class User {
|
|
|
23
23
|
user(init: IUserInit = {}): IUser {
|
|
24
24
|
const result: IUser = {
|
|
25
25
|
kind: UserKind,
|
|
26
|
-
key: this.types.
|
|
26
|
+
key: this.types.string(21),
|
|
27
27
|
name: this.person.name(),
|
|
28
28
|
}
|
|
29
29
|
if (!init.noEmail) {
|
|
@@ -41,7 +41,7 @@ export class User {
|
|
|
41
41
|
}
|
|
42
42
|
if (!init.noProvider) {
|
|
43
43
|
result.provider = {
|
|
44
|
-
refreshToken: this.types.
|
|
44
|
+
refreshToken: this.types.string(21),
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return result
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { Graph } from '@api-client/graph'
|
|
3
3
|
import {
|
|
4
4
|
DomainAssociationKind,
|
|
@@ -165,8 +165,7 @@ export class DataDomain extends EventTarget {
|
|
|
165
165
|
accessor fields: NamespaceOrderedItem[]
|
|
166
166
|
|
|
167
167
|
static createSchema(input: Partial<DataDomainSchema> = {}): DataDomainSchema {
|
|
168
|
-
|
|
169
|
-
const { key = v4(), fields } = input
|
|
168
|
+
const { key = nanoid(), fields } = input
|
|
170
169
|
const info = Thing.fromJSON(input.info, { name: 'Unnamed domain' }).toJSON()
|
|
171
170
|
const result: DataDomainSchema = {
|
|
172
171
|
kind: DataDomainKind,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { File, type IFile } from '../models/store/File.js'
|
|
3
3
|
import { Thing } from '../models/Thing.js'
|
|
4
4
|
import type { DataDomain, DataDomainSchema } from './DataDomain.js'
|
|
@@ -55,7 +55,7 @@ export class DomainFile extends File {
|
|
|
55
55
|
} else {
|
|
56
56
|
init = {
|
|
57
57
|
kind: DomainFileKind,
|
|
58
|
-
key:
|
|
58
|
+
key: nanoid(),
|
|
59
59
|
organization: '',
|
|
60
60
|
info: Thing.fromName('').toJSON(),
|
|
61
61
|
parents: [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Json } from '@api-client/json'
|
|
2
2
|
import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'
|
|
3
3
|
import { IApiAssociationShape, IApiPropertyShape } from '../../amf/definitions/Shapes.js'
|
|
4
|
-
import
|
|
4
|
+
import { nanoid } from 'nanoid'
|
|
5
5
|
import { IThing, Thing } from '../../models/Thing.js'
|
|
6
6
|
import { DataEntity, IDataEntity } from './DataEntity.js'
|
|
7
7
|
import { DataNamespace } from './DataNamespace.js'
|
|
@@ -230,7 +230,7 @@ export class DataAssociation {
|
|
|
230
230
|
} else {
|
|
231
231
|
init = {
|
|
232
232
|
kind: DataAssociationKind,
|
|
233
|
-
key:
|
|
233
|
+
key: nanoid(),
|
|
234
234
|
info: Thing.fromName('Unnamed association').toJSON(),
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -244,7 +244,7 @@ export class DataAssociation {
|
|
|
244
244
|
*/
|
|
245
245
|
new(init: IDataAssociation): this {
|
|
246
246
|
DataAssociation.validate(init)
|
|
247
|
-
const { info, key =
|
|
247
|
+
const { info, key = nanoid(), kind = DataAssociationKind, schema, multiple, required, targets, bindings } = init
|
|
248
248
|
this.kind = kind
|
|
249
249
|
this.key = key
|
|
250
250
|
if (info) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IThing, Thing } from '../../models/Thing.js'
|
|
2
|
-
import
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
3
|
import { DataNamespace } from './DataNamespace.js'
|
|
4
4
|
import { DataProperty } from './DataProperty.js'
|
|
5
5
|
import { type DataPropertyType } from '../DataFormat.js'
|
|
@@ -185,7 +185,7 @@ export class DataEntity {
|
|
|
185
185
|
} else {
|
|
186
186
|
init = {
|
|
187
187
|
kind: DataEntityKind,
|
|
188
|
-
key:
|
|
188
|
+
key: nanoid(),
|
|
189
189
|
info: Thing.fromName('').toJSON(),
|
|
190
190
|
}
|
|
191
191
|
}
|
|
@@ -196,7 +196,7 @@ export class DataEntity {
|
|
|
196
196
|
DataEntity.validate(init)
|
|
197
197
|
const {
|
|
198
198
|
info,
|
|
199
|
-
key =
|
|
199
|
+
key = nanoid(),
|
|
200
200
|
kind = DataEntityKind,
|
|
201
201
|
tags,
|
|
202
202
|
taxonomy,
|
|
@@ -2,7 +2,7 @@ import { DataEntity } from './DataEntity.js'
|
|
|
2
2
|
import { DataNamespace } from './DataNamespace.js'
|
|
3
3
|
import { type DataPropertyType } from '../DataFormat.js'
|
|
4
4
|
import { type IThing, Thing } from '../../models/Thing.js'
|
|
5
|
-
import
|
|
5
|
+
import { nanoid } from 'nanoid'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A fluent builder for constructing `DataEntity` instances.
|
|
@@ -228,7 +228,7 @@ export class DataEntityBuilder {
|
|
|
228
228
|
*/
|
|
229
229
|
build(): DataEntity {
|
|
230
230
|
if (!this.entity.key) {
|
|
231
|
-
this.entity.key =
|
|
231
|
+
this.entity.key = nanoid()
|
|
232
232
|
}
|
|
233
233
|
this.root.definitions.entities.push(this.entity)
|
|
234
234
|
return this.entity
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IThing, Thing } from '../../models/Thing.js'
|
|
2
|
-
import
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
3
|
import { DataEntity, IDataEntity } from './DataEntity.js'
|
|
4
4
|
import type { DataItemAdaptingOptions, DataNamespace } from './DataNamespace.js'
|
|
5
5
|
import { FileBreadcrumb } from '../../models/store/File.js'
|
|
@@ -73,7 +73,7 @@ export class DataModel {
|
|
|
73
73
|
} else {
|
|
74
74
|
init = {
|
|
75
75
|
kind: DataModelKind,
|
|
76
|
-
key:
|
|
76
|
+
key: nanoid(),
|
|
77
77
|
info: Thing.fromName('').toJSON(),
|
|
78
78
|
entities: [],
|
|
79
79
|
}
|
|
@@ -85,7 +85,7 @@ export class DataModel {
|
|
|
85
85
|
if (!DataModel.isDataModel(init)) {
|
|
86
86
|
throw new Error(`Not a data model.`)
|
|
87
87
|
}
|
|
88
|
-
const { info, key =
|
|
88
|
+
const { info, key = nanoid(), kind = DataModelKind, entities } = init
|
|
89
89
|
this.kind = kind
|
|
90
90
|
this.key = key
|
|
91
91
|
if (info) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
DataPropertyKind,
|
|
12
12
|
DataAssociationKind,
|
|
13
13
|
} from '../../models/kinds.js'
|
|
14
|
-
import
|
|
14
|
+
import { nanoid } from 'nanoid'
|
|
15
15
|
import type { DataDomainRemoveOptions } from '../types.js'
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -288,7 +288,7 @@ export class DataNamespace {
|
|
|
288
288
|
} else {
|
|
289
289
|
init = {
|
|
290
290
|
kind: DataNamespaceKind,
|
|
291
|
-
key:
|
|
291
|
+
key: nanoid(),
|
|
292
292
|
definitions: {},
|
|
293
293
|
items: [],
|
|
294
294
|
info: Thing.fromName('').toJSON(),
|
|
@@ -301,7 +301,7 @@ export class DataNamespace {
|
|
|
301
301
|
if (!init || !init.definitions || !init.items) {
|
|
302
302
|
throw new Error(`Not a data namespace.`)
|
|
303
303
|
}
|
|
304
|
-
const { key =
|
|
304
|
+
const { key = nanoid(), definitions = {}, items, info } = init
|
|
305
305
|
this.key = key
|
|
306
306
|
if (info) {
|
|
307
307
|
this.info = new Thing(info)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Json } from '@api-client/json'
|
|
2
2
|
import { IThing, Thing } from '../../models/Thing.js'
|
|
3
|
-
import
|
|
3
|
+
import { nanoid } from 'nanoid'
|
|
4
4
|
import { DataNamespace } from './DataNamespace.js'
|
|
5
5
|
import { IApiPropertyShape } from '../../amf/definitions/Shapes.js'
|
|
6
6
|
import { AmfShapeGenerator } from '../../amf/AmfShapeGenerator.js'
|
|
@@ -304,7 +304,7 @@ export class DataProperty {
|
|
|
304
304
|
} else {
|
|
305
305
|
init = {
|
|
306
306
|
kind: DataPropertyKind,
|
|
307
|
-
key:
|
|
307
|
+
key: nanoid(),
|
|
308
308
|
info: Thing.fromName('').toJSON(),
|
|
309
309
|
type: 'string',
|
|
310
310
|
}
|
|
@@ -318,7 +318,7 @@ export class DataProperty {
|
|
|
318
318
|
}
|
|
319
319
|
const {
|
|
320
320
|
info,
|
|
321
|
-
key =
|
|
321
|
+
key = nanoid(),
|
|
322
322
|
kind = DataPropertyKind,
|
|
323
323
|
multiple,
|
|
324
324
|
required,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
|
|
3
3
|
export interface IAuthorizationData {
|
|
4
4
|
key: string
|
|
@@ -30,7 +30,7 @@ export class AuthorizationData {
|
|
|
30
30
|
init = input
|
|
31
31
|
} else {
|
|
32
32
|
init = {
|
|
33
|
-
key:
|
|
33
|
+
key: nanoid(),
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
this.new(init)
|
|
@@ -42,7 +42,7 @@ export class AuthorizationData {
|
|
|
42
42
|
* Note, this throws an error when the provider is not an API Client provider object.
|
|
43
43
|
*/
|
|
44
44
|
new(init: IAuthorizationData): void {
|
|
45
|
-
const { username, password, domain, key =
|
|
45
|
+
const { username, password, domain, key = nanoid() } = init
|
|
46
46
|
this.username = username
|
|
47
47
|
this.password = password
|
|
48
48
|
this.domain = domain
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { nanoid } from 'nanoid'
|
|
2
2
|
import { Certificate, ICertificate } from './ClientCertificate.js'
|
|
3
3
|
import { CertificateFileKind } from './kinds.js'
|
|
4
4
|
import { IFile, File } from './store/File.js'
|
|
@@ -48,7 +48,7 @@ export class CertificateFile extends File {
|
|
|
48
48
|
} else {
|
|
49
49
|
init = {
|
|
50
50
|
kind: CertificateFileKind,
|
|
51
|
-
key:
|
|
51
|
+
key: nanoid(),
|
|
52
52
|
organization: '',
|
|
53
53
|
info: Thing.fromName('').toJSON(),
|
|
54
54
|
parents: [],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { base64ToBuffer, bufferToBase64 } from '../lib/Buffer.js'
|
|
2
|
-
import
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
3
|
import {
|
|
4
4
|
Certificate as LegacyCertificate,
|
|
5
5
|
ARCCertificateIndex,
|
|
@@ -177,7 +177,7 @@ export class Certificate {
|
|
|
177
177
|
certKey: {
|
|
178
178
|
data: key,
|
|
179
179
|
},
|
|
180
|
-
key:
|
|
180
|
+
key: nanoid(),
|
|
181
181
|
name,
|
|
182
182
|
type: 'pem',
|
|
183
183
|
created: Date.now(),
|
|
@@ -201,7 +201,7 @@ export class Certificate {
|
|
|
201
201
|
cert: {
|
|
202
202
|
data: cert,
|
|
203
203
|
},
|
|
204
|
-
key:
|
|
204
|
+
key: nanoid(),
|
|
205
205
|
name,
|
|
206
206
|
type: 'p12',
|
|
207
207
|
created: Date.now(),
|
|
@@ -220,7 +220,7 @@ export class Certificate {
|
|
|
220
220
|
* to its original format.
|
|
221
221
|
*/
|
|
222
222
|
static fromLegacy(index: ARCCertificateIndex, cert: RequestCertificate): Certificate {
|
|
223
|
-
const { name = '', type, created = Date.now(), _id =
|
|
223
|
+
const { name = '', type, created = Date.now(), _id = nanoid() } = index
|
|
224
224
|
if (type === 'pem') {
|
|
225
225
|
const data = Array.isArray(cert.cert) ? cert.cert[0] : cert.cert
|
|
226
226
|
const key = Array.isArray(cert.key) ? cert.key[0] : (cert.key as LegacyCertificate)
|
|
@@ -253,7 +253,7 @@ export class Certificate {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
constructor(certificate: HttpCertificate) {
|
|
256
|
-
const { type, cert, key =
|
|
256
|
+
const { type, cert, key = nanoid(), name = '', created = Date.now() } = certificate
|
|
257
257
|
this.key = key
|
|
258
258
|
this.name = name
|
|
259
259
|
this.type = type
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Property, IProperty } from './Property.js'
|
|
2
2
|
import { Server, IServer } from './Server.js'
|
|
3
3
|
import { IThing, Thing } from './Thing.js'
|
|
4
|
-
import
|
|
4
|
+
import { nanoid } from 'nanoid'
|
|
5
5
|
import { ARCVariable } from './legacy/models/Variable.js'
|
|
6
6
|
import { IRequestAuthorization, RequestAuthorization } from './RequestAuthorization.js'
|
|
7
7
|
|
|
@@ -91,7 +91,7 @@ export class Environment {
|
|
|
91
91
|
* @param name The name to set.
|
|
92
92
|
*/
|
|
93
93
|
static fromName(name: string): Environment {
|
|
94
|
-
const key =
|
|
94
|
+
const key = nanoid()
|
|
95
95
|
const info = Thing.fromName(name)
|
|
96
96
|
const definition = new Environment({
|
|
97
97
|
key,
|
|
@@ -103,7 +103,7 @@ export class Environment {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
static fromLegacyVariables(name: string, variables: ARCVariable[]): Environment {
|
|
106
|
-
const key =
|
|
106
|
+
const key = nanoid()
|
|
107
107
|
const info = Thing.fromName(name)
|
|
108
108
|
const definition = new Environment({
|
|
109
109
|
key,
|
|
@@ -132,7 +132,7 @@ export class Environment {
|
|
|
132
132
|
} else {
|
|
133
133
|
init = {
|
|
134
134
|
kind: Kind,
|
|
135
|
-
key:
|
|
135
|
+
key: nanoid(),
|
|
136
136
|
info: Thing.fromName('').toJSON(),
|
|
137
137
|
variables: [],
|
|
138
138
|
}
|
|
@@ -149,7 +149,7 @@ export class Environment {
|
|
|
149
149
|
if (!Environment.isEnvironment(init)) {
|
|
150
150
|
throw new Error(`Not an environment.`)
|
|
151
151
|
}
|
|
152
|
-
const { key =
|
|
152
|
+
const { key = nanoid(), variables, info, server, encapsulated = false, authorization } = init
|
|
153
153
|
this.kind = Kind
|
|
154
154
|
this.key = key
|
|
155
155
|
this.encapsulated = encapsulated
|
|
@@ -262,7 +262,7 @@ export class Environment {
|
|
|
262
262
|
clone(opts: IEnvironmentCloneOptions = {}): Environment {
|
|
263
263
|
const copy = new Environment(this.toJSON())
|
|
264
264
|
if (!opts.withoutRevalidate) {
|
|
265
|
-
copy.key =
|
|
265
|
+
copy.key = nanoid()
|
|
266
266
|
}
|
|
267
267
|
return copy
|
|
268
268
|
}
|
package/src/models/Folder.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IFile, File } from './store/File.js'
|
|
2
|
-
import
|
|
2
|
+
import { nanoid } from 'nanoid'
|
|
3
3
|
import { Thing } from './Thing.js'
|
|
4
4
|
import { FolderKind } from './kinds.js'
|
|
5
5
|
|
|
@@ -39,7 +39,7 @@ export class Folder extends File {
|
|
|
39
39
|
} else {
|
|
40
40
|
init = {
|
|
41
41
|
kind: FolderKind,
|
|
42
|
-
key:
|
|
42
|
+
key: nanoid(),
|
|
43
43
|
organization: '',
|
|
44
44
|
info: Thing.fromName('').toJSON(),
|
|
45
45
|
parents: [],
|