@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
package/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)
|
|
@@ -11959,6 +12211,9 @@ interface ServiceAccount {
|
|
|
11959
12211
|
name: string
|
|
11960
12212
|
access: ServiceAccountAccess | null
|
|
11961
12213
|
active: boolean
|
|
12214
|
+
home: boolean
|
|
12215
|
+
alsoOn?: ServiceAccountCollection[]
|
|
12216
|
+
homeCollection?: { collectionId: string; title: string }
|
|
11962
12217
|
createdAt: string
|
|
11963
12218
|
createdBy: string | null
|
|
11964
12219
|
lastUsedAt: string | null
|
|
@@ -11967,6 +12222,23 @@ interface ServiceAccount {
|
|
|
11967
12222
|
}
|
|
11968
12223
|
```
|
|
11969
12224
|
|
|
12225
|
+
**ServiceAccountCollection** (interface)
|
|
12226
|
+
```typescript
|
|
12227
|
+
interface ServiceAccountCollection {
|
|
12228
|
+
collectionId: string
|
|
12229
|
+
title: string
|
|
12230
|
+
access: ServiceAccountAccess | null
|
|
12231
|
+
}
|
|
12232
|
+
```
|
|
12233
|
+
|
|
12234
|
+
**AddServiceAccountToCollectionInput** (interface)
|
|
12235
|
+
```typescript
|
|
12236
|
+
interface AddServiceAccountToCollectionInput {
|
|
12237
|
+
collectionId: string
|
|
12238
|
+
access: ServiceAccountAccess
|
|
12239
|
+
}
|
|
12240
|
+
```
|
|
12241
|
+
|
|
11970
12242
|
**ServiceAccountList** (interface)
|
|
11971
12243
|
```typescript
|
|
11972
12244
|
interface ServiceAccountList {
|
|
@@ -15131,6 +15403,71 @@ Update a crate for a collection (admin only). ```typescript const updated = awai
|
|
|
15131
15403
|
crateId: string) → `Promise<DeleteCrateResponse>`
|
|
15132
15404
|
Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
|
|
15133
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
|
+
|
|
15134
15471
|
### errors
|
|
15135
15472
|
|
|
15136
15473
|
**report**(event: ClientErrorReport) → `Promise<`
|
|
@@ -16273,19 +16610,25 @@ Soft-delete a secret. DELETE /secrets/:ref
|
|
|
16273
16610
|
### serviceAccounts
|
|
16274
16611
|
|
|
16275
16612
|
**list**(collectionId: string) → `Promise<ServiceAccountList>`
|
|
16276
|
-
The collection'
|
|
16613
|
+
The service accounts that work on this collection — its own (`home: true`, with `alsoOn`) and other collections' (`home: false`, with `homeCollection`) — never their keys, and the access levels that can be given. GET /service-accounts
|
|
16277
16614
|
|
|
16278
16615
|
**create**(collectionId: string, input: CreateServiceAccountInput) → `Promise<CreateServiceAccountResult>`
|
|
16279
16616
|
Make a service account → `{ serviceAccount, key }`. Show the key once — it can't be read again. You can't give it more access than you have. POST /service-accounts
|
|
16280
16617
|
|
|
16281
16618
|
**update**(collectionId: string, id: string, input: UpdateServiceAccountInput) → `Promise<ServiceAccount>`
|
|
16282
|
-
Rename it and/or change its access. PUT /service-accounts/:id
|
|
16619
|
+
Rename it (home collection only) and/or change its access on this collection. PUT /service-accounts/:id
|
|
16283
16620
|
|
|
16284
16621
|
**newKey**(collectionId: string, id: string) → `Promise<ServiceAccountKeyResult>`
|
|
16285
|
-
Give it a new key → `{ key }` (shown once); the old key stops working within a minute. POST /service-accounts/:id/key
|
|
16622
|
+
Give it a new key → `{ key }` (shown once; home collection only); the old key stops working within a minute. POST /service-accounts/:id/key
|
|
16623
|
+
|
|
16624
|
+
**addTo**(collectionId: string, id: string, input: AddServiceAccountToCollectionInput) → `Promise<ServiceAccount>`
|
|
16625
|
+
Let it work on another collection too, or change its access there. Call on its home collection; you must be an admin of `input.collectionId` as well, and can't give more access than you have there. POST /service-accounts/:id/collections
|
|
16626
|
+
|
|
16627
|
+
**removeFrom**(collectionId: string, id: string, otherCollectionId: string) → `Promise<`
|
|
16628
|
+
Stop it working on `otherCollectionId` (call on its home collection). DELETE /service-accounts/:id/collections/:otherId
|
|
16286
16629
|
|
|
16287
16630
|
**remove**(collectionId: string, id: string) → `Promise<`
|
|
16288
|
-
|
|
16631
|
+
On its home collection: delete it — its key stops working and its access is removed everywhere. On another collection it works on: remove it from that collection only. DELETE /service-accounts/:id
|
|
16289
16632
|
|
|
16290
16633
|
### sessions
|
|
16291
16634
|
|
package/docs/dpp.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# EU Digital Product Passports
|
|
2
|
+
|
|
3
|
+
SmartLinks hosts a brand's **EU Digital Product Passports** (ESPR) and registers them in the **EU registry** for
|
|
4
|
+
the brand. Each passport has its own permanent address, which is the identifier the EU registers. The public view
|
|
5
|
+
there is open to anyone; the restricted views (dismantling details, test reports, battery state of health) are served
|
|
6
|
+
only to the EU registry, for that brand.
|
|
7
|
+
|
|
8
|
+
Batteries come first (mandatory from 18 February 2027). Fields are named as in the Commission's own schemas
|
|
9
|
+
(`batteryChemistry`, `manufacturerIdentification`, …): `dpp.groups()` lists them, with what's required.
|
|
10
|
+
|
|
11
|
+
## Connecting a brand to the EU registry
|
|
12
|
+
|
|
13
|
+
The EU only lets an organisation register its own passports, so the **brand enrols itself**: an EU Login, and a
|
|
14
|
+
declaration sealed with the brand's own **qualified e-seal** (from a provider on the EU trusted list). That happens
|
|
15
|
+
on the EU's site. Nobody sends SmartLinks a seal, certificate or private key.
|
|
16
|
+
|
|
17
|
+
Then, once per environment (`acc` = the EU test registry, `prod` = the live one):
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { dpp } from "@proveanything/smartlinks"
|
|
21
|
+
|
|
22
|
+
// 1. SmartLinks makes the key; the brand adds the PUBLIC key to a Service Account ("Register DPPs" role).
|
|
23
|
+
const reg = await dpp.registry.makeKey(collectionId, "acc")
|
|
24
|
+
showToAdmin(reg.publicPem) // also reg.publicJwk; reg.portal is the registry's address
|
|
25
|
+
|
|
26
|
+
// 2. The brand pastes back three values from the registry.
|
|
27
|
+
await dpp.registry.set(collectionId, "acc", {
|
|
28
|
+
clientId: "…", // the Service Account's Client ID
|
|
29
|
+
kid: "…", // the key ID the registry gave our key
|
|
30
|
+
orgIdentifier: "…", // Organisation > Verification > Organisation ID, copied exactly
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// 3. Check: signs in and reads the registry's product groups.
|
|
34
|
+
const { registry } = await dpp.registry.check(collectionId, "acc")
|
|
35
|
+
registry.lastCheck // { ok: true, … } or { ok: false, message: "…plain words…" }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`dpp.registry.list(collectionId)` gives both environments, each with `nextStep`
|
|
39
|
+
(`make-key` → `enter-service-account` → `enter-organisation-id` → `check` → `null` when connected). Show them as
|
|
40
|
+
numbered steps.
|
|
41
|
+
|
|
42
|
+
## Publishing passports
|
|
43
|
+
|
|
44
|
+
Say what a passport is for (a product, a batch or one item) and its granularity. SmartLinks updates that passport
|
|
45
|
+
or makes it:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const { passport, created, changed } = await dpp.passports.upsert(collectionId, {
|
|
49
|
+
productId, // and/or batchId, proofId (one battery = a proof)
|
|
50
|
+
productGroup: "BATTERIES",
|
|
51
|
+
productSubGroup: "EV", // EV, LMT or IND
|
|
52
|
+
granularity: "item", // item | batch | model
|
|
53
|
+
modelIdentifier: "IC-75-LFP",
|
|
54
|
+
public: { batteryChemistry: ["https://repository.product-passport.ec.europa.eu/product/batteries/vocabs/battery-chemistry#lithiumIonLFP"], /* … */ },
|
|
55
|
+
restricted: { dismantlingInformation: [/* … */], batteryStatus: "…" },
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
passport.url // its address — what goes on the QR code and to the registry
|
|
59
|
+
passport.check // { ready, missing: { pub: [...], res1: [...], res2: [...], res3: [...] } }
|
|
60
|
+
passport.version // goes up by one each time what it says changes
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- **Publishing replaces**: the fields you send are the whole passport (`{ merge: true }` merges instead).
|
|
64
|
+
Publishing the same content again changes nothing (`changed: false`).
|
|
65
|
+
- **Many at once** (one per battery): `dpp.passports.upsertMany(collectionId, items)` — up to 500, each answering
|
|
66
|
+
on its own.
|
|
67
|
+
- **Versions**: `dpp.passports.versions(collectionId, id)`; read an earlier one with
|
|
68
|
+
`dpp.read(collectionId, id, { version: 2 })` (also `?version=2` on its address).
|
|
69
|
+
- **Withdraw / restore**: a withdrawn passport stays at its address, marked invalid.
|
|
70
|
+
- Never put restricted fields in `public`: anyone can read the public view.
|
|
71
|
+
|
|
72
|
+
`dpp.read(collectionId, passportId)` returns the public document exactly as served — use it for a public page,
|
|
73
|
+
so restricted data never reaches the browser.
|
|
74
|
+
|
|
75
|
+
## Registering
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
const { tasks, skipped } = await dpp.register(collectionId, "acc", passportIds, { wait: true })
|
|
79
|
+
// skipped: not found, withdrawn, already registered, or missing required fields (with the list)
|
|
80
|
+
// tasks[i].passports: each one's outcome — registered (with registryId) | rejected (problems) | not-sent
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The registry reads each passport at its address while validating it, and one bad passport rejects the whole
|
|
84
|
+
request — so passports still missing required fields are never sent. Without `wait`, follow up with
|
|
85
|
+
`dpp.tasks.refresh(collectionId, "acc", taskId)`; `dpp.tasks.list(collectionId, "acc")` lists past requests. Each
|
|
86
|
+
passport's `registration.acc` / `registration.prod` holds its status.
|
|
87
|
+
|
|
88
|
+
## Reference
|
|
89
|
+
|
|
90
|
+
| Call | Does |
|
|
91
|
+
|---|---|
|
|
92
|
+
| `dpp.groups(collectionId)` | product groups, kinds, every field and the required ones per view |
|
|
93
|
+
| `dpp.read(collectionId, id, { version? })` | the public document at its address (no sign-in) |
|
|
94
|
+
| `dpp.registry.list / get / makeKey / set / check` | the brand's registry connection |
|
|
95
|
+
| `dpp.passports.list / get / create / update / upsert / upsertMany / versions / withdraw / restore` | passports |
|
|
96
|
+
| `dpp.register(collectionId, env, ids, { wait? })` | send to the registry |
|
|
97
|
+
| `dpp.tasks.list / refresh` | registry requests and their outcomes |
|
|
98
|
+
|
|
99
|
+
Admin calls need a collection admin. Platform design: prove `server/docs/design/eu-dpp.md`.
|
package/docs/overview.md
CHANGED
|
@@ -78,6 +78,7 @@ The SmartLinks SDK (`@proveanything/smartlinks`) includes comprehensive document
|
|
|
78
78
|
| **AI Guide Template** | `docs/ai-guide-template.md` | Template for creating `public/ai-guide.md` — customise per app |
|
|
79
79
|
| **Forms** | `docs/forms.md` | Form definitions, schema-driven rendering, submission patterns |
|
|
80
80
|
| **Auth Kit** | `docs/auth-kit.md` | End-user sign-in: email/password, magic links, phone OTP, Google OAuth |
|
|
81
|
+
| **EU Digital Product Passports** | `docs/dpp.md` | Passports hosted at their own address in the EU format (public + restricted views, versions), the brand's EU registry connection, and registering them (`dpp.*`) |
|
|
81
82
|
| **Service accounts** | `docs/service-accounts.md` | Identities for other systems (an ERP, a warehouse system) to work with one collection: own key, own access level, made and removed by the collection's admins |
|
|
82
83
|
| **Members** | `docs/members.md` | Signed-in members with a level (clubs, leagues, members' areas): the level field, members-only functions, joining rules |
|
|
83
84
|
| **Portal Request Login** | `docs/portal-request-login.md` | How sub-apps ask the portal to authenticate the user; hook and iframe postMessage contracts |
|
package/docs/service-accounts.md
CHANGED
|
@@ -4,10 +4,10 @@ A **service account** is how another system works with a collection: an ERP send
|
|
|
4
4
|
warehouse system recording shipments, an agency's integration. It's an identity of its own, with its own key
|
|
5
5
|
and access level. It is **not** a person's API key.
|
|
6
6
|
|
|
7
|
-
- It's a member of **
|
|
8
|
-
like a person on the team
|
|
9
|
-
It can reach nothing else.
|
|
10
|
-
- It belongs to
|
|
7
|
+
- It's a member of its **home** collection with an access level (`User`, `Reporter`, `Assigner` or `Admin`),
|
|
8
|
+
just like a person on the team, and can **also work on** other collections, each with its own access.
|
|
9
|
+
Everything a person with that access can do on those collections, it can do. It can reach nothing else.
|
|
10
|
+
- It belongs to its home collection, not to whoever made it, so it keeps working when people leave the team.
|
|
11
11
|
- Its key (`slsvc_<id>.<secret>`) is shown **once**, when it's made or given a new key. Only a hash is kept.
|
|
12
12
|
- It **can't** invite people or change anyone's access. It can't make API keys or other service accounts,
|
|
13
13
|
make collections, or hand the collection over. A leaked key can't leave a way back in once it's deleted.
|
|
@@ -28,6 +28,27 @@ await serviceAccounts.remove(collectionId, serviceAccount.id)
|
|
|
28
28
|
|
|
29
29
|
You can't give a service account more access than you have yourself, and never `Owner`.
|
|
30
30
|
|
|
31
|
+
## More than one collection
|
|
32
|
+
|
|
33
|
+
One system working across several collections (say, a brand's three ranges) uses one service account:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// On its home collection; you must be an admin of the other collection too.
|
|
37
|
+
await serviceAccounts.addTo(collectionId, serviceAccount.id, { collectionId: otherCollectionId, access: "Reporter" })
|
|
38
|
+
await serviceAccounts.removeFrom(collectionId, serviceAccount.id, otherCollectionId)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Same key everywhere; each request names the collection it's for. Only the home collection renames it, gives
|
|
42
|
+
it a new key or deletes it (deleting removes it everywhere). The other collection lists it with
|
|
43
|
+
`home: false` and `homeCollection`, and its admins can change its access there (`update`) or take it off
|
|
44
|
+
(`remove`, which there removes it from that collection only).
|
|
45
|
+
|
|
46
|
+
## Personal API keys are different
|
|
47
|
+
|
|
48
|
+
A personal API key **is** you: everything you can do, on every collection you can, and it gains or loses
|
|
49
|
+
access as you do. Use one for your own scripts. Use a service account for another system, so it doesn't
|
|
50
|
+
depend on any one person.
|
|
51
|
+
|
|
31
52
|
## Using the key
|
|
32
53
|
|
|
33
54
|
The other system sends the key as its bearer token:
|