@pagopa/interop-outbound-models 1.8.7 → 1.8.8
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/CHANGELOG.md +6 -0
- package/dist/gen/v2/eservice-template/eservice-template.d.ts +71 -3
- package/dist/gen/v2/eservice-template/eservice-template.d.ts.map +1 -1
- package/dist/gen/v2/eservice-template/eservice-template.js +170 -6
- package/package.json +1 -1
- package/proto/v2/eservice-template/eservice-template.proto +16 -1
- package/tests/eservice.test.ts +11 -1
- package/tests/template.test.ts +68 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 1.8.8
|
|
6
|
+
|
|
7
|
+
### Separated EServiceTemplate attributes from EService attributes
|
|
8
|
+
- Created dedicated attribute types for EServiceTemplate: `EServiceTemplateAttributeValueV2`, `EServiceTemplateAttributeV2`, `EServiceTemplateAttributesV2`
|
|
9
|
+
- Added test coverage for EServiceTemplate event encoding/decoding
|
|
10
|
+
|
|
5
11
|
## 1.8.7
|
|
6
12
|
|
|
7
13
|
### EServiceDescriptorAttributeV2 Refactor
|
|
@@ -6,9 +6,47 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
|
6
6
|
import { MessageType } from "@protobuf-ts/runtime";
|
|
7
7
|
import { EServiceModeV2 } from "../eservice/eservice.js";
|
|
8
8
|
import { EServiceTechnologyV2 } from "../eservice/eservice.js";
|
|
9
|
-
import { EServiceAttributesV2 } from "../eservice/eservice.js";
|
|
10
9
|
import { AgreementApprovalPolicyV2 } from "../eservice/eservice.js";
|
|
11
10
|
import { EServiceDocumentV2 } from "../eservice/eservice.js";
|
|
11
|
+
/**
|
|
12
|
+
* @generated from protobuf message eservice.template.v2.EServiceTemplateAttributeValueV2
|
|
13
|
+
*/
|
|
14
|
+
export interface EServiceTemplateAttributeValueV2 {
|
|
15
|
+
/**
|
|
16
|
+
* @generated from protobuf field: string id = 1;
|
|
17
|
+
*/
|
|
18
|
+
id: string;
|
|
19
|
+
/**
|
|
20
|
+
* @generated from protobuf field: bool explicitAttributeVerification = 2;
|
|
21
|
+
*/
|
|
22
|
+
explicitAttributeVerification: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @generated from protobuf message eservice.template.v2.EServiceTemplateAttributeV2
|
|
26
|
+
*/
|
|
27
|
+
export interface EServiceTemplateAttributeV2 {
|
|
28
|
+
/**
|
|
29
|
+
* @generated from protobuf field: repeated eservice.template.v2.EServiceTemplateAttributeValueV2 values = 1;
|
|
30
|
+
*/
|
|
31
|
+
values: EServiceTemplateAttributeValueV2[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @generated from protobuf message eservice.template.v2.EServiceTemplateAttributesV2
|
|
35
|
+
*/
|
|
36
|
+
export interface EServiceTemplateAttributesV2 {
|
|
37
|
+
/**
|
|
38
|
+
* @generated from protobuf field: repeated eservice.template.v2.EServiceTemplateAttributeV2 certified = 1;
|
|
39
|
+
*/
|
|
40
|
+
certified: EServiceTemplateAttributeV2[];
|
|
41
|
+
/**
|
|
42
|
+
* @generated from protobuf field: repeated eservice.template.v2.EServiceTemplateAttributeV2 declared = 2;
|
|
43
|
+
*/
|
|
44
|
+
declared: EServiceTemplateAttributeV2[];
|
|
45
|
+
/**
|
|
46
|
+
* @generated from protobuf field: repeated eservice.template.v2.EServiceTemplateAttributeV2 verified = 3;
|
|
47
|
+
*/
|
|
48
|
+
verified: EServiceTemplateAttributeV2[];
|
|
49
|
+
}
|
|
12
50
|
/**
|
|
13
51
|
* @generated from protobuf message eservice.template.v2.EServiceTemplateVersionV2
|
|
14
52
|
*/
|
|
@@ -54,9 +92,9 @@ export interface EServiceTemplateVersionV2 {
|
|
|
54
92
|
*/
|
|
55
93
|
agreementApprovalPolicy?: AgreementApprovalPolicyV2;
|
|
56
94
|
/**
|
|
57
|
-
* @generated from protobuf field: eservice.v2.
|
|
95
|
+
* @generated from protobuf field: eservice.template.v2.EServiceTemplateAttributesV2 attributes = 11;
|
|
58
96
|
*/
|
|
59
|
-
attributes?:
|
|
97
|
+
attributes?: EServiceTemplateAttributesV2;
|
|
60
98
|
/**
|
|
61
99
|
* @generated from protobuf field: int64 createdAt = 12;
|
|
62
100
|
*/
|
|
@@ -144,6 +182,36 @@ export declare enum EServiceTemplateVersionStateV2 {
|
|
|
144
182
|
*/
|
|
145
183
|
SUSPENDED = 3
|
|
146
184
|
}
|
|
185
|
+
declare class EServiceTemplateAttributeValueV2$Type extends MessageType<EServiceTemplateAttributeValueV2> {
|
|
186
|
+
constructor();
|
|
187
|
+
create(value?: PartialMessage<EServiceTemplateAttributeValueV2>): EServiceTemplateAttributeValueV2;
|
|
188
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EServiceTemplateAttributeValueV2): EServiceTemplateAttributeValueV2;
|
|
189
|
+
internalBinaryWrite(message: EServiceTemplateAttributeValueV2, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @generated MessageType for protobuf message eservice.template.v2.EServiceTemplateAttributeValueV2
|
|
193
|
+
*/
|
|
194
|
+
export declare const EServiceTemplateAttributeValueV2: EServiceTemplateAttributeValueV2$Type;
|
|
195
|
+
declare class EServiceTemplateAttributeV2$Type extends MessageType<EServiceTemplateAttributeV2> {
|
|
196
|
+
constructor();
|
|
197
|
+
create(value?: PartialMessage<EServiceTemplateAttributeV2>): EServiceTemplateAttributeV2;
|
|
198
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EServiceTemplateAttributeV2): EServiceTemplateAttributeV2;
|
|
199
|
+
internalBinaryWrite(message: EServiceTemplateAttributeV2, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @generated MessageType for protobuf message eservice.template.v2.EServiceTemplateAttributeV2
|
|
203
|
+
*/
|
|
204
|
+
export declare const EServiceTemplateAttributeV2: EServiceTemplateAttributeV2$Type;
|
|
205
|
+
declare class EServiceTemplateAttributesV2$Type extends MessageType<EServiceTemplateAttributesV2> {
|
|
206
|
+
constructor();
|
|
207
|
+
create(value?: PartialMessage<EServiceTemplateAttributesV2>): EServiceTemplateAttributesV2;
|
|
208
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EServiceTemplateAttributesV2): EServiceTemplateAttributesV2;
|
|
209
|
+
internalBinaryWrite(message: EServiceTemplateAttributesV2, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @generated MessageType for protobuf message eservice.template.v2.EServiceTemplateAttributesV2
|
|
213
|
+
*/
|
|
214
|
+
export declare const EServiceTemplateAttributesV2: EServiceTemplateAttributesV2$Type;
|
|
147
215
|
declare class EServiceTemplateVersionV2$Type extends MessageType<EServiceTemplateVersionV2> {
|
|
148
216
|
constructor();
|
|
149
217
|
create(value?: PartialMessage<EServiceTemplateVersionV2>): EServiceTemplateVersionV2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eservice-template.d.ts","sourceRoot":"","sources":["../../../../src/gen/v2/eservice-template/eservice-template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"eservice-template.d.ts","sourceRoot":"","sources":["../../../../src/gen/v2/eservice-template/eservice-template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC7C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;CAC1C;AACD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,MAAM,EAAE,gCAAgC,EAAE,CAAC;CAC9C;AACD;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,SAAS,EAAE,2BAA2B,EAAE,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC;;OAEG;IACH,QAAQ,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AACD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,EAA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2 } from "../eservice/eservice.js";
|
|
6
6
|
import { EServiceTechnologyV2 } from "../eservice/eservice.js";
|
|
7
|
-
import { EServiceAttributesV2 } from "../eservice/eservice.js";
|
|
8
7
|
import { AgreementApprovalPolicyV2 } from "../eservice/eservice.js";
|
|
9
8
|
import { EServiceDocumentV2 } from "../eservice/eservice.js";
|
|
10
9
|
/**
|
|
@@ -30,6 +29,171 @@ export var EServiceTemplateVersionStateV2;
|
|
|
30
29
|
EServiceTemplateVersionStateV2[EServiceTemplateVersionStateV2["SUSPENDED"] = 3] = "SUSPENDED";
|
|
31
30
|
})(EServiceTemplateVersionStateV2 || (EServiceTemplateVersionStateV2 = {}));
|
|
32
31
|
// @generated message type with reflection information, may provide speed optimized methods
|
|
32
|
+
class EServiceTemplateAttributeValueV2$Type extends MessageType {
|
|
33
|
+
constructor() {
|
|
34
|
+
super("eservice.template.v2.EServiceTemplateAttributeValueV2", [
|
|
35
|
+
{ no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
36
|
+
{ no: 2, name: "explicitAttributeVerification", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
create(value) {
|
|
40
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
41
|
+
message.id = "";
|
|
42
|
+
message.explicitAttributeVerification = false;
|
|
43
|
+
if (value !== undefined)
|
|
44
|
+
reflectionMergePartial(this, message, value);
|
|
45
|
+
return message;
|
|
46
|
+
}
|
|
47
|
+
internalBinaryRead(reader, length, options, target) {
|
|
48
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
49
|
+
while (reader.pos < end) {
|
|
50
|
+
let [fieldNo, wireType] = reader.tag();
|
|
51
|
+
switch (fieldNo) {
|
|
52
|
+
case /* string id */ 1:
|
|
53
|
+
message.id = reader.string();
|
|
54
|
+
break;
|
|
55
|
+
case /* bool explicitAttributeVerification */ 2:
|
|
56
|
+
message.explicitAttributeVerification = reader.bool();
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
let u = options.readUnknownField;
|
|
60
|
+
if (u === "throw")
|
|
61
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
62
|
+
let d = reader.skip(wireType);
|
|
63
|
+
if (u !== false)
|
|
64
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return message;
|
|
68
|
+
}
|
|
69
|
+
internalBinaryWrite(message, writer, options) {
|
|
70
|
+
/* string id = 1; */
|
|
71
|
+
if (message.id !== "")
|
|
72
|
+
writer.tag(1, WireType.LengthDelimited).string(message.id);
|
|
73
|
+
/* bool explicitAttributeVerification = 2; */
|
|
74
|
+
if (message.explicitAttributeVerification !== false)
|
|
75
|
+
writer.tag(2, WireType.Varint).bool(message.explicitAttributeVerification);
|
|
76
|
+
let u = options.writeUnknownFields;
|
|
77
|
+
if (u !== false)
|
|
78
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
79
|
+
return writer;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @generated MessageType for protobuf message eservice.template.v2.EServiceTemplateAttributeValueV2
|
|
84
|
+
*/
|
|
85
|
+
export const EServiceTemplateAttributeValueV2 = new EServiceTemplateAttributeValueV2$Type();
|
|
86
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
87
|
+
class EServiceTemplateAttributeV2$Type extends MessageType {
|
|
88
|
+
constructor() {
|
|
89
|
+
super("eservice.template.v2.EServiceTemplateAttributeV2", [
|
|
90
|
+
{ no: 1, name: "values", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => EServiceTemplateAttributeValueV2 }
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
create(value) {
|
|
94
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
95
|
+
message.values = [];
|
|
96
|
+
if (value !== undefined)
|
|
97
|
+
reflectionMergePartial(this, message, value);
|
|
98
|
+
return message;
|
|
99
|
+
}
|
|
100
|
+
internalBinaryRead(reader, length, options, target) {
|
|
101
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
102
|
+
while (reader.pos < end) {
|
|
103
|
+
let [fieldNo, wireType] = reader.tag();
|
|
104
|
+
switch (fieldNo) {
|
|
105
|
+
case /* repeated eservice.template.v2.EServiceTemplateAttributeValueV2 values */ 1:
|
|
106
|
+
message.values.push(EServiceTemplateAttributeValueV2.internalBinaryRead(reader, reader.uint32(), options));
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
let u = options.readUnknownField;
|
|
110
|
+
if (u === "throw")
|
|
111
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
112
|
+
let d = reader.skip(wireType);
|
|
113
|
+
if (u !== false)
|
|
114
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return message;
|
|
118
|
+
}
|
|
119
|
+
internalBinaryWrite(message, writer, options) {
|
|
120
|
+
/* repeated eservice.template.v2.EServiceTemplateAttributeValueV2 values = 1; */
|
|
121
|
+
for (let i = 0; i < message.values.length; i++)
|
|
122
|
+
EServiceTemplateAttributeValueV2.internalBinaryWrite(message.values[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
123
|
+
let u = options.writeUnknownFields;
|
|
124
|
+
if (u !== false)
|
|
125
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
126
|
+
return writer;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @generated MessageType for protobuf message eservice.template.v2.EServiceTemplateAttributeV2
|
|
131
|
+
*/
|
|
132
|
+
export const EServiceTemplateAttributeV2 = new EServiceTemplateAttributeV2$Type();
|
|
133
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
134
|
+
class EServiceTemplateAttributesV2$Type extends MessageType {
|
|
135
|
+
constructor() {
|
|
136
|
+
super("eservice.template.v2.EServiceTemplateAttributesV2", [
|
|
137
|
+
{ no: 1, name: "certified", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => EServiceTemplateAttributeV2 },
|
|
138
|
+
{ no: 2, name: "declared", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => EServiceTemplateAttributeV2 },
|
|
139
|
+
{ no: 3, name: "verified", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => EServiceTemplateAttributeV2 }
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
create(value) {
|
|
143
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
144
|
+
message.certified = [];
|
|
145
|
+
message.declared = [];
|
|
146
|
+
message.verified = [];
|
|
147
|
+
if (value !== undefined)
|
|
148
|
+
reflectionMergePartial(this, message, value);
|
|
149
|
+
return message;
|
|
150
|
+
}
|
|
151
|
+
internalBinaryRead(reader, length, options, target) {
|
|
152
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
153
|
+
while (reader.pos < end) {
|
|
154
|
+
let [fieldNo, wireType] = reader.tag();
|
|
155
|
+
switch (fieldNo) {
|
|
156
|
+
case /* repeated eservice.template.v2.EServiceTemplateAttributeV2 certified */ 1:
|
|
157
|
+
message.certified.push(EServiceTemplateAttributeV2.internalBinaryRead(reader, reader.uint32(), options));
|
|
158
|
+
break;
|
|
159
|
+
case /* repeated eservice.template.v2.EServiceTemplateAttributeV2 declared */ 2:
|
|
160
|
+
message.declared.push(EServiceTemplateAttributeV2.internalBinaryRead(reader, reader.uint32(), options));
|
|
161
|
+
break;
|
|
162
|
+
case /* repeated eservice.template.v2.EServiceTemplateAttributeV2 verified */ 3:
|
|
163
|
+
message.verified.push(EServiceTemplateAttributeV2.internalBinaryRead(reader, reader.uint32(), options));
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
let u = options.readUnknownField;
|
|
167
|
+
if (u === "throw")
|
|
168
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
169
|
+
let d = reader.skip(wireType);
|
|
170
|
+
if (u !== false)
|
|
171
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return message;
|
|
175
|
+
}
|
|
176
|
+
internalBinaryWrite(message, writer, options) {
|
|
177
|
+
/* repeated eservice.template.v2.EServiceTemplateAttributeV2 certified = 1; */
|
|
178
|
+
for (let i = 0; i < message.certified.length; i++)
|
|
179
|
+
EServiceTemplateAttributeV2.internalBinaryWrite(message.certified[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
|
180
|
+
/* repeated eservice.template.v2.EServiceTemplateAttributeV2 declared = 2; */
|
|
181
|
+
for (let i = 0; i < message.declared.length; i++)
|
|
182
|
+
EServiceTemplateAttributeV2.internalBinaryWrite(message.declared[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
|
|
183
|
+
/* repeated eservice.template.v2.EServiceTemplateAttributeV2 verified = 3; */
|
|
184
|
+
for (let i = 0; i < message.verified.length; i++)
|
|
185
|
+
EServiceTemplateAttributeV2.internalBinaryWrite(message.verified[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
186
|
+
let u = options.writeUnknownFields;
|
|
187
|
+
if (u !== false)
|
|
188
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
189
|
+
return writer;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @generated MessageType for protobuf message eservice.template.v2.EServiceTemplateAttributesV2
|
|
194
|
+
*/
|
|
195
|
+
export const EServiceTemplateAttributesV2 = new EServiceTemplateAttributesV2$Type();
|
|
196
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
33
197
|
class EServiceTemplateVersionV2$Type extends MessageType {
|
|
34
198
|
constructor() {
|
|
35
199
|
super("eservice.template.v2.EServiceTemplateVersionV2", [
|
|
@@ -43,7 +207,7 @@ class EServiceTemplateVersionV2$Type extends MessageType {
|
|
|
43
207
|
{ no: 8, name: "dailyCallsPerConsumer", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ },
|
|
44
208
|
{ no: 9, name: "dailyCallsTotal", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ },
|
|
45
209
|
{ no: 10, name: "agreementApprovalPolicy", kind: "enum", opt: true, T: () => ["eservice.v2.AgreementApprovalPolicyV2", AgreementApprovalPolicyV2] },
|
|
46
|
-
{ no: 11, name: "attributes", kind: "message", T: () =>
|
|
210
|
+
{ no: 11, name: "attributes", kind: "message", T: () => EServiceTemplateAttributesV2 },
|
|
47
211
|
{ no: 12, name: "createdAt", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
48
212
|
{ no: 13, name: "publishedAt", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
49
213
|
{ no: 14, name: "suspendedAt", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
@@ -97,8 +261,8 @@ class EServiceTemplateVersionV2$Type extends MessageType {
|
|
|
97
261
|
case /* optional eservice.v2.AgreementApprovalPolicyV2 agreementApprovalPolicy */ 10:
|
|
98
262
|
message.agreementApprovalPolicy = reader.int32();
|
|
99
263
|
break;
|
|
100
|
-
case /* eservice.v2.
|
|
101
|
-
message.attributes =
|
|
264
|
+
case /* eservice.template.v2.EServiceTemplateAttributesV2 attributes */ 11:
|
|
265
|
+
message.attributes = EServiceTemplateAttributesV2.internalBinaryRead(reader, reader.uint32(), options, message.attributes);
|
|
102
266
|
break;
|
|
103
267
|
case /* int64 createdAt */ 12:
|
|
104
268
|
message.createdAt = reader.int64().toBigInt();
|
|
@@ -154,9 +318,9 @@ class EServiceTemplateVersionV2$Type extends MessageType {
|
|
|
154
318
|
/* optional eservice.v2.AgreementApprovalPolicyV2 agreementApprovalPolicy = 10; */
|
|
155
319
|
if (message.agreementApprovalPolicy !== undefined)
|
|
156
320
|
writer.tag(10, WireType.Varint).int32(message.agreementApprovalPolicy);
|
|
157
|
-
/* eservice.v2.
|
|
321
|
+
/* eservice.template.v2.EServiceTemplateAttributesV2 attributes = 11; */
|
|
158
322
|
if (message.attributes)
|
|
159
|
-
|
|
323
|
+
EServiceTemplateAttributesV2.internalBinaryWrite(message.attributes, writer.tag(11, WireType.LengthDelimited).fork(), options).join();
|
|
160
324
|
/* int64 createdAt = 12; */
|
|
161
325
|
if (message.createdAt !== 0n)
|
|
162
326
|
writer.tag(12, WireType.Varint).int64(message.createdAt);
|
package/package.json
CHANGED
|
@@ -11,6 +11,21 @@ enum EServiceTemplateVersionStateV2 {
|
|
|
11
11
|
SUSPENDED = 3;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
message EServiceTemplateAttributeValueV2 {
|
|
15
|
+
string id = 1;
|
|
16
|
+
bool explicitAttributeVerification = 2;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message EServiceTemplateAttributeV2 {
|
|
20
|
+
repeated EServiceTemplateAttributeValueV2 values = 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message EServiceTemplateAttributesV2 {
|
|
24
|
+
repeated EServiceTemplateAttributeV2 certified = 1;
|
|
25
|
+
repeated EServiceTemplateAttributeV2 declared = 2;
|
|
26
|
+
repeated EServiceTemplateAttributeV2 verified = 3;
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
message EServiceTemplateVersionV2 {
|
|
15
30
|
string id = 1;
|
|
16
31
|
int64 version = 2;
|
|
@@ -22,7 +37,7 @@ message EServiceTemplateVersionV2 {
|
|
|
22
37
|
optional int32 dailyCallsPerConsumer = 8;
|
|
23
38
|
optional int32 dailyCallsTotal = 9;
|
|
24
39
|
optional eservice.v2.AgreementApprovalPolicyV2 agreementApprovalPolicy = 10;
|
|
25
|
-
|
|
40
|
+
EServiceTemplateAttributesV2 attributes = 11;
|
|
26
41
|
int64 createdAt = 12;
|
|
27
42
|
optional int64 publishedAt = 13;
|
|
28
43
|
optional int64 suspendedAt = 14;
|
package/tests/eservice.test.ts
CHANGED
|
@@ -38,7 +38,17 @@ describe("eservice", () => {
|
|
|
38
38
|
serverUrls: ["pagopa.it"],
|
|
39
39
|
agreementApprovalPolicy: AgreementApprovalPolicyV2.AUTOMATIC,
|
|
40
40
|
attributes: {
|
|
41
|
-
certified: [
|
|
41
|
+
certified: [
|
|
42
|
+
{
|
|
43
|
+
values: [
|
|
44
|
+
{
|
|
45
|
+
id: "test",
|
|
46
|
+
explicitAttributeVerification: true,
|
|
47
|
+
dailyCallsPerConsumer: 10,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
42
52
|
verified: [],
|
|
43
53
|
declared: [],
|
|
44
54
|
},
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
encodeOutboundEServiceTemplateEvent,
|
|
4
|
+
decodeOutboundEServiceTemplateEvent,
|
|
5
|
+
EServiceTemplateEvent,
|
|
6
|
+
EServiceTemplateVersionStateV2,
|
|
7
|
+
EServiceModeV2,
|
|
8
|
+
EServiceTechnologyV2,
|
|
9
|
+
AgreementApprovalPolicyV2,
|
|
10
|
+
} from "../src/index.js";
|
|
11
|
+
|
|
12
|
+
describe("eservice-template", () => {
|
|
13
|
+
it("should correctly encode and decode EServiceTemplateAdded event", () => {
|
|
14
|
+
const event: EServiceTemplateEvent = {
|
|
15
|
+
event_version: 2,
|
|
16
|
+
type: "EServiceTemplateAdded",
|
|
17
|
+
data: {
|
|
18
|
+
eserviceTemplate: {
|
|
19
|
+
id: "test-template-id",
|
|
20
|
+
creatorId: "creator-123",
|
|
21
|
+
name: "Test Template",
|
|
22
|
+
intendedTarget: "Test Target Audience",
|
|
23
|
+
description: "Test template description",
|
|
24
|
+
technology: EServiceTechnologyV2.REST,
|
|
25
|
+
mode: EServiceModeV2.DELIVER,
|
|
26
|
+
createdAt: 1n,
|
|
27
|
+
versions: [
|
|
28
|
+
{
|
|
29
|
+
id: "version-id",
|
|
30
|
+
version: 1n,
|
|
31
|
+
docs: [],
|
|
32
|
+
state: EServiceTemplateVersionStateV2.DRAFT,
|
|
33
|
+
voucherLifespan: 60,
|
|
34
|
+
dailyCallsPerConsumer: 10,
|
|
35
|
+
dailyCallsTotal: 1000,
|
|
36
|
+
createdAt: 1n,
|
|
37
|
+
agreementApprovalPolicy: AgreementApprovalPolicyV2.AUTOMATIC,
|
|
38
|
+
attributes: {
|
|
39
|
+
certified: [
|
|
40
|
+
{
|
|
41
|
+
values: [
|
|
42
|
+
{
|
|
43
|
+
id: "attr-id",
|
|
44
|
+
explicitAttributeVerification: false,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
verified: [],
|
|
50
|
+
declared: [],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
stream_id: "123",
|
|
57
|
+
timestamp: new Date(),
|
|
58
|
+
version: 1,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const encoded = encodeOutboundEServiceTemplateEvent(event);
|
|
62
|
+
const decoded = decodeOutboundEServiceTemplateEvent(encoded);
|
|
63
|
+
|
|
64
|
+
expect(decoded).toEqual(event);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// TODO: Add more tests for other event types
|
|
68
|
+
});
|