@timeback/clr 0.1.0
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/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/constants.d.ts +30 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +1703 -0
- package/dist/factory.d.ts +38 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.d.ts +589 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16884 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/resolve.d.ts +21 -0
- package/dist/lib/resolve.d.ts.map +1 -0
- package/dist/lib/transport.d.ts +21 -0
- package/dist/lib/transport.d.ts.map +1 -0
- package/dist/public-types.d.ts +376 -0
- package/dist/public-types.d.ts.map +1 -0
- package/dist/public-types.js +0 -0
- package/dist/resources/credentials.d.ts +54 -0
- package/dist/resources/credentials.d.ts.map +1 -0
- package/dist/resources/discovery.d.ts +41 -0
- package/dist/resources/discovery.d.ts.map +1 -0
- package/dist/resources/index.d.ts +6 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/types/client.d.ts +48 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Resolution
|
|
3
|
+
*
|
|
4
|
+
* CLR-specific wrapper around the generic provider resolver.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
import type { ProviderRegistry } from '@timeback/internal-client-infra';
|
|
9
|
+
import type { ClrClientConfig, ClrResolvedProvider } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Resolve CLR client config to a TimebackProvider.
|
|
12
|
+
*
|
|
13
|
+
* @param config - Client configuration
|
|
14
|
+
* @param registry - Provider registry for platform/env resolution
|
|
15
|
+
* @returns Resolved provider or transport
|
|
16
|
+
* @throws {Error} If configuration is invalid or incomplete
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveToProvider(config: ClrClientConfig, registry?: ProviderRegistry): ClrResolvedProvider;
|
|
21
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/lib/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEpE;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,eAAe,EACvB,QAAQ,GAAE,gBAA4C,GACpD,mBAAmB,CAMrB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport Layer
|
|
3
|
+
*
|
|
4
|
+
* HTTP transport for CLR API communication.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseTransport } from '@timeback/internal-client-infra';
|
|
7
|
+
import type { ClrPaths } from '@timeback/internal-client-infra';
|
|
8
|
+
import type { ClrTransportConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* HTTP transport layer for CLR API communication.
|
|
11
|
+
*
|
|
12
|
+
* CLR uses the IMS Global error format, which is handled by the
|
|
13
|
+
* base transport's built-in IMS error parsing. No custom pagination
|
|
14
|
+
* is needed since CLR endpoints don't return paginated results.
|
|
15
|
+
*/
|
|
16
|
+
export declare class Transport extends BaseTransport {
|
|
17
|
+
/** API path profiles for CLR operations */
|
|
18
|
+
readonly paths: ClrPaths;
|
|
19
|
+
constructor(config: ClrTransportConfig);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/lib/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAI/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAElD;;;;;;GAMG;AACH,qBAAa,SAAU,SAAQ,aAAa;IAC3C,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;IAExB,YAAY,MAAM,EAAE,kBAAkB,EAGrC;CACD"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLR Credential Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the Comprehensive Learner Record (CLR) v2.0 Verifiable Credential model.
|
|
5
|
+
* Based on the IMS Global CLR v2.0 specification.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
9
|
+
// ENUMS
|
|
10
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Types of achievements that can be represented in a CLR credential.
|
|
14
|
+
*
|
|
15
|
+
* Defined by the IMS Global CLR v2.0 specification.
|
|
16
|
+
* Custom extensions are supported via the `ext:` prefix.
|
|
17
|
+
*/
|
|
18
|
+
type AchievementType =
|
|
19
|
+
| 'Achievement'
|
|
20
|
+
| 'ApprenticeshipCertificate'
|
|
21
|
+
| 'Assessment'
|
|
22
|
+
| 'Assignment'
|
|
23
|
+
| 'AssociateDegree'
|
|
24
|
+
| 'Award'
|
|
25
|
+
| 'Badge'
|
|
26
|
+
| 'BachelorDegree'
|
|
27
|
+
| 'Certificate'
|
|
28
|
+
| 'CertificateOfCompletion'
|
|
29
|
+
| 'Certification'
|
|
30
|
+
| 'CommunityService'
|
|
31
|
+
| 'Competency'
|
|
32
|
+
| 'Course'
|
|
33
|
+
| 'CoCurricular'
|
|
34
|
+
| 'Degree'
|
|
35
|
+
| 'Diploma'
|
|
36
|
+
| 'DoctoralDegree'
|
|
37
|
+
| 'Fieldwork'
|
|
38
|
+
| 'GeneralEducationDevelopment'
|
|
39
|
+
| 'JourneymanCertificate'
|
|
40
|
+
| 'LearningProgram'
|
|
41
|
+
| 'License'
|
|
42
|
+
| 'Membership'
|
|
43
|
+
| 'ProfessionalDoctorate'
|
|
44
|
+
| 'QualityAssuranceCredential'
|
|
45
|
+
| 'MasterCertificate'
|
|
46
|
+
| 'MasterDegree'
|
|
47
|
+
| 'MicroCredential'
|
|
48
|
+
| 'ResearchDoctorate'
|
|
49
|
+
| 'SecondarySchoolDiploma'
|
|
50
|
+
| (string & {})
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Types of associations between achievements or credentials.
|
|
54
|
+
*/
|
|
55
|
+
type AssociationType =
|
|
56
|
+
| 'exactMatchOf'
|
|
57
|
+
| 'isChildOf'
|
|
58
|
+
| 'isParentOf'
|
|
59
|
+
| 'isPartOf'
|
|
60
|
+
| 'isPeerOf'
|
|
61
|
+
| 'isRelatedTo'
|
|
62
|
+
| 'precedes'
|
|
63
|
+
| 'replacedBy'
|
|
64
|
+
|
|
65
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
66
|
+
// SHARED TYPES
|
|
67
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Image reference following the IMS Global Image model.
|
|
71
|
+
*/
|
|
72
|
+
interface ClrImage {
|
|
73
|
+
/** The URI or Data URI of the image. */
|
|
74
|
+
id: string
|
|
75
|
+
/** MUST be the IRI 'Image'. */
|
|
76
|
+
type: 'Image'
|
|
77
|
+
/** The caption for the image. */
|
|
78
|
+
caption?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Profile representing an issuer or creator of a credential.
|
|
83
|
+
*
|
|
84
|
+
* Used for both the top-level issuer and achievement creators.
|
|
85
|
+
*/
|
|
86
|
+
interface ClrProfile {
|
|
87
|
+
/** URI identifier for the profile. */
|
|
88
|
+
id: string
|
|
89
|
+
/** Type identifiers (e.g., ['Profile']). */
|
|
90
|
+
type: string[]
|
|
91
|
+
/** Display name of the profile. */
|
|
92
|
+
name?: string
|
|
93
|
+
/** URL of the profile's website. */
|
|
94
|
+
url?: string
|
|
95
|
+
/** Phone number for the profile. */
|
|
96
|
+
phone?: string
|
|
97
|
+
/** Description of the profile. */
|
|
98
|
+
description?: string
|
|
99
|
+
/** Image associated with the profile. */
|
|
100
|
+
image?: ClrImage
|
|
101
|
+
/** Email address for the profile. */
|
|
102
|
+
email?: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Cryptographic proof ensuring credential integrity and authenticity.
|
|
107
|
+
*
|
|
108
|
+
* Supports DataIntegrityProof, JsonWebSignature2020, and other proof types.
|
|
109
|
+
*/
|
|
110
|
+
interface ClrProof {
|
|
111
|
+
/** The proof type (e.g., 'DataIntegrityProof', 'JsonWebSignature2020'). */
|
|
112
|
+
type: string
|
|
113
|
+
/** The purpose of the proof (e.g., 'assertionMethod'). */
|
|
114
|
+
proofPurpose: string
|
|
115
|
+
/** URI of the verification method used to create the proof. */
|
|
116
|
+
verificationMethod: string
|
|
117
|
+
/** ISO 8601 datetime when the proof was created. */
|
|
118
|
+
created: string
|
|
119
|
+
/** The proof value (e.g., base64-encoded signature). */
|
|
120
|
+
proofValue: string
|
|
121
|
+
/** The cryptographic suite used (e.g., 'eddsa-rdfc-2022'). */
|
|
122
|
+
cryptosuite?: string
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Schema reference for validating credentials.
|
|
127
|
+
*/
|
|
128
|
+
interface ClrCredentialSchema {
|
|
129
|
+
/** URI of the credential schema. */
|
|
130
|
+
id: string
|
|
131
|
+
/** Schema validator type. */
|
|
132
|
+
type: '1EdTechJsonSchemaValidator2019'
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
136
|
+
// ACHIEVEMENT TYPES
|
|
137
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Criteria for earning an achievement.
|
|
141
|
+
*/
|
|
142
|
+
interface AchievementCriteria {
|
|
143
|
+
/** The URI of a webpage that describes the criteria. */
|
|
144
|
+
id?: string
|
|
145
|
+
/** A narrative of what is needed to earn the achievement. */
|
|
146
|
+
narrative?: string
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* An achievement that a learner has earned.
|
|
151
|
+
*
|
|
152
|
+
* Represents a competency, course completion, badge, or other accomplishment.
|
|
153
|
+
*/
|
|
154
|
+
interface Achievement {
|
|
155
|
+
/** URI identifier for the achievement. */
|
|
156
|
+
id: string
|
|
157
|
+
/** Type identifiers (e.g., ['Achievement']). */
|
|
158
|
+
type: string[]
|
|
159
|
+
/** Display name of the achievement. */
|
|
160
|
+
name: string
|
|
161
|
+
/** Description of the achievement. */
|
|
162
|
+
description: string
|
|
163
|
+
/** Criteria for earning the achievement. */
|
|
164
|
+
criteria: AchievementCriteria
|
|
165
|
+
/** Image associated with the achievement. */
|
|
166
|
+
image?: ClrImage
|
|
167
|
+
/** Classification of the achievement. */
|
|
168
|
+
achievementType?: AchievementType
|
|
169
|
+
/** The profile of the entity that created the achievement. */
|
|
170
|
+
creator?: ClrProfile
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
174
|
+
// IDENTITY TYPES
|
|
175
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Identity object for the credential subject.
|
|
179
|
+
*
|
|
180
|
+
* Used to identify the learner, optionally with hashed identity for privacy.
|
|
181
|
+
*/
|
|
182
|
+
interface IdentityObject {
|
|
183
|
+
/** MUST be 'IdentityObject'. */
|
|
184
|
+
type: 'IdentityObject'
|
|
185
|
+
/** The identity hash (or plain value if not hashed). */
|
|
186
|
+
identityHash: string
|
|
187
|
+
/** The type of identity (e.g., 'emailAddress', 'sourcedId'). */
|
|
188
|
+
identityType: string
|
|
189
|
+
/** Whether the identityHash is hashed. */
|
|
190
|
+
hashed: boolean
|
|
191
|
+
/** Salt used for hashing, if applicable. */
|
|
192
|
+
salt?: string
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
196
|
+
// ASSOCIATION TYPES
|
|
197
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Association between two achievements or credentials.
|
|
201
|
+
*/
|
|
202
|
+
interface Association {
|
|
203
|
+
/** MUST be 'Association'. */
|
|
204
|
+
type: 'Association'
|
|
205
|
+
/** The type of association. */
|
|
206
|
+
associationType: AssociationType
|
|
207
|
+
/** URI of the source entity. */
|
|
208
|
+
sourceId: string
|
|
209
|
+
/** URI of the target entity. */
|
|
210
|
+
targetId: string
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
214
|
+
// VERIFIABLE CREDENTIAL (NESTED)
|
|
215
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Credential subject for a nested verifiable credential.
|
|
219
|
+
*/
|
|
220
|
+
interface NestedCredentialSubject {
|
|
221
|
+
/** URI identifier for the subject. */
|
|
222
|
+
id?: string
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A verifiable credential nested within a CLR.
|
|
227
|
+
*
|
|
228
|
+
* Represents individual assertions (e.g., AchievementCredentials,
|
|
229
|
+
* OpenBadgeCredentials) packaged inside the CLR.
|
|
230
|
+
*/
|
|
231
|
+
interface VerifiableCredential {
|
|
232
|
+
/** JSON-LD context URIs. */
|
|
233
|
+
'@context': string[]
|
|
234
|
+
/** URI identifier for the credential. */
|
|
235
|
+
id: string
|
|
236
|
+
/** Type identifiers (e.g., ['VerifiableCredential', 'AchievementCredential']). */
|
|
237
|
+
type: string[]
|
|
238
|
+
/** The issuer of this credential. */
|
|
239
|
+
issuer: ClrProfile
|
|
240
|
+
/** ISO 8601 datetime from which the credential is valid. */
|
|
241
|
+
validFrom: string
|
|
242
|
+
/** ISO 8601 datetime until which the credential is valid. */
|
|
243
|
+
validUntil?: string
|
|
244
|
+
/** The subject of the credential. */
|
|
245
|
+
credentialSubject: NestedCredentialSubject
|
|
246
|
+
/** Cryptographic proofs for this credential. */
|
|
247
|
+
proof?: ClrProof[]
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
251
|
+
// CREDENTIAL SUBJECT
|
|
252
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The subject of a CLR credential.
|
|
256
|
+
*
|
|
257
|
+
* Contains the learner's identity, achievements, nested credentials,
|
|
258
|
+
* and associations between them.
|
|
259
|
+
*/
|
|
260
|
+
interface ClrCredentialSubject {
|
|
261
|
+
/** URI identifier for the credential subject (the learner). */
|
|
262
|
+
id?: string
|
|
263
|
+
/** Type identifiers (e.g., ['ClrSubject']). */
|
|
264
|
+
type: string[]
|
|
265
|
+
/** Identity objects for the learner. */
|
|
266
|
+
identifier?: IdentityObject[]
|
|
267
|
+
/** Achievements earned by the learner. */
|
|
268
|
+
achievement?: Achievement[]
|
|
269
|
+
/** Individual verifiable credentials packaged in the CLR. */
|
|
270
|
+
verifiableCredential: VerifiableCredential[]
|
|
271
|
+
/** Associations between achievements or credentials. */
|
|
272
|
+
association?: Association[]
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
276
|
+
// CLR CREDENTIAL
|
|
277
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* A Comprehensive Learner Record (CLR) v2.0 Verifiable Credential.
|
|
281
|
+
*
|
|
282
|
+
* The top-level data structure representing a learner's full set of
|
|
283
|
+
* achievements issued by one or more learning providers. The platform
|
|
284
|
+
* acts as the publisher, digitally signing the CLR to ensure authenticity.
|
|
285
|
+
*
|
|
286
|
+
* Required fields for upsert: `@context`, `id`, `type`, `issuer`, `name`,
|
|
287
|
+
* `validFrom`, `credentialSubject`.
|
|
288
|
+
*/
|
|
289
|
+
interface ClrCredential {
|
|
290
|
+
/** JSON-LD context URIs. */
|
|
291
|
+
'@context': string[]
|
|
292
|
+
/** URI identifier for the CLR credential. */
|
|
293
|
+
id: string
|
|
294
|
+
/** Type identifiers (e.g., ['VerifiableCredential', 'ClrCredential']). */
|
|
295
|
+
type: string[]
|
|
296
|
+
/** The issuer (publisher) of the CLR. */
|
|
297
|
+
issuer: ClrProfile
|
|
298
|
+
/** Display name of the CLR. */
|
|
299
|
+
name: string
|
|
300
|
+
/** Description of the CLR. */
|
|
301
|
+
description?: string
|
|
302
|
+
/** ISO 8601 datetime from which the CLR is valid. */
|
|
303
|
+
validFrom: string
|
|
304
|
+
/** ISO 8601 datetime until which the CLR is valid. */
|
|
305
|
+
validUntil?: string
|
|
306
|
+
/** The learner and their achievements/credentials. */
|
|
307
|
+
credentialSubject: ClrCredentialSubject
|
|
308
|
+
/** Cryptographic proofs added by the platform. */
|
|
309
|
+
proof?: ClrProof[]
|
|
310
|
+
/** Schema references for credential validation. */
|
|
311
|
+
credentialSchema?: ClrCredentialSchema[]
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* CLR Discovery Types
|
|
316
|
+
*
|
|
317
|
+
* Types for the CLR v2.0 API discovery endpoint.
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Response from the CLR discovery endpoint.
|
|
322
|
+
*
|
|
323
|
+
* Returns the OpenAPI 3.0 specification for the CLR v2.0 API,
|
|
324
|
+
* including available endpoints, OAuth2 flows, and supported scopes.
|
|
325
|
+
* This is a public endpoint (no auth required).
|
|
326
|
+
*/
|
|
327
|
+
type DiscoveryResponse = Record<string, unknown>
|
|
328
|
+
|
|
329
|
+
type output<T> = T extends {
|
|
330
|
+
_zod: {
|
|
331
|
+
output: any;
|
|
332
|
+
};
|
|
333
|
+
} ? T["_zod"]["output"] : unknown;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* CLR Schemas
|
|
337
|
+
*
|
|
338
|
+
* Zod schemas for the CLR (Comprehensive Learner Record) v2.0 API.
|
|
339
|
+
*/
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
344
|
+
// CLR CREDENTIAL (TOP-LEVEL)
|
|
345
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Schema for upserting a CLR credential.
|
|
349
|
+
*
|
|
350
|
+
* Validates the required structure per the CLR v2.0 specification:
|
|
351
|
+
* - `@context`: non-empty array of JSON-LD context URIs
|
|
352
|
+
* - `id`: credential URI
|
|
353
|
+
* - `type`: non-empty array of type identifiers
|
|
354
|
+
* - `issuer`: profile with required `id` and `type`
|
|
355
|
+
* - `name`: display name
|
|
356
|
+
* - `validFrom`: ISO datetime string
|
|
357
|
+
* - `credentialSubject`: must include `type` and at least one `verifiableCredential`
|
|
358
|
+
*/
|
|
359
|
+
declare const ClrCredentialInput = z.object({
|
|
360
|
+
'@context': NonEmptyStringArray,
|
|
361
|
+
id: NonEmptyString,
|
|
362
|
+
type: NonEmptyStringArray,
|
|
363
|
+
issuer: ClrProfileSchema,
|
|
364
|
+
name: NonEmptyString,
|
|
365
|
+
description: z.string().optional(),
|
|
366
|
+
validFrom: NonEmptyString,
|
|
367
|
+
validUntil: z.string().optional(),
|
|
368
|
+
credentialSubject: ClrCredentialSubjectSchema,
|
|
369
|
+
proof: z.array(ClrProofSchema).optional(),
|
|
370
|
+
credentialSchema: z.array(ClrCredentialSchemaSchema).optional(),
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
type ClrCredentialInput = output<typeof ClrCredentialInput>
|
|
374
|
+
|
|
375
|
+
export { ClrCredentialInput };
|
|
376
|
+
export type { Achievement, AchievementCriteria, AchievementType, Association, AssociationType, ClrCredential, ClrCredentialSchema, ClrCredentialSubject, ClrImage, ClrProfile, ClrProof, DiscoveryResponse, IdentityObject, NestedCredentialSubject, VerifiableCredential };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-types.d.ts","sourceRoot":"","sources":["../src/public-types.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAE7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials Resource
|
|
3
|
+
*
|
|
4
|
+
* Manage CLR (Comprehensive Learner Record) credentials.
|
|
5
|
+
*/
|
|
6
|
+
import type { ClrCredential, ClrTransportLike } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Credentials resource for CLR credential management.
|
|
9
|
+
*
|
|
10
|
+
* Provides the ability to upsert verifiable CLR credentials.
|
|
11
|
+
* The platform acts as the publisher, digitally signing credentials
|
|
12
|
+
* to ensure their authenticity and integrity.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CredentialsResource {
|
|
15
|
+
private readonly transport;
|
|
16
|
+
constructor(transport: ClrTransportLike);
|
|
17
|
+
/**
|
|
18
|
+
* Upsert a Comprehensive Learner Record (CLR) credential.
|
|
19
|
+
*
|
|
20
|
+
* Creates a new credential or updates an existing one based on the credential ID.
|
|
21
|
+
* The platform will digitally sign the credential, adding a cryptographic proof
|
|
22
|
+
* to ensure authenticity.
|
|
23
|
+
*
|
|
24
|
+
* @param credential - The CLR credential to upsert
|
|
25
|
+
* @returns The upserted credential with platform-added proof
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const result = await client.credentials.upsert({
|
|
30
|
+
* '@context': [
|
|
31
|
+
* 'https://www.w3.org/ns/credentials/v2',
|
|
32
|
+
* 'https://purl.imsglobal.org/spec/clr/v2p0/context-2.0.1',
|
|
33
|
+
* ],
|
|
34
|
+
* id: 'urn:uuid:example-clr-id',
|
|
35
|
+
* type: ['VerifiableCredential', 'ClrCredential'],
|
|
36
|
+
* issuer: {
|
|
37
|
+
* id: 'https://example.edu',
|
|
38
|
+
* type: ['Profile'],
|
|
39
|
+
* name: 'Example University',
|
|
40
|
+
* },
|
|
41
|
+
* name: 'Student Transcript',
|
|
42
|
+
* validFrom: '2024-01-01T00:00:00Z',
|
|
43
|
+
* credentialSubject: {
|
|
44
|
+
* type: ['ClrSubject'],
|
|
45
|
+
* verifiableCredential: [
|
|
46
|
+
* // nested credentials...
|
|
47
|
+
* ],
|
|
48
|
+
* },
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
upsert(credential: ClrCredential): Promise<ClrCredential>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/resources/credentials.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE/D;;;;;;GAMG;AACH,qBAAa,mBAAmB;IACnB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,gBAAgB,EAAI;IAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAWxD;CACD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery Resource
|
|
3
|
+
*
|
|
4
|
+
* CLR v2.0 API discovery endpoint.
|
|
5
|
+
*/
|
|
6
|
+
import type { ClrTransportLike, DiscoveryResponse } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Discovery resource for CLR API capabilities.
|
|
9
|
+
*
|
|
10
|
+
* Provides access to the CLR v2.0 API discovery endpoint,
|
|
11
|
+
* which returns the OpenAPI specification including available
|
|
12
|
+
* endpoints, OAuth2 flows, and supported scopes.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: The CLR v2.0 spec declares this endpoint as public (`security: []`),
|
|
15
|
+
* but the BeyondAI implementation enforces OAuth authentication. This client
|
|
16
|
+
* sends credentials on all requests, so this is handled transparently.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DiscoveryResource {
|
|
19
|
+
private readonly transport;
|
|
20
|
+
constructor(transport: ClrTransportLike);
|
|
21
|
+
/**
|
|
22
|
+
* Get CLR v2.0 API discovery information.
|
|
23
|
+
*
|
|
24
|
+
* Returns the OpenAPI 3.0 specification for the CLR v2.0 API,
|
|
25
|
+
* allowing clients to dynamically discover the service's capabilities.
|
|
26
|
+
*
|
|
27
|
+
* NOTE: Despite the spec declaring this as a public endpoint, the
|
|
28
|
+
* BeyondAI API requires authentication. An authenticated transport
|
|
29
|
+
* is required.
|
|
30
|
+
*
|
|
31
|
+
* @returns Discovery information (OpenAPI spec object)
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const discovery = await client.discovery.get()
|
|
36
|
+
* console.log(discovery) // OpenAPI 3.0 spec
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
get(): Promise<DiscoveryResponse>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/resources/discovery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEnE;;;;;;;;;;GAUG;AACH,qBAAa,iBAAiB;IACjB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,gBAAgB,EAAI;IAE5D;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAIhC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
import type { ClientConfig, ClrPaths, ProviderClientConfig, RequestOptions, ResolvedProvider, TransportConfigWithTokenProvider, TransportOnlyConfig } from '@timeback/internal-client-infra';
|
|
5
|
+
/**
|
|
6
|
+
* Re-export vital config types for SDK users.
|
|
7
|
+
*/
|
|
8
|
+
export type { Environment, EnvAuth, ExplicitAuth, Platform } from '@timeback/internal-client-infra';
|
|
9
|
+
/**
|
|
10
|
+
* Transport interface for CLR client.
|
|
11
|
+
*
|
|
12
|
+
* Extends base transport requirements with CLR-specific paths.
|
|
13
|
+
* Required when using transport mode with ClrClient.
|
|
14
|
+
*/
|
|
15
|
+
export interface ClrTransportLike {
|
|
16
|
+
/** Base URL of the API */
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
/** API path profiles for CLR operations */
|
|
19
|
+
paths: ClrPaths;
|
|
20
|
+
/** Make an authenticated request */
|
|
21
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* All supported CLR client configuration types.
|
|
25
|
+
*
|
|
26
|
+
* Supports four modes:
|
|
27
|
+
* - **Provider mode**: `{ provider: TimebackProvider }` — pre-built provider with token sharing
|
|
28
|
+
* - **Environment mode**: `{ platform?, env, auth }` — Timeback hosted APIs
|
|
29
|
+
* - **Explicit mode**: `{ baseUrl, auth: { authUrl } }` — custom API URLs
|
|
30
|
+
* - **Transport mode**: `{ transport }` — custom transport with paths
|
|
31
|
+
*/
|
|
32
|
+
export type ClrClientConfig = ClientConfig | TransportOnlyConfig<ClrTransportLike> | ProviderClientConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Configuration for CLR transport.
|
|
35
|
+
*/
|
|
36
|
+
export interface ClrTransportConfig extends TransportConfigWithTokenProvider {
|
|
37
|
+
/** API path profiles for CLR operations */
|
|
38
|
+
paths: ClrPaths;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolved provider type for CLR client.
|
|
42
|
+
*/
|
|
43
|
+
export type ClrResolvedProvider = ResolvedProvider<ClrTransportLike>;
|
|
44
|
+
/**
|
|
45
|
+
* Instance type of ClrClient.
|
|
46
|
+
*/
|
|
47
|
+
export type ClrClientInstance = InstanceType<typeof import('../client').ClrClient>;
|
|
48
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,gCAAgC,EAChC,mBAAmB,EACnB,MAAM,iCAAiC,CAAA;AAExC;;GAEG;AACH,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAEnG;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,KAAK,EAAE,QAAQ,CAAA;IACf,oCAAoC;IACpC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAC9D;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACxB,YAAY,GACZ,mBAAmB,CAAC,gBAAgB,CAAC,GACrC,oBAAoB,CAAA;AAEvB;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gCAAgC;IAC3E,2CAA2C;IAC3C,KAAK,EAAE,QAAQ,CAAA;CACf;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;AAEpE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,cAAc,WAAW,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,UAAU,CAAA;AAExB,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,eAAe,CAAA"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Functions
|
|
3
|
+
*
|
|
4
|
+
* Internal utilities for the CLR client.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Scoped logger for the CLR client.
|
|
8
|
+
* Only logs debug/info when DEBUG=1 or DEBUG=true.
|
|
9
|
+
*/
|
|
10
|
+
export declare const log: import("@timeback/internal-logger").Logger;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,eAAO,MAAM,GAAG,4CAA4B,CAAA"}
|