@proveanything/smartlinks 2.1.46 → 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/docs/API_SUMMARY.md +318 -1
- package/dist/docs/dpp.md +99 -0
- package/dist/docs/overview.md +1 -0
- package/dist/openapi.yaml +503 -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/docs/API_SUMMARY.md +318 -1
- package/docs/dpp.md +99 -0
- package/docs/overview.md +1 -0
- package/openapi.yaml +503 -0
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { DppEnvironment, DppRegistry, SetDppRegistryInput, DppRegistryCheckResult, DppGroup, DppPassport, DppPassportInput, DppPassportUpsertInput, DppPassportSaveResult, DppPassportUpsertResult, DppPassportBulkResult, DppPassportVersion, DppPassportListQuery, DppRegisterResult, DppTask, DppTaskRefreshResult, DppDocument } from "../types/dpp.js";
|
|
2
|
+
export declare namespace dpp {
|
|
3
|
+
/** What passports can be made: product groups, their kinds, and each view's fields and required fields. GET /dpp/groups */
|
|
4
|
+
function groups(collectionId: string): Promise<DppGroup[]>;
|
|
5
|
+
/**
|
|
6
|
+
* Read a passport as the public sees it, at its address (the EU JSON document), or an earlier version of it.
|
|
7
|
+
* No sign-in needed. GET /public/dpp/:collectionId/:passportId
|
|
8
|
+
*/
|
|
9
|
+
function read(collectionId: string, passportId: string, opts?: {
|
|
10
|
+
version?: number;
|
|
11
|
+
}): Promise<DppDocument>;
|
|
12
|
+
/**
|
|
13
|
+
* Send passports to the EU registry. They're grouped by product group and sent up to 100 at a time; the registry
|
|
14
|
+
* reads each one at its address. Passports still missing required fields, withdrawn or already registered come
|
|
15
|
+
* back in `skipped`. With `wait: true` the call waits (up to ~45 s) and returns each passport's outcome; otherwise
|
|
16
|
+
* follow up with `dpp.tasks.refresh`. POST /dpp/registry/:env/register
|
|
17
|
+
*/
|
|
18
|
+
function register(collectionId: string, env: DppEnvironment, passportIds: string[], opts?: {
|
|
19
|
+
wait?: boolean;
|
|
20
|
+
}): Promise<DppRegisterResult>;
|
|
21
|
+
/** The brand's EU registry connection (one per environment). Managed by the collection's admins. */
|
|
22
|
+
namespace registry {
|
|
23
|
+
/** Both environments, each with `nextStep` (what's left to connect). GET /dpp/registry */
|
|
24
|
+
function list(collectionId: string): Promise<DppRegistry[]>;
|
|
25
|
+
/** One environment. GET /dpp/registry/:env */
|
|
26
|
+
function get(collectionId: string, env: DppEnvironment): Promise<DppRegistry>;
|
|
27
|
+
/**
|
|
28
|
+
* Make (or replace) the key the brand's Service Account trusts. The private key stays on SmartLinks' servers;
|
|
29
|
+
* show `publicPem` (or `publicJwk`) for the brand to add to its Service Account in the registry. Replacing the
|
|
30
|
+
* key clears `kid` — the registry gives the new key its own. POST /dpp/registry/:env/key
|
|
31
|
+
*/
|
|
32
|
+
function makeKey(collectionId: string, env: DppEnvironment, opts?: {
|
|
33
|
+
alg?: "ES256" | "ES384" | "ES512";
|
|
34
|
+
}): Promise<DppRegistry>;
|
|
35
|
+
/** Save the Service Account's Client ID and key ID, and the brand's Organisation ID, from the registry. PUT /dpp/registry/:env */
|
|
36
|
+
function set(collectionId: string, env: DppEnvironment, input: SetDppRegistryInput): Promise<DppRegistry>;
|
|
37
|
+
/** Sign in to the registry and read its product groups — proves the connection works. POST /dpp/registry/:env/check */
|
|
38
|
+
function check(collectionId: string, env: DppEnvironment): Promise<DppRegistryCheckResult>;
|
|
39
|
+
}
|
|
40
|
+
/** The collection's passports. */
|
|
41
|
+
namespace passports {
|
|
42
|
+
/** GET /dpp/passports */
|
|
43
|
+
function list(collectionId: string, q?: DppPassportListQuery): Promise<DppPassport[]>;
|
|
44
|
+
/** One passport, with `check` (what it's still missing) and its `url`. GET /dpp/passports/:id */
|
|
45
|
+
function get(collectionId: string, passportId: string): Promise<DppPassport>;
|
|
46
|
+
/** Make a passport. POST /dpp/passports */
|
|
47
|
+
function create(collectionId: string, input: DppPassportInput & {
|
|
48
|
+
productGroup: string;
|
|
49
|
+
}): Promise<DppPassport>;
|
|
50
|
+
/**
|
|
51
|
+
* Change a passport. `public` / `restricted` are merged into what's there unless `replace` is true. A change to
|
|
52
|
+
* what it says makes a new version. PUT /dpp/passports/:id
|
|
53
|
+
*/
|
|
54
|
+
function update(collectionId: string, passportId: string, input: DppPassportInput, opts?: {
|
|
55
|
+
replace?: boolean;
|
|
56
|
+
}): Promise<DppPassportSaveResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Publish the passport for a product, batch or item (`productId` / `batchId` / `proofId`) at a granularity:
|
|
59
|
+
* updates the one already there or makes it. The fields replace what's there (pass `merge: true` to merge).
|
|
60
|
+
* Saving the same content again changes nothing. PUT /dpp/passports/by-anchor
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const { passport } = await dpp.passports.upsert(collectionId, {
|
|
65
|
+
* productId, productGroup: 'BATTERIES', productSubGroup: 'EV', granularity: 'model',
|
|
66
|
+
* public: { batteryChemistry: [...], manufacturerIdentification: {...} },
|
|
67
|
+
* restricted: { dismantlingInformation: [...] },
|
|
68
|
+
* })
|
|
69
|
+
* if (!passport.check.ready) console.log('Still missing', passport.check.missing)
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
function upsert(collectionId: string, input: DppPassportUpsertInput, opts?: {
|
|
73
|
+
merge?: boolean;
|
|
74
|
+
}): Promise<DppPassportUpsertResult>;
|
|
75
|
+
/** `upsert` for up to 500 passports at once (e.g. one per battery); each answers on its own. POST /dpp/passports/bulk */
|
|
76
|
+
function upsertMany(collectionId: string, items: DppPassportUpsertInput[], opts?: {
|
|
77
|
+
merge?: boolean;
|
|
78
|
+
}): Promise<DppPassportBulkResult>;
|
|
79
|
+
/** Its versions, newest first; read one with `dpp.read(collectionId, id, { version })`. GET /dpp/passports/:id/versions */
|
|
80
|
+
function versions(collectionId: string, passportId: string): Promise<DppPassportVersion[]>;
|
|
81
|
+
/** No longer valid: stays at its address, marked invalid (the registry keeps its record). POST /dpp/passports/:id/withdraw */
|
|
82
|
+
function withdraw(collectionId: string, passportId: string): Promise<DppPassport>;
|
|
83
|
+
/** Valid again. POST /dpp/passports/:id/restore */
|
|
84
|
+
function restore(collectionId: string, passportId: string): Promise<DppPassport>;
|
|
85
|
+
}
|
|
86
|
+
/** Registry requests and their outcomes. */
|
|
87
|
+
namespace tasks {
|
|
88
|
+
/** Requests sent to one environment, newest first. GET /dpp/registry/:env/tasks */
|
|
89
|
+
function list(collectionId: string, env: DppEnvironment): Promise<DppTask[]>;
|
|
90
|
+
/** Ask the registry how a request went and record it on its passports. POST /dpp/registry/:env/tasks/:taskId/refresh */
|
|
91
|
+
function refresh(collectionId: string, env: DppEnvironment, taskId: string): Promise<DppTaskRefreshResult>;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/dist/api/dpp.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// src/api/dpp.ts
|
|
2
|
+
//
|
|
3
|
+
// EU Digital Product Passports (ESPR) hosted by SmartLinks, and registering them in the EU registry for the brand
|
|
4
|
+
// (docs/dpp.md).
|
|
5
|
+
//
|
|
6
|
+
// The EU registry only lets an organisation register its own passports, so each brand enrols itself (with its own
|
|
7
|
+
// qualified e-seal, on the EU's site) and adds a Service Account holding SmartLinks' public key. From then on
|
|
8
|
+
// SmartLinks registers for it:
|
|
9
|
+
//
|
|
10
|
+
// 1. dpp.registry.makeKey(collectionId, 'acc') → show registry.publicPem to upload to the Service Account
|
|
11
|
+
// 2. dpp.registry.set(collectionId, 'acc', { clientId, kid, orgIdentifier })
|
|
12
|
+
// 3. dpp.registry.check(collectionId, 'acc') → signs in and reads the registry's product groups
|
|
13
|
+
// 4. dpp.passports.upsert(...) / upsertMany(...) → passports at their addresses (passport.url)
|
|
14
|
+
// 5. dpp.register(collectionId, 'acc', passportIds) → the registry reads each one and registers it
|
|
15
|
+
//
|
|
16
|
+
// 'acc' is the EU test registry, 'prod' the live one. Each passport is served at its address: the public view to
|
|
17
|
+
// anyone, and the restricted views only to the EU registry for that brand.
|
|
18
|
+
//
|
|
19
|
+
// Endpoints: /admin/collection/:collectionId/dpp/… and /public/dpp/:collectionId/:passportId
|
|
20
|
+
import { request, post, put } from "../http.js";
|
|
21
|
+
function enc(v) { return encodeURIComponent(v); }
|
|
22
|
+
const base = (collectionId) => `/admin/collection/${enc(collectionId)}/dpp`;
|
|
23
|
+
function query(q) {
|
|
24
|
+
const p = new URLSearchParams();
|
|
25
|
+
for (const [k, v] of Object.entries(q))
|
|
26
|
+
if (v !== undefined && v !== null && v !== "")
|
|
27
|
+
p.set(k, String(v));
|
|
28
|
+
const s = p.toString();
|
|
29
|
+
return s ? `?${s}` : "";
|
|
30
|
+
}
|
|
31
|
+
export var dpp;
|
|
32
|
+
(function (dpp) {
|
|
33
|
+
/** What passports can be made: product groups, their kinds, and each view's fields and required fields. GET /dpp/groups */
|
|
34
|
+
async function groups(collectionId) {
|
|
35
|
+
const out = await request(`${base(collectionId)}/groups`);
|
|
36
|
+
return out.groups;
|
|
37
|
+
}
|
|
38
|
+
dpp.groups = groups;
|
|
39
|
+
/**
|
|
40
|
+
* Read a passport as the public sees it, at its address (the EU JSON document), or an earlier version of it.
|
|
41
|
+
* No sign-in needed. GET /public/dpp/:collectionId/:passportId
|
|
42
|
+
*/
|
|
43
|
+
async function read(collectionId, passportId, opts = {}) {
|
|
44
|
+
return request(`/public/dpp/${enc(collectionId)}/${enc(passportId)}${query({ version: opts.version })}`);
|
|
45
|
+
}
|
|
46
|
+
dpp.read = read;
|
|
47
|
+
/**
|
|
48
|
+
* Send passports to the EU registry. They're grouped by product group and sent up to 100 at a time; the registry
|
|
49
|
+
* reads each one at its address. Passports still missing required fields, withdrawn or already registered come
|
|
50
|
+
* back in `skipped`. With `wait: true` the call waits (up to ~45 s) and returns each passport's outcome; otherwise
|
|
51
|
+
* follow up with `dpp.tasks.refresh`. POST /dpp/registry/:env/register
|
|
52
|
+
*/
|
|
53
|
+
async function register(collectionId, env, passportIds, opts = {}) {
|
|
54
|
+
return post(`${base(collectionId)}/registry/${enc(env)}/register`, { passportIds, wait: !!opts.wait });
|
|
55
|
+
}
|
|
56
|
+
dpp.register = register;
|
|
57
|
+
/** The brand's EU registry connection (one per environment). Managed by the collection's admins. */
|
|
58
|
+
let registry;
|
|
59
|
+
(function (registry) {
|
|
60
|
+
/** Both environments, each with `nextStep` (what's left to connect). GET /dpp/registry */
|
|
61
|
+
async function list(collectionId) {
|
|
62
|
+
const out = await request(`${base(collectionId)}/registry`);
|
|
63
|
+
return out.registries;
|
|
64
|
+
}
|
|
65
|
+
registry.list = list;
|
|
66
|
+
/** One environment. GET /dpp/registry/:env */
|
|
67
|
+
async function get(collectionId, env) {
|
|
68
|
+
const out = await request(`${base(collectionId)}/registry/${enc(env)}`);
|
|
69
|
+
return out.registry;
|
|
70
|
+
}
|
|
71
|
+
registry.get = get;
|
|
72
|
+
/**
|
|
73
|
+
* Make (or replace) the key the brand's Service Account trusts. The private key stays on SmartLinks' servers;
|
|
74
|
+
* show `publicPem` (or `publicJwk`) for the brand to add to its Service Account in the registry. Replacing the
|
|
75
|
+
* key clears `kid` — the registry gives the new key its own. POST /dpp/registry/:env/key
|
|
76
|
+
*/
|
|
77
|
+
async function makeKey(collectionId, env, opts = {}) {
|
|
78
|
+
const out = await post(`${base(collectionId)}/registry/${enc(env)}/key`, opts);
|
|
79
|
+
return out.registry;
|
|
80
|
+
}
|
|
81
|
+
registry.makeKey = makeKey;
|
|
82
|
+
/** Save the Service Account's Client ID and key ID, and the brand's Organisation ID, from the registry. PUT /dpp/registry/:env */
|
|
83
|
+
async function set(collectionId, env, input) {
|
|
84
|
+
const out = await put(`${base(collectionId)}/registry/${enc(env)}`, input);
|
|
85
|
+
return out.registry;
|
|
86
|
+
}
|
|
87
|
+
registry.set = set;
|
|
88
|
+
/** Sign in to the registry and read its product groups — proves the connection works. POST /dpp/registry/:env/check */
|
|
89
|
+
async function check(collectionId, env) {
|
|
90
|
+
return post(`${base(collectionId)}/registry/${enc(env)}/check`, {});
|
|
91
|
+
}
|
|
92
|
+
registry.check = check;
|
|
93
|
+
})(registry = dpp.registry || (dpp.registry = {}));
|
|
94
|
+
/** The collection's passports. */
|
|
95
|
+
let passports;
|
|
96
|
+
(function (passports) {
|
|
97
|
+
/** GET /dpp/passports */
|
|
98
|
+
async function list(collectionId, q = {}) {
|
|
99
|
+
const out = await request(`${base(collectionId)}/passports${query(q)}`);
|
|
100
|
+
return out.passports;
|
|
101
|
+
}
|
|
102
|
+
passports.list = list;
|
|
103
|
+
/** One passport, with `check` (what it's still missing) and its `url`. GET /dpp/passports/:id */
|
|
104
|
+
async function get(collectionId, passportId) {
|
|
105
|
+
const out = await request(`${base(collectionId)}/passports/${enc(passportId)}`);
|
|
106
|
+
return out.passport;
|
|
107
|
+
}
|
|
108
|
+
passports.get = get;
|
|
109
|
+
/** Make a passport. POST /dpp/passports */
|
|
110
|
+
async function create(collectionId, input) {
|
|
111
|
+
const out = await post(`${base(collectionId)}/passports`, input);
|
|
112
|
+
return out.passport;
|
|
113
|
+
}
|
|
114
|
+
passports.create = create;
|
|
115
|
+
/**
|
|
116
|
+
* Change a passport. `public` / `restricted` are merged into what's there unless `replace` is true. A change to
|
|
117
|
+
* what it says makes a new version. PUT /dpp/passports/:id
|
|
118
|
+
*/
|
|
119
|
+
async function update(collectionId, passportId, input, opts = {}) {
|
|
120
|
+
return put(`${base(collectionId)}/passports/${enc(passportId)}${query({ replace: opts.replace ? "true" : undefined })}`, input);
|
|
121
|
+
}
|
|
122
|
+
passports.update = update;
|
|
123
|
+
/**
|
|
124
|
+
* Publish the passport for a product, batch or item (`productId` / `batchId` / `proofId`) at a granularity:
|
|
125
|
+
* updates the one already there or makes it. The fields replace what's there (pass `merge: true` to merge).
|
|
126
|
+
* Saving the same content again changes nothing. PUT /dpp/passports/by-anchor
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const { passport } = await dpp.passports.upsert(collectionId, {
|
|
131
|
+
* productId, productGroup: 'BATTERIES', productSubGroup: 'EV', granularity: 'model',
|
|
132
|
+
* public: { batteryChemistry: [...], manufacturerIdentification: {...} },
|
|
133
|
+
* restricted: { dismantlingInformation: [...] },
|
|
134
|
+
* })
|
|
135
|
+
* if (!passport.check.ready) console.log('Still missing', passport.check.missing)
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
async function upsert(collectionId, input, opts = {}) {
|
|
139
|
+
return put(`${base(collectionId)}/passports/by-anchor${query({ replace: opts.merge ? "false" : undefined })}`, input);
|
|
140
|
+
}
|
|
141
|
+
passports.upsert = upsert;
|
|
142
|
+
/** `upsert` for up to 500 passports at once (e.g. one per battery); each answers on its own. POST /dpp/passports/bulk */
|
|
143
|
+
async function upsertMany(collectionId, items, opts = {}) {
|
|
144
|
+
return post(`${base(collectionId)}/passports/bulk${query({ replace: opts.merge ? "false" : undefined })}`, { passports: items });
|
|
145
|
+
}
|
|
146
|
+
passports.upsertMany = upsertMany;
|
|
147
|
+
/** Its versions, newest first; read one with `dpp.read(collectionId, id, { version })`. GET /dpp/passports/:id/versions */
|
|
148
|
+
async function versions(collectionId, passportId) {
|
|
149
|
+
const out = await request(`${base(collectionId)}/passports/${enc(passportId)}/versions`);
|
|
150
|
+
return out.versions;
|
|
151
|
+
}
|
|
152
|
+
passports.versions = versions;
|
|
153
|
+
/** No longer valid: stays at its address, marked invalid (the registry keeps its record). POST /dpp/passports/:id/withdraw */
|
|
154
|
+
async function withdraw(collectionId, passportId) {
|
|
155
|
+
const out = await post(`${base(collectionId)}/passports/${enc(passportId)}/withdraw`, {});
|
|
156
|
+
return out.passport;
|
|
157
|
+
}
|
|
158
|
+
passports.withdraw = withdraw;
|
|
159
|
+
/** Valid again. POST /dpp/passports/:id/restore */
|
|
160
|
+
async function restore(collectionId, passportId) {
|
|
161
|
+
const out = await post(`${base(collectionId)}/passports/${enc(passportId)}/restore`, {});
|
|
162
|
+
return out.passport;
|
|
163
|
+
}
|
|
164
|
+
passports.restore = restore;
|
|
165
|
+
})(passports = dpp.passports || (dpp.passports = {}));
|
|
166
|
+
/** Registry requests and their outcomes. */
|
|
167
|
+
let tasks;
|
|
168
|
+
(function (tasks) {
|
|
169
|
+
/** Requests sent to one environment, newest first. GET /dpp/registry/:env/tasks */
|
|
170
|
+
async function list(collectionId, env) {
|
|
171
|
+
const out = await request(`${base(collectionId)}/registry/${enc(env)}/tasks`);
|
|
172
|
+
return out.tasks;
|
|
173
|
+
}
|
|
174
|
+
tasks.list = list;
|
|
175
|
+
/** Ask the registry how a request went and record it on its passports. POST /dpp/registry/:env/tasks/:taskId/refresh */
|
|
176
|
+
async function refresh(collectionId, env, taskId) {
|
|
177
|
+
const out = await post(`${base(collectionId)}/registry/${enc(env)}/tasks/${enc(taskId)}/refresh`, {});
|
|
178
|
+
return out.task;
|
|
179
|
+
}
|
|
180
|
+
tasks.refresh = refresh;
|
|
181
|
+
})(tasks = dpp.tasks || (dpp.tasks = {}));
|
|
182
|
+
})(dpp || (dpp = {}));
|
package/dist/api/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export { translations } from "./translations.js";
|
|
|
56
56
|
export { integrations } from "./integrations.js";
|
|
57
57
|
export { secrets } from "./secrets.js";
|
|
58
58
|
export { serviceAccounts } from "./serviceAccounts.js";
|
|
59
|
+
export { dpp } from "./dpp.js";
|
|
59
60
|
export { research } from "./research.js";
|
|
60
61
|
export { config } from "./config.js";
|
|
61
62
|
export { http } from "./http.js";
|
package/dist/api/index.js
CHANGED
|
@@ -59,6 +59,7 @@ export { translations } from "./translations.js";
|
|
|
59
59
|
export { integrations } from "./integrations.js";
|
|
60
60
|
export { secrets } from "./secrets.js";
|
|
61
61
|
export { serviceAccounts } from "./serviceAccounts.js";
|
|
62
|
+
export { dpp } from "./dpp.js";
|
|
62
63
|
export { research } from "./research.js";
|
|
63
64
|
export { config } from "./config.js";
|
|
64
65
|
export { http } from "./http.js";
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.47 | Generated: 2026-11-23T16:17:31.480Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -148,6 +148,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
148
148
|
- **conditions** - Functions for conditions operations
|
|
149
149
|
- **config** - Functions for config operations
|
|
150
150
|
- **containers** - Functions for containers operations
|
|
151
|
+
- **dpp** - Functions for dpp operations
|
|
151
152
|
- **errors** - Functions for errors operations
|
|
152
153
|
- **facets** - Functions for facets operations
|
|
153
154
|
- **files** - Functions for files operations
|
|
@@ -8104,6 +8105,257 @@ interface DeleteCrateResponse {
|
|
|
8104
8105
|
}
|
|
8105
8106
|
```
|
|
8106
8107
|
|
|
8108
|
+
### dpp
|
|
8109
|
+
|
|
8110
|
+
**DppRegistry** (interface)
|
|
8111
|
+
```typescript
|
|
8112
|
+
interface DppRegistry {
|
|
8113
|
+
environment: DppEnvironment
|
|
8114
|
+
label: string
|
|
8115
|
+
portal: string | null
|
|
8116
|
+
clientId: string | null
|
|
8117
|
+
kid: string | null
|
|
8118
|
+
alg: string | null
|
|
8119
|
+
orgIdentifier: string | null
|
|
8120
|
+
hasKey: boolean
|
|
8121
|
+
publicPem: string | null
|
|
8122
|
+
publicJwk: { kty: string; crv: string; x: string; y: string } | null
|
|
8123
|
+
thumbprint: string | null
|
|
8124
|
+
keyCreatedAt: string | null
|
|
8125
|
+
lastCheck: { ok: boolean; at: string; message: string; status?: number | null } | null
|
|
8126
|
+
ready: boolean
|
|
8127
|
+
nextStep: DppRegistryNextStep
|
|
8128
|
+
}
|
|
8129
|
+
```
|
|
8130
|
+
|
|
8131
|
+
**SetDppRegistryInput** (interface)
|
|
8132
|
+
```typescript
|
|
8133
|
+
interface SetDppRegistryInput {
|
|
8134
|
+
clientId?: string | null
|
|
8135
|
+
kid?: string | null
|
|
8136
|
+
orgIdentifier?: string | null
|
|
8137
|
+
}
|
|
8138
|
+
```
|
|
8139
|
+
|
|
8140
|
+
**DppRegistryProductGroup** (interface)
|
|
8141
|
+
```typescript
|
|
8142
|
+
interface DppRegistryProductGroup {
|
|
8143
|
+
code: string
|
|
8144
|
+
label: string
|
|
8145
|
+
productSubGroups: { code: string; label: string }[]
|
|
8146
|
+
}
|
|
8147
|
+
```
|
|
8148
|
+
|
|
8149
|
+
**DppRegistryCheckResult** (interface)
|
|
8150
|
+
```typescript
|
|
8151
|
+
interface DppRegistryCheckResult {
|
|
8152
|
+
registry: DppRegistry
|
|
8153
|
+
productGroups: DppRegistryProductGroup[]
|
|
8154
|
+
}
|
|
8155
|
+
```
|
|
8156
|
+
|
|
8157
|
+
**DppViewFields** (interface)
|
|
8158
|
+
```typescript
|
|
8159
|
+
interface DppViewFields {
|
|
8160
|
+
pub: string[]
|
|
8161
|
+
res1: string[]
|
|
8162
|
+
res2: string[]
|
|
8163
|
+
res3: string[]
|
|
8164
|
+
}
|
|
8165
|
+
```
|
|
8166
|
+
|
|
8167
|
+
**DppGroup** (interface)
|
|
8168
|
+
```typescript
|
|
8169
|
+
interface DppGroup {
|
|
8170
|
+
productGroup: string
|
|
8171
|
+
label: string
|
|
8172
|
+
subGroups: {
|
|
8173
|
+
productSubGroup: string
|
|
8174
|
+
label: string
|
|
8175
|
+
fields: DppViewFields
|
|
8176
|
+
required: DppViewFields
|
|
8177
|
+
}[]
|
|
8178
|
+
}
|
|
8179
|
+
```
|
|
8180
|
+
|
|
8181
|
+
**DppPassportCheck** (interface)
|
|
8182
|
+
```typescript
|
|
8183
|
+
interface DppPassportCheck {
|
|
8184
|
+
ready: boolean
|
|
8185
|
+
missing: Partial<DppViewFields>
|
|
8186
|
+
problem?: string
|
|
8187
|
+
}
|
|
8188
|
+
```
|
|
8189
|
+
|
|
8190
|
+
**DppRegistration** (interface)
|
|
8191
|
+
```typescript
|
|
8192
|
+
interface DppRegistration {
|
|
8193
|
+
status: "processing" | "registered" | "rejected" | "not-sent" | "error"
|
|
8194
|
+
taskId?: string
|
|
8195
|
+
submittedAt?: string
|
|
8196
|
+
correlationId?: string | null
|
|
8197
|
+
registryId?: string | null
|
|
8198
|
+
registeredAt?: string
|
|
8199
|
+
problems?: { code: string; message: string }[] | null
|
|
8200
|
+
checkedAt?: string
|
|
8201
|
+
}
|
|
8202
|
+
```
|
|
8203
|
+
|
|
8204
|
+
**DppPassport** (interface)
|
|
8205
|
+
```typescript
|
|
8206
|
+
interface DppPassport {
|
|
8207
|
+
id: string
|
|
8208
|
+
url: string
|
|
8209
|
+
status: "active" | "withdrawn"
|
|
8210
|
+
productGroup: string
|
|
8211
|
+
productSubGroup: string | null
|
|
8212
|
+
granularity: DppGranularity
|
|
8213
|
+
modelIdentifier: string | null
|
|
8214
|
+
batchIdentifier: string | null
|
|
8215
|
+
productId: string | null
|
|
8216
|
+
batchId: string | null
|
|
8217
|
+
proofId: string | null
|
|
8218
|
+
public: DppFields
|
|
8219
|
+
restricted: DppFields
|
|
8220
|
+
version: number
|
|
8221
|
+
contentUpdatedAt: string | null
|
|
8222
|
+
registration: Partial<Record<DppEnvironment, DppRegistration>>
|
|
8223
|
+
check: DppPassportCheck
|
|
8224
|
+
createdAt: string
|
|
8225
|
+
updatedAt: string
|
|
8226
|
+
}
|
|
8227
|
+
```
|
|
8228
|
+
|
|
8229
|
+
**DppPassportInput** (interface)
|
|
8230
|
+
```typescript
|
|
8231
|
+
interface DppPassportInput {
|
|
8232
|
+
productGroup?: string
|
|
8233
|
+
productSubGroup?: string | null
|
|
8234
|
+
granularity?: DppGranularity
|
|
8235
|
+
modelIdentifier?: string | null
|
|
8236
|
+
batchIdentifier?: string | null
|
|
8237
|
+
productId?: string | null
|
|
8238
|
+
batchId?: string | null
|
|
8239
|
+
proofId?: string | null
|
|
8240
|
+
public?: DppFields | null
|
|
8241
|
+
restricted?: DppFields | null
|
|
8242
|
+
}
|
|
8243
|
+
```
|
|
8244
|
+
|
|
8245
|
+
**DppPassportSaveResult** (interface)
|
|
8246
|
+
```typescript
|
|
8247
|
+
interface DppPassportSaveResult {
|
|
8248
|
+
passport: DppPassport
|
|
8249
|
+
changed: boolean
|
|
8250
|
+
}
|
|
8251
|
+
```
|
|
8252
|
+
|
|
8253
|
+
**DppPassportBulkResult** (interface)
|
|
8254
|
+
```typescript
|
|
8255
|
+
interface DppPassportBulkResult {
|
|
8256
|
+
results: (
|
|
8257
|
+
| { index: number; ok: true; id: string; url: string; created: boolean; changed: boolean; version: number; check: DppPassportCheck }
|
|
8258
|
+
| { index: number; ok: false; errorCode: string; errorText: string }
|
|
8259
|
+
)[]
|
|
8260
|
+
created: number
|
|
8261
|
+
changed: number
|
|
8262
|
+
unchanged: number
|
|
8263
|
+
failed: number
|
|
8264
|
+
}
|
|
8265
|
+
```
|
|
8266
|
+
|
|
8267
|
+
**DppPassportVersion** (interface)
|
|
8268
|
+
```typescript
|
|
8269
|
+
interface DppPassportVersion {
|
|
8270
|
+
version: number
|
|
8271
|
+
savedAt: string
|
|
8272
|
+
savedBy: string | null
|
|
8273
|
+
}
|
|
8274
|
+
```
|
|
8275
|
+
|
|
8276
|
+
**DppPassportListQuery** (interface)
|
|
8277
|
+
```typescript
|
|
8278
|
+
interface DppPassportListQuery {
|
|
8279
|
+
productId?: string
|
|
8280
|
+
batchId?: string
|
|
8281
|
+
proofId?: string
|
|
8282
|
+
status?: "active" | "withdrawn"
|
|
8283
|
+
limit?: number
|
|
8284
|
+
offset?: number
|
|
8285
|
+
}
|
|
8286
|
+
```
|
|
8287
|
+
|
|
8288
|
+
**DppRegisterResult** (interface)
|
|
8289
|
+
```typescript
|
|
8290
|
+
interface DppRegisterResult {
|
|
8291
|
+
tasks: {
|
|
8292
|
+
taskId: string
|
|
8293
|
+
environment: DppEnvironment
|
|
8294
|
+
productGroup: string
|
|
8295
|
+
productSubGroup: string | null
|
|
8296
|
+
passportIds: string[]
|
|
8297
|
+
estimated: string | null
|
|
8298
|
+
status?: string
|
|
8299
|
+
outcome?: DppTaskOutcome | null
|
|
8300
|
+
passports?: ({ id: string } & Partial<DppRegistration>)[]
|
|
8301
|
+
}[]
|
|
8302
|
+
skipped: { id: string; reason: string; missing?: Partial<DppViewFields>; registryId?: string }[]
|
|
8303
|
+
}
|
|
8304
|
+
```
|
|
8305
|
+
|
|
8306
|
+
**DppTaskOutcome** (interface)
|
|
8307
|
+
```typescript
|
|
8308
|
+
interface DppTaskOutcome {
|
|
8309
|
+
outcomeResult: "SUCCEEDED" | "FAILED"
|
|
8310
|
+
outcomeMessage?: { code: string; message: string }
|
|
8311
|
+
}
|
|
8312
|
+
```
|
|
8313
|
+
|
|
8314
|
+
**DppTask** (interface)
|
|
8315
|
+
```typescript
|
|
8316
|
+
interface DppTask {
|
|
8317
|
+
taskId: string
|
|
8318
|
+
environment: DppEnvironment
|
|
8319
|
+
status: string | null
|
|
8320
|
+
outcome: DppTaskOutcome | null
|
|
8321
|
+
passportIds: string[]
|
|
8322
|
+
createdAt: string
|
|
8323
|
+
checkedAt: string | null
|
|
8324
|
+
}
|
|
8325
|
+
```
|
|
8326
|
+
|
|
8327
|
+
**DppTaskRefreshResult** (interface)
|
|
8328
|
+
```typescript
|
|
8329
|
+
interface DppTaskRefreshResult {
|
|
8330
|
+
taskId: string
|
|
8331
|
+
status: string | null
|
|
8332
|
+
outcome: DppTaskOutcome | null
|
|
8333
|
+
processingInfo: { submittedItems: number; compliantItems: number; nonCompliantItems: number } | null
|
|
8334
|
+
passports: ({ id: string } & Partial<DppRegistration>)[]
|
|
8335
|
+
}
|
|
8336
|
+
```
|
|
8337
|
+
|
|
8338
|
+
**DppDocument** (interface)
|
|
8339
|
+
```typescript
|
|
8340
|
+
interface DppDocument {
|
|
8341
|
+
digitalProductPassportId: string
|
|
8342
|
+
uniqueProductIdentifier: string
|
|
8343
|
+
granularity: string
|
|
8344
|
+
dppStatus: string
|
|
8345
|
+
lastUpdate: string
|
|
8346
|
+
contentSpecificationIds: string[]
|
|
8347
|
+
[field: string]: unknown
|
|
8348
|
+
}
|
|
8349
|
+
```
|
|
8350
|
+
|
|
8351
|
+
**DppEnvironment** = `"acc" | "prod" | "local" | (string & {})`
|
|
8352
|
+
|
|
8353
|
+
**DppGranularity** = `"item" | "batch" | "model"`
|
|
8354
|
+
|
|
8355
|
+
**DppRegistryNextStep** = `"make-key" | "enter-service-account" | "enter-organisation-id" | "check" | null`
|
|
8356
|
+
|
|
8357
|
+
**DppFields** = `Record<string, unknown>`
|
|
8358
|
+
|
|
8107
8359
|
### error
|
|
8108
8360
|
|
|
8109
8361
|
**ErrorResponse** (interface)
|
|
@@ -15151,6 +15403,71 @@ Update a crate for a collection (admin only). ```typescript const updated = awai
|
|
|
15151
15403
|
crateId: string) → `Promise<DeleteCrateResponse>`
|
|
15152
15404
|
Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
|
|
15153
15405
|
|
|
15406
|
+
### dpp
|
|
15407
|
+
|
|
15408
|
+
**groups**(collectionId: string) → `Promise<DppGroup[]>`
|
|
15409
|
+
What passports can be made: product groups, their kinds, and each view's fields and required fields. GET /dpp/groups
|
|
15410
|
+
|
|
15411
|
+
**read**(collectionId: string, passportId: string, opts: { version?: number } = {}) → `Promise<DppDocument>`
|
|
15412
|
+
Read a passport as the public sees it, at its address (the EU JSON document), or an earlier version of it. No sign-in needed. GET /public/dpp/:collectionId/:passportId
|
|
15413
|
+
|
|
15414
|
+
**register**(collectionId: string, env: DppEnvironment, passportIds: string[], opts: { wait?: boolean } = {}) → `Promise<DppRegisterResult>`
|
|
15415
|
+
Send passports to the EU registry. They're grouped by product group and sent up to 100 at a time; the registry reads each one at its address. Passports still missing required fields, withdrawn or already registered come back in `skipped`. With `wait: true` the call waits (up to ~45 s) and returns each passport's outcome; otherwise follow up with `dpp.tasks.refresh`. POST /dpp/registry/:env/register
|
|
15416
|
+
|
|
15417
|
+
### dpp.passports
|
|
15418
|
+
|
|
15419
|
+
**list**(collectionId: string, q: DppPassportListQuery = {}) → `Promise<DppPassport[]>`
|
|
15420
|
+
GET /dpp/passports
|
|
15421
|
+
|
|
15422
|
+
**get**(collectionId: string, passportId: string) → `Promise<DppPassport>`
|
|
15423
|
+
One passport, with `check` (what it's still missing) and its `url`. GET /dpp/passports/:id
|
|
15424
|
+
|
|
15425
|
+
**create**(collectionId: string, input: DppPassportInput & { productGroup: string }) → `Promise<DppPassport>`
|
|
15426
|
+
Make a passport. POST /dpp/passports
|
|
15427
|
+
|
|
15428
|
+
**update**(collectionId: string, passportId: string, input: DppPassportInput, opts: { replace?: boolean } = {}) → `Promise<DppPassportSaveResult>`
|
|
15429
|
+
Change a passport. `public` / `restricted` are merged into what's there unless `replace` is true. A change to what it says makes a new version. PUT /dpp/passports/:id
|
|
15430
|
+
|
|
15431
|
+
**upsert**(collectionId: string, input: DppPassportUpsertInput, opts: { merge?: boolean } = {}) → `Promise<DppPassportUpsertResult>`
|
|
15432
|
+
Publish the passport for a product, batch or item (`productId` / `batchId` / `proofId`) at a granularity: updates the one already there or makes it. The fields replace what's there (pass `merge: true` to merge). Saving the same content again changes nothing. PUT /dpp/passports/by-anchor ```typescript const { passport } = await dpp.passports.upsert(collectionId, { productId, productGroup: 'BATTERIES', productSubGroup: 'EV', granularity: 'model', public: { batteryChemistry: [...], manufacturerIdentification: {...} }, restricted: { dismantlingInformation: [...] }, }) if (!passport.check.ready) console.log('Still missing', passport.check.missing) ```
|
|
15433
|
+
|
|
15434
|
+
**upsertMany**(collectionId: string, items: DppPassportUpsertInput[], opts: { merge?: boolean } = {}) → `Promise<DppPassportBulkResult>`
|
|
15435
|
+
`upsert` for up to 500 passports at once (e.g. one per battery); each answers on its own. POST /dpp/passports/bulk
|
|
15436
|
+
|
|
15437
|
+
**versions**(collectionId: string, passportId: string) → `Promise<DppPassportVersion[]>`
|
|
15438
|
+
Its versions, newest first; read one with `dpp.read(collectionId, id, { version })`. GET /dpp/passports/:id/versions
|
|
15439
|
+
|
|
15440
|
+
**withdraw**(collectionId: string, passportId: string) → `Promise<DppPassport>`
|
|
15441
|
+
No longer valid: stays at its address, marked invalid (the registry keeps its record). POST /dpp/passports/:id/withdraw
|
|
15442
|
+
|
|
15443
|
+
**restore**(collectionId: string, passportId: string) → `Promise<DppPassport>`
|
|
15444
|
+
Valid again. POST /dpp/passports/:id/restore
|
|
15445
|
+
|
|
15446
|
+
### dpp.registry
|
|
15447
|
+
|
|
15448
|
+
**list**(collectionId: string) → `Promise<DppRegistry[]>`
|
|
15449
|
+
Both environments, each with `nextStep` (what's left to connect). GET /dpp/registry
|
|
15450
|
+
|
|
15451
|
+
**get**(collectionId: string, env: DppEnvironment) → `Promise<DppRegistry>`
|
|
15452
|
+
One environment. GET /dpp/registry/:env
|
|
15453
|
+
|
|
15454
|
+
**makeKey**(collectionId: string, env: DppEnvironment, opts: { alg?: "ES256" | "ES384" | "ES512" } = {}) → `Promise<DppRegistry>`
|
|
15455
|
+
Make (or replace) the key the brand's Service Account trusts. The private key stays on SmartLinks' servers; show `publicPem` (or `publicJwk`) for the brand to add to its Service Account in the registry. Replacing the key clears `kid` — the registry gives the new key its own. POST /dpp/registry/:env/key
|
|
15456
|
+
|
|
15457
|
+
**set**(collectionId: string, env: DppEnvironment, input: SetDppRegistryInput) → `Promise<DppRegistry>`
|
|
15458
|
+
Save the Service Account's Client ID and key ID, and the brand's Organisation ID, from the registry. PUT /dpp/registry/:env
|
|
15459
|
+
|
|
15460
|
+
**check**(collectionId: string, env: DppEnvironment) → `Promise<DppRegistryCheckResult>`
|
|
15461
|
+
Sign in to the registry and read its product groups — proves the connection works. POST /dpp/registry/:env/check
|
|
15462
|
+
|
|
15463
|
+
### dpp.tasks
|
|
15464
|
+
|
|
15465
|
+
**list**(collectionId: string, env: DppEnvironment) → `Promise<DppTask[]>`
|
|
15466
|
+
Requests sent to one environment, newest first. GET /dpp/registry/:env/tasks
|
|
15467
|
+
|
|
15468
|
+
**refresh**(collectionId: string, env: DppEnvironment, taskId: string) → `Promise<DppTaskRefreshResult>`
|
|
15469
|
+
Ask the registry how a request went and record it on its passports. POST /dpp/registry/:env/tasks/:taskId/refresh
|
|
15470
|
+
|
|
15154
15471
|
### errors
|
|
15155
15472
|
|
|
15156
15473
|
**report**(event: ClientErrorReport) → `Promise<`
|