@proveanything/smartlinks 2.1.45 → 2.1.47
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/api/dpp.d.ts +93 -0
- package/dist/api/dpp.js +182 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/serviceAccounts.d.ts +22 -5
- package/dist/api/serviceAccounts.js +35 -8
- package/dist/docs/API_SUMMARY.md +348 -5
- package/dist/docs/dpp.md +99 -0
- package/dist/docs/overview.md +1 -0
- package/dist/docs/service-accounts.md +25 -4
- package/dist/openapi.yaml +536 -0
- package/dist/types/dpp.d.ts +264 -0
- package/dist/types/dpp.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/serviceAccounts.d.ts +24 -1
- package/docs/API_SUMMARY.md +348 -5
- package/docs/dpp.md +99 -0
- package/docs/overview.md +1 -0
- package/docs/service-accounts.md +25 -4
- package/openapi.yaml +536 -0
- package/package.json +1 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/** The EU registry's environments: `acc` = the EU test registry, `prod` = the live one, `local` = a development stand-in. */
|
|
2
|
+
export type DppEnvironment = "acc" | "prod" | "local" | (string & {});
|
|
3
|
+
/** How specific a passport is: one item (e.g. one battery), a batch, or a model. */
|
|
4
|
+
export type DppGranularity = "item" | "batch" | "model";
|
|
5
|
+
/** What the admin still has to do to connect a brand to the registry, in order (null = connected). */
|
|
6
|
+
export type DppRegistryNextStep = "make-key" | "enter-service-account" | "enter-organisation-id" | "check" | null;
|
|
7
|
+
/** A brand's EU registry Service Account, as SmartLinks uses it. Never includes the private key. */
|
|
8
|
+
export interface DppRegistry {
|
|
9
|
+
environment: DppEnvironment;
|
|
10
|
+
/** e.g. "EU test registry" */
|
|
11
|
+
label: string;
|
|
12
|
+
/** The registry's web address, where the brand enrols and manages its Service Account. */
|
|
13
|
+
portal: string | null;
|
|
14
|
+
/** The Service Account's Client ID, from the registry. */
|
|
15
|
+
clientId: string | null;
|
|
16
|
+
/** The key ID (kid) the registry gave our public key. */
|
|
17
|
+
kid: string | null;
|
|
18
|
+
/** ES256 | ES384 | ES512 */
|
|
19
|
+
alg: string | null;
|
|
20
|
+
/** The brand's verified Organisation ID (registry: Organisation > Verification), copied exactly. */
|
|
21
|
+
orgIdentifier: string | null;
|
|
22
|
+
hasKey: boolean;
|
|
23
|
+
/** The public key to upload to the Service Account (PEM). */
|
|
24
|
+
publicPem: string | null;
|
|
25
|
+
/** The same public key as a JWK. */
|
|
26
|
+
publicJwk: {
|
|
27
|
+
kty: string;
|
|
28
|
+
crv: string;
|
|
29
|
+
x: string;
|
|
30
|
+
y: string;
|
|
31
|
+
} | null;
|
|
32
|
+
/** RFC 7638 thumbprint of the public key. */
|
|
33
|
+
thumbprint: string | null;
|
|
34
|
+
keyCreatedAt: string | null;
|
|
35
|
+
/** The last connection check: signed in and read the product groups, or why not. */
|
|
36
|
+
lastCheck: {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
at: string;
|
|
39
|
+
message: string;
|
|
40
|
+
status?: number | null;
|
|
41
|
+
} | null;
|
|
42
|
+
/** Key, Service Account and Organisation ID all set. */
|
|
43
|
+
ready: boolean;
|
|
44
|
+
nextStep: DppRegistryNextStep;
|
|
45
|
+
}
|
|
46
|
+
export interface SetDppRegistryInput {
|
|
47
|
+
clientId?: string | null;
|
|
48
|
+
kid?: string | null;
|
|
49
|
+
orgIdentifier?: string | null;
|
|
50
|
+
}
|
|
51
|
+
/** A registry product group, from the registry itself. */
|
|
52
|
+
export interface DppRegistryProductGroup {
|
|
53
|
+
code: string;
|
|
54
|
+
label: string;
|
|
55
|
+
productSubGroups: {
|
|
56
|
+
code: string;
|
|
57
|
+
label: string;
|
|
58
|
+
}[];
|
|
59
|
+
}
|
|
60
|
+
export interface DppRegistryCheckResult {
|
|
61
|
+
registry: DppRegistry;
|
|
62
|
+
productGroups: DppRegistryProductGroup[];
|
|
63
|
+
}
|
|
64
|
+
/** Field names per view: `pub` (anyone) and the restricted views `res1`–`res3`. */
|
|
65
|
+
export interface DppViewFields {
|
|
66
|
+
pub: string[];
|
|
67
|
+
res1: string[];
|
|
68
|
+
res2: string[];
|
|
69
|
+
res3: string[];
|
|
70
|
+
}
|
|
71
|
+
/** What can be made: a product group, its kinds, and their fields (from the Commission's schemas). */
|
|
72
|
+
export interface DppGroup {
|
|
73
|
+
/** e.g. "BATTERIES" */
|
|
74
|
+
productGroup: string;
|
|
75
|
+
/** e.g. "battery" */
|
|
76
|
+
label: string;
|
|
77
|
+
subGroups: {
|
|
78
|
+
/** e.g. "EV" */
|
|
79
|
+
productSubGroup: string;
|
|
80
|
+
/** e.g. "electric vehicle" */
|
|
81
|
+
label: string;
|
|
82
|
+
/** Every field each view may carry. */
|
|
83
|
+
fields: DppViewFields;
|
|
84
|
+
/** The fields each view must carry. */
|
|
85
|
+
required: DppViewFields;
|
|
86
|
+
}[];
|
|
87
|
+
}
|
|
88
|
+
/** What a passport is still missing before the registry will take it. */
|
|
89
|
+
export interface DppPassportCheck {
|
|
90
|
+
ready: boolean;
|
|
91
|
+
missing: Partial<DppViewFields>;
|
|
92
|
+
/** When the passport's classification itself is invalid. */
|
|
93
|
+
problem?: string;
|
|
94
|
+
}
|
|
95
|
+
/** A passport's registration in one registry environment. */
|
|
96
|
+
export interface DppRegistration {
|
|
97
|
+
/** processing → registered | rejected | not-sent (another item in the same request failed) | error */
|
|
98
|
+
status: "processing" | "registered" | "rejected" | "not-sent" | "error";
|
|
99
|
+
taskId?: string;
|
|
100
|
+
submittedAt?: string;
|
|
101
|
+
correlationId?: string | null;
|
|
102
|
+
/** The registry's unique registration identifier, once registered. */
|
|
103
|
+
registryId?: string | null;
|
|
104
|
+
registeredAt?: string;
|
|
105
|
+
problems?: {
|
|
106
|
+
code: string;
|
|
107
|
+
message: string;
|
|
108
|
+
}[] | null;
|
|
109
|
+
checkedAt?: string;
|
|
110
|
+
}
|
|
111
|
+
/** Fields of a passport, named as in the Commission's schemas (e.g. batteryChemistry, manufacturerIdentification). */
|
|
112
|
+
export type DppFields = Record<string, unknown>;
|
|
113
|
+
export interface DppPassport {
|
|
114
|
+
id: string;
|
|
115
|
+
/** Its address — the unique product identifier registered with the EU. */
|
|
116
|
+
url: string;
|
|
117
|
+
status: "active" | "withdrawn";
|
|
118
|
+
productGroup: string;
|
|
119
|
+
productSubGroup: string | null;
|
|
120
|
+
granularity: DppGranularity;
|
|
121
|
+
modelIdentifier: string | null;
|
|
122
|
+
batchIdentifier: string | null;
|
|
123
|
+
/** What it's for. */
|
|
124
|
+
productId: string | null;
|
|
125
|
+
batchId: string | null;
|
|
126
|
+
proofId: string | null;
|
|
127
|
+
/** The public view: anyone reading the passport sees these. */
|
|
128
|
+
public: DppFields;
|
|
129
|
+
/** The restricted views (res1–res3): served only to the EU registry for this brand. */
|
|
130
|
+
restricted: DppFields;
|
|
131
|
+
/** Goes up by one each time what it says changes. */
|
|
132
|
+
version: number;
|
|
133
|
+
contentUpdatedAt: string | null;
|
|
134
|
+
/** By registry environment. */
|
|
135
|
+
registration: Partial<Record<DppEnvironment, DppRegistration>>;
|
|
136
|
+
check: DppPassportCheck;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
}
|
|
140
|
+
/** A passport's content. productGroup and (for batteries) productSubGroup are required when making one. */
|
|
141
|
+
export interface DppPassportInput {
|
|
142
|
+
productGroup?: string;
|
|
143
|
+
productSubGroup?: string | null;
|
|
144
|
+
granularity?: DppGranularity;
|
|
145
|
+
modelIdentifier?: string | null;
|
|
146
|
+
batchIdentifier?: string | null;
|
|
147
|
+
productId?: string | null;
|
|
148
|
+
batchId?: string | null;
|
|
149
|
+
proofId?: string | null;
|
|
150
|
+
public?: DppFields | null;
|
|
151
|
+
restricted?: DppFields | null;
|
|
152
|
+
}
|
|
153
|
+
/** A passport saved by what it's for: at least one of productId, batchId, proofId. */
|
|
154
|
+
export interface DppPassportUpsertInput extends DppPassportInput {
|
|
155
|
+
productGroup: string;
|
|
156
|
+
granularity: DppGranularity;
|
|
157
|
+
}
|
|
158
|
+
export interface DppPassportSaveResult {
|
|
159
|
+
passport: DppPassport;
|
|
160
|
+
/** false when the content was the same as before (no new version). */
|
|
161
|
+
changed: boolean;
|
|
162
|
+
}
|
|
163
|
+
export interface DppPassportUpsertResult extends DppPassportSaveResult {
|
|
164
|
+
created: boolean;
|
|
165
|
+
}
|
|
166
|
+
export interface DppPassportBulkResult {
|
|
167
|
+
results: ({
|
|
168
|
+
index: number;
|
|
169
|
+
ok: true;
|
|
170
|
+
id: string;
|
|
171
|
+
url: string;
|
|
172
|
+
created: boolean;
|
|
173
|
+
changed: boolean;
|
|
174
|
+
version: number;
|
|
175
|
+
check: DppPassportCheck;
|
|
176
|
+
} | {
|
|
177
|
+
index: number;
|
|
178
|
+
ok: false;
|
|
179
|
+
errorCode: string;
|
|
180
|
+
errorText: string;
|
|
181
|
+
})[];
|
|
182
|
+
created: number;
|
|
183
|
+
changed: number;
|
|
184
|
+
unchanged: number;
|
|
185
|
+
failed: number;
|
|
186
|
+
}
|
|
187
|
+
export interface DppPassportVersion {
|
|
188
|
+
version: number;
|
|
189
|
+
savedAt: string;
|
|
190
|
+
savedBy: string | null;
|
|
191
|
+
}
|
|
192
|
+
export interface DppPassportListQuery {
|
|
193
|
+
productId?: string;
|
|
194
|
+
batchId?: string;
|
|
195
|
+
proofId?: string;
|
|
196
|
+
status?: "active" | "withdrawn";
|
|
197
|
+
limit?: number;
|
|
198
|
+
offset?: number;
|
|
199
|
+
}
|
|
200
|
+
export interface DppRegisterResult {
|
|
201
|
+
/** One registry request per product group (and kind), up to 100 passports each. */
|
|
202
|
+
tasks: {
|
|
203
|
+
taskId: string;
|
|
204
|
+
environment: DppEnvironment;
|
|
205
|
+
productGroup: string;
|
|
206
|
+
productSubGroup: string | null;
|
|
207
|
+
passportIds: string[];
|
|
208
|
+
/** ISO 8601 duration the registry estimated, e.g. "PT10S". */
|
|
209
|
+
estimated: string | null;
|
|
210
|
+
/** With `wait`: the outcome. */
|
|
211
|
+
status?: string;
|
|
212
|
+
outcome?: DppTaskOutcome | null;
|
|
213
|
+
passports?: ({
|
|
214
|
+
id: string;
|
|
215
|
+
} & Partial<DppRegistration>)[];
|
|
216
|
+
}[];
|
|
217
|
+
/** Not sent, and why (not found, withdrawn, already registered, missing required fields). */
|
|
218
|
+
skipped: {
|
|
219
|
+
id: string;
|
|
220
|
+
reason: string;
|
|
221
|
+
missing?: Partial<DppViewFields>;
|
|
222
|
+
registryId?: string;
|
|
223
|
+
}[];
|
|
224
|
+
}
|
|
225
|
+
export interface DppTaskOutcome {
|
|
226
|
+
outcomeResult: "SUCCEEDED" | "FAILED";
|
|
227
|
+
outcomeMessage?: {
|
|
228
|
+
code: string;
|
|
229
|
+
message: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
export interface DppTask {
|
|
233
|
+
taskId: string;
|
|
234
|
+
environment: DppEnvironment;
|
|
235
|
+
/** PENDING | PROCESSING | COMPLETED | ERROR */
|
|
236
|
+
status: string | null;
|
|
237
|
+
outcome: DppTaskOutcome | null;
|
|
238
|
+
passportIds: string[];
|
|
239
|
+
createdAt: string;
|
|
240
|
+
checkedAt: string | null;
|
|
241
|
+
}
|
|
242
|
+
export interface DppTaskRefreshResult {
|
|
243
|
+
taskId: string;
|
|
244
|
+
status: string | null;
|
|
245
|
+
outcome: DppTaskOutcome | null;
|
|
246
|
+
processingInfo: {
|
|
247
|
+
submittedItems: number;
|
|
248
|
+
compliantItems: number;
|
|
249
|
+
nonCompliantItems: number;
|
|
250
|
+
} | null;
|
|
251
|
+
passports: ({
|
|
252
|
+
id: string;
|
|
253
|
+
} & Partial<DppRegistration>)[];
|
|
254
|
+
}
|
|
255
|
+
/** A passport document as served at its address, in the EU's JSON format. */
|
|
256
|
+
export interface DppDocument {
|
|
257
|
+
digitalProductPassportId: string;
|
|
258
|
+
uniqueProductIdentifier: string;
|
|
259
|
+
granularity: string;
|
|
260
|
+
dppStatus: string;
|
|
261
|
+
lastUpdate: string;
|
|
262
|
+
contentSpecificationIds: string[];
|
|
263
|
+
[field: string]: unknown;
|
|
264
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./broadcasts.js";
|
|
|
17
17
|
export * from "./segments.js";
|
|
18
18
|
export * from "./userGroups.js";
|
|
19
19
|
export * from "./serviceAccounts.js";
|
|
20
|
+
export * from "./dpp.js";
|
|
20
21
|
export * from "./operations.js";
|
|
21
22
|
export * from "./common.js";
|
|
22
23
|
export * from "./query.js";
|
package/dist/types/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./broadcasts.js";
|
|
|
19
19
|
export * from "./segments.js";
|
|
20
20
|
export * from "./userGroups.js";
|
|
21
21
|
export * from "./serviceAccounts.js";
|
|
22
|
+
export * from "./dpp.js";
|
|
22
23
|
export * from "./operations.js";
|
|
23
24
|
export * from "./common.js";
|
|
24
25
|
export * from "./query.js";
|
|
@@ -6,10 +6,22 @@ export interface ServiceAccount {
|
|
|
6
6
|
id: string;
|
|
7
7
|
/** What uses it, e.g. "Warehouse system". */
|
|
8
8
|
name: string;
|
|
9
|
-
/** Its access on the collection (null if it was removed from the
|
|
9
|
+
/** Its access on the collection you asked about (null if it was removed from the members another way). */
|
|
10
10
|
access: ServiceAccountAccess | null;
|
|
11
11
|
/** false once its key has been switched off. */
|
|
12
12
|
active: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* true when it belongs to the collection you asked about (its home): only there can it be renamed, given a
|
|
15
|
+
* new key, deleted, or added to other collections.
|
|
16
|
+
*/
|
|
17
|
+
home: boolean;
|
|
18
|
+
/** Home only: the other collections it also works on, each with its access there. */
|
|
19
|
+
alsoOn?: ServiceAccountCollection[];
|
|
20
|
+
/** Not home: the collection it belongs to. */
|
|
21
|
+
homeCollection?: {
|
|
22
|
+
collectionId: string;
|
|
23
|
+
title: string;
|
|
24
|
+
};
|
|
13
25
|
createdAt: string;
|
|
14
26
|
/** The user id of the person who made it. */
|
|
15
27
|
createdBy: string | null;
|
|
@@ -20,6 +32,17 @@ export interface ServiceAccount {
|
|
|
20
32
|
/** How its key starts ("slsvc_sa-….…"), to recognise it — never the secret. */
|
|
21
33
|
keyHint: string;
|
|
22
34
|
}
|
|
35
|
+
/** Another collection a service account works on. */
|
|
36
|
+
export interface ServiceAccountCollection {
|
|
37
|
+
collectionId: string;
|
|
38
|
+
title: string;
|
|
39
|
+
access: ServiceAccountAccess | null;
|
|
40
|
+
}
|
|
41
|
+
/** Let a service account work on another collection too (or change its access there). */
|
|
42
|
+
export interface AddServiceAccountToCollectionInput {
|
|
43
|
+
collectionId: string;
|
|
44
|
+
access: ServiceAccountAccess;
|
|
45
|
+
}
|
|
23
46
|
export interface ServiceAccountList {
|
|
24
47
|
serviceAccounts: ServiceAccount[];
|
|
25
48
|
/** The access levels that can be given. */
|