codify-schemas 1.0.71 → 1.0.72
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/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/messages/match-request-data-schema.json +36 -0
- package/dist/messages/match-response-data-schema.json +21 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/messages/match-request-data-schema.json +36 -0
- package/src/messages/match-request-data-schema.test.ts +86 -0
- package/src/messages/match-response-data-schema.json +21 -0
- package/src/messages/match-response-data-schema.test.ts +46 -0
- package/src/types/index.ts +18 -0
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import GetResourceInfoRequestDataSchema from './messages/get-resource-info-reque
|
|
|
10
10
|
import GetResourceInfoResponseDataSchema from './messages/get-resource-info-response-data-schema.json';
|
|
11
11
|
import ImportRequestDataSchema from './messages/import-request-data-schema.json';
|
|
12
12
|
import ImportResponseDataSchema from './messages/import-response-data-schema.json';
|
|
13
|
+
import MatchRequestDataSchema from './messages/match-request-data-schema.json';
|
|
14
|
+
import MatchResponseDataSchema from './messages/match-response-data-schema.json';
|
|
13
15
|
import PlanRequestDataSchema from './messages/plan-request-data-schema.json';
|
|
14
16
|
import PlanResponseDataSchema from './messages/plan-response-data-schema.json';
|
|
15
17
|
import ValidateRequestDataSchema from './messages/validate-request-data-schema.json';
|
|
@@ -18,6 +20,6 @@ import InitializeRequestDataSchema from './messages/initialize-request-data-sche
|
|
|
18
20
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json';
|
|
19
21
|
import SudoRequestDataSchema from './messages/sudo-request-data-schema.json';
|
|
20
22
|
import SudoRequestResponseDataSchema from './messages/sudo-response-data-schema.json';
|
|
21
|
-
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, SudoRequestDataSchema, SudoRequestResponseDataSchema, };
|
|
23
|
+
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, MatchRequestDataSchema, MatchResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, SudoRequestDataSchema, SudoRequestResponseDataSchema, };
|
|
22
24
|
export * from './types/index.js';
|
|
23
25
|
export * from './messages/commands.js';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@ import GetResourceInfoRequestDataSchema from './messages/get-resource-info-reque
|
|
|
10
10
|
import GetResourceInfoResponseDataSchema from './messages/get-resource-info-response-data-schema.json' with { type: 'json' };
|
|
11
11
|
import ImportRequestDataSchema from './messages/import-request-data-schema.json' with { type: 'json' };
|
|
12
12
|
import ImportResponseDataSchema from './messages/import-response-data-schema.json' with { type: 'json' };
|
|
13
|
+
import MatchRequestDataSchema from './messages/match-request-data-schema.json' with { type: 'json' };
|
|
14
|
+
import MatchResponseDataSchema from './messages/match-response-data-schema.json' with { type: 'json' };
|
|
13
15
|
import PlanRequestDataSchema from './messages/plan-request-data-schema.json' with { type: 'json' };
|
|
14
16
|
import PlanResponseDataSchema from './messages/plan-response-data-schema.json' with { type: 'json' };
|
|
15
17
|
import ValidateRequestDataSchema from './messages/validate-request-data-schema.json' with { type: 'json' };
|
|
@@ -18,7 +20,7 @@ import InitializeRequestDataSchema from './messages/initialize-request-data-sche
|
|
|
18
20
|
import InitializeResponseDataSchema from './messages/initialize-response-data-schema.json' with { type: 'json' };
|
|
19
21
|
import SudoRequestDataSchema from './messages/sudo-request-data-schema.json' with { type: 'json' };
|
|
20
22
|
import SudoRequestResponseDataSchema from './messages/sudo-response-data-schema.json' with { type: 'json' };
|
|
21
|
-
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, SudoRequestDataSchema, SudoRequestResponseDataSchema, };
|
|
23
|
+
export { ConfigFileSchema, ProjectSchema, ResourceSchema, IpcMessageSchema, IpcMessageV2Schema, ApplyRequestDataSchema, ApplyResponseDataSchema, ErrorResponseDataSchema, GetResourceInfoRequestDataSchema, GetResourceInfoResponseDataSchema, ImportRequestDataSchema, ImportResponseDataSchema, MatchRequestDataSchema, MatchResponseDataSchema, PlanRequestDataSchema, PlanResponseDataSchema, ValidateRequestDataSchema, ValidateResponseDataSchema, InitializeRequestDataSchema, InitializeResponseDataSchema, SudoRequestDataSchema, SudoRequestResponseDataSchema, };
|
|
22
24
|
export * from './types/index.js';
|
|
23
25
|
export * from './messages/commands.js';
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,2BAA2B,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AAC5E,OAAO,aAAa,MAAM,uBAAuB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAA;AACrE,OAAO,cAAc,MAAM,w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AuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,6BAA6B,GAC9B,CAAA;AAED,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/match-request-data-schema.json",
|
|
4
|
+
"title": "Match resources request data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"resource": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"core": {
|
|
11
|
+
"$ref": "resource-schema.json"
|
|
12
|
+
},
|
|
13
|
+
"parameters": {
|
|
14
|
+
"type": "object"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["core", "parameters"]
|
|
18
|
+
},
|
|
19
|
+
"array": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"core": {
|
|
25
|
+
"$ref": "resource-schema.json"
|
|
26
|
+
},
|
|
27
|
+
"parameters": {
|
|
28
|
+
"type": "object"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["core", "parameters"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": ["resource", "array"]
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/match-response-data-schema.json",
|
|
4
|
+
"title": "Match resources response data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"match": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"core": {
|
|
11
|
+
"$ref": "resource-schema.json"
|
|
12
|
+
},
|
|
13
|
+
"parameters": {
|
|
14
|
+
"type": "object"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["core", "parameters"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["match"]
|
|
21
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -102,6 +102,22 @@ export interface GetResourceInfoResponseData {
|
|
|
102
102
|
};
|
|
103
103
|
allowMultiple: boolean;
|
|
104
104
|
}
|
|
105
|
+
export interface MatchRequestData {
|
|
106
|
+
resource: {
|
|
107
|
+
core: ResourceConfig;
|
|
108
|
+
parameters: Record<string, unknown>;
|
|
109
|
+
};
|
|
110
|
+
array: Array<{
|
|
111
|
+
core: ResourceConfig;
|
|
112
|
+
parameters: Record<string, unknown>;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
export interface MatchResponseData {
|
|
116
|
+
match: {
|
|
117
|
+
core: ResourceConfig;
|
|
118
|
+
parameters: Record<string, unknown>;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
105
121
|
export interface ImportRequestData {
|
|
106
122
|
core: ResourceConfig;
|
|
107
123
|
parameters: Record<string, unknown>;
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AA6CD,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACf,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,QAM5B;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AA6CD,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACf,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,QAM5B;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,mCAAa,CAAA;AACf,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAoGD,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,6 +10,8 @@ import GetResourceInfoRequestDataSchema from './messages/get-resource-info-reque
|
|
|
10
10
|
import GetResourceInfoResponseDataSchema from './messages/get-resource-info-response-data-schema.json' with {type: 'json'}
|
|
11
11
|
import ImportRequestDataSchema from './messages/import-request-data-schema.json' with {type: 'json'}
|
|
12
12
|
import ImportResponseDataSchema from './messages/import-response-data-schema.json' with {type: 'json'}
|
|
13
|
+
import MatchRequestDataSchema from './messages/match-request-data-schema.json' with {type: 'json'}
|
|
14
|
+
import MatchResponseDataSchema from './messages/match-response-data-schema.json' with {type: 'json'}
|
|
13
15
|
import PlanRequestDataSchema from './messages/plan-request-data-schema.json' with {type: 'json'}
|
|
14
16
|
import PlanResponseDataSchema from './messages/plan-response-data-schema.json' with {type: 'json'}
|
|
15
17
|
import ValidateRequestDataSchema from './messages/validate-request-data-schema.json' with {type: 'json'}
|
|
@@ -32,6 +34,8 @@ export {
|
|
|
32
34
|
GetResourceInfoResponseDataSchema,
|
|
33
35
|
ImportRequestDataSchema,
|
|
34
36
|
ImportResponseDataSchema,
|
|
37
|
+
MatchRequestDataSchema,
|
|
38
|
+
MatchResponseDataSchema,
|
|
35
39
|
PlanRequestDataSchema,
|
|
36
40
|
PlanResponseDataSchema,
|
|
37
41
|
ValidateRequestDataSchema,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/match-request-data-schema.json",
|
|
4
|
+
"title": "Match resources request data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"resource": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"core": {
|
|
11
|
+
"$ref": "resource-schema.json"
|
|
12
|
+
},
|
|
13
|
+
"parameters": {
|
|
14
|
+
"type": "object"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["core", "parameters"]
|
|
18
|
+
},
|
|
19
|
+
"array": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"core": {
|
|
25
|
+
"$ref": "resource-schema.json"
|
|
26
|
+
},
|
|
27
|
+
"parameters": {
|
|
28
|
+
"type": "object"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["core", "parameters"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": ["resource", "array"]
|
|
36
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import schema from './match-request-data-schema.json';
|
|
2
|
+
import resourceSchema from '../resource-schema.json'
|
|
3
|
+
import { describe, it, expect } from 'vitest'
|
|
4
|
+
import Ajv from 'ajv'
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv({
|
|
7
|
+
strict: true,
|
|
8
|
+
strictRequired: false,
|
|
9
|
+
})
|
|
10
|
+
ajv.addSchema(resourceSchema);
|
|
11
|
+
|
|
12
|
+
describe('Matches request data schema', () => {
|
|
13
|
+
it('compiles', () => {
|
|
14
|
+
ajv.compile(schema);
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("Validates a correct request", () => {
|
|
18
|
+
const validate = ajv.compile(schema);
|
|
19
|
+
expect(validate({
|
|
20
|
+
resource: {
|
|
21
|
+
core: {
|
|
22
|
+
type: "type"
|
|
23
|
+
},
|
|
24
|
+
parameters: {
|
|
25
|
+
param1: 'a',
|
|
26
|
+
param2: 2
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
array: [
|
|
30
|
+
{
|
|
31
|
+
core: {
|
|
32
|
+
type: "type"
|
|
33
|
+
},
|
|
34
|
+
parameters: {
|
|
35
|
+
param1: 'a',
|
|
36
|
+
param2: 2
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
core: {
|
|
41
|
+
type: "type2"
|
|
42
|
+
},
|
|
43
|
+
parameters: {
|
|
44
|
+
param1: 'a',
|
|
45
|
+
param2: 2
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
})).to.be.true;
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it("Rejects an invalid request", () => {
|
|
53
|
+
const validate = ajv.compile(schema);
|
|
54
|
+
expect(validate({
|
|
55
|
+
resource: {
|
|
56
|
+
core: {
|
|
57
|
+
type: "type"
|
|
58
|
+
},
|
|
59
|
+
parameters: {
|
|
60
|
+
param1: 'a',
|
|
61
|
+
param2: 2
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
array: [
|
|
65
|
+
{
|
|
66
|
+
core: {
|
|
67
|
+
type: "type"
|
|
68
|
+
},
|
|
69
|
+
parameters: {
|
|
70
|
+
param1: 'a',
|
|
71
|
+
param2: 2
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
core: {
|
|
76
|
+
},
|
|
77
|
+
parameters: {
|
|
78
|
+
param1: 'a',
|
|
79
|
+
param2: 2
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
})).to.be.false;
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://www.codifycli.com/match-response-data-schema.json",
|
|
4
|
+
"title": "Match resources response data",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"match": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"core": {
|
|
11
|
+
"$ref": "resource-schema.json"
|
|
12
|
+
},
|
|
13
|
+
"parameters": {
|
|
14
|
+
"type": "object"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["core", "parameters"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["match"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import schema from './match-response-data-schema.json';
|
|
2
|
+
import resourceSchema from '../resource-schema.json'
|
|
3
|
+
import { describe, it, expect } from 'vitest'
|
|
4
|
+
import Ajv from 'ajv'
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv({
|
|
7
|
+
strict: true,
|
|
8
|
+
strictRequired: false,
|
|
9
|
+
})
|
|
10
|
+
ajv.addSchema(resourceSchema);
|
|
11
|
+
|
|
12
|
+
describe('Match response data schema', () => {
|
|
13
|
+
it('compiles', () => {
|
|
14
|
+
ajv.compile(schema);
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("Validates a correct response", () => {
|
|
18
|
+
const validate = ajv.compile(schema);
|
|
19
|
+
expect(validate({
|
|
20
|
+
match: {
|
|
21
|
+
core: {
|
|
22
|
+
type: "type"
|
|
23
|
+
},
|
|
24
|
+
parameters: {
|
|
25
|
+
param1: 'a',
|
|
26
|
+
param2: 2
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
})).to.be.true;
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it("Rejects an invalid response", () => {
|
|
33
|
+
const validate = ajv.compile(schema);
|
|
34
|
+
expect(validate({
|
|
35
|
+
match: {
|
|
36
|
+
core: {
|
|
37
|
+
},
|
|
38
|
+
parameters: {
|
|
39
|
+
param1: 'a',
|
|
40
|
+
param2: 2
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})).to.be.false;
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
})
|
package/src/types/index.ts
CHANGED
|
@@ -119,6 +119,24 @@ export interface GetResourceInfoResponseData {
|
|
|
119
119
|
allowMultiple: boolean;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
export interface MatchRequestData {
|
|
123
|
+
resource: {
|
|
124
|
+
core: ResourceConfig;
|
|
125
|
+
parameters: Record<string, unknown>;
|
|
126
|
+
};
|
|
127
|
+
array: Array<{
|
|
128
|
+
core: ResourceConfig;
|
|
129
|
+
parameters: Record<string, unknown>;
|
|
130
|
+
}>
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface MatchResponseData {
|
|
134
|
+
match: {
|
|
135
|
+
core: ResourceConfig;
|
|
136
|
+
parameters: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
122
140
|
export interface ImportRequestData {
|
|
123
141
|
core: ResourceConfig;
|
|
124
142
|
parameters: Record<string, unknown>;
|