-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCIMMY.Schemas.html
556 lines (331 loc) · 21.8 KB
/
SCIMMY.Schemas.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Namespace: SCIMMY.Schemas - SCIMMY</title>
<script src="static/classy.js"></script>
<script src="static/highlight/highlight.min.js"></script>
<script src="static/highlight/langs/javascript.min.js"></script>
<script src="static/highlight/langs/json.min.js"></script>
<link type="text/css" rel="stylesheet" href="static/highlight/highlight.min.css">
<link type="text/css" rel="stylesheet" href="static/classy.css">
<link rel="icon" type="image/svg+xml" href="static/assets/icon.svg" />
</head>
<body>
<header class="page-header">
<h1 class="package-details">
<a class="package-name" href="./">
<img alt="SCIMMY" src="static/assets/logo.svg" />
</a>
<span class="package-version">
<span class="type-signature">1.3.5</span>
</span>
</h1>
<h2 class="page-title">Namespace: <span class="ancestors"><a href="index.html">SCIMMY</a>.</span>Schemas</h2>
<div class="page-links">
<a href="https://github.com/scimmyjs/scimmy" title="View Source on GitHub">
<img alt="View Source on GitHub" src="static/assets/github.png" />
</a>
<div class="page-nav-toggle">
<input type="checkbox" name="tiny-page-nav-toggle" id="tiny-page-nav-toggle" autocomplete="off"/>
<label for="tiny-page-nav-toggle">
<span></span>
<span></span>
<span></span>
</label>
</div>
</div>
</header>
<nav class="page-nav">
<label class="hidden" for="tiny-page-nav"></label>
<input class="hidden tiny-page-nav-target" type="checkbox" id="tiny-page-nav" autocomplete="off"/>
<div class="nav-content">
<h3>API</h3><ul class="active"><li><h4><a href="SCIMMY.Config.html">Config</a></h4></li><li><details><summary><h4><a href="SCIMMY.Messages.html">Messages</a></h4></summary><ul><li><a href="SCIMMY.Messages.BulkRequest.html">BulkRequest</a></li><li><a href="SCIMMY.Messages.BulkResponse.html">BulkResponse</a></li><li><a href="SCIMMY.Messages.ErrorResponse.html">ErrorResponse</a></li><li><a href="SCIMMY.Messages.ListResponse.html">ListResponse</a></li><li><a href="SCIMMY.Messages.PatchOp.html">PatchOp</a></li><li><a href="SCIMMY.Messages.SearchRequest.html">SearchRequest</a></li></ul></details></li><li><details><summary><h4><a href="SCIMMY.Resources.html">Resources</a></h4></summary><ul><li><a href="SCIMMY.Resources.Group.html">Group</a></li><li><a href="SCIMMY.Resources.ResourceType.html">ResourceType</a></li><li><a href="SCIMMY.Resources.Schema.html">Schema</a></li><li><a href="SCIMMY.Resources.ServiceProviderConfig.html">ServiceProviderConfig</a></li><li><a href="SCIMMY.Resources.User.html">User</a></li></ul></details></li><li class="active"><details class="active" open="open"><summary class="active"><h4 class="active"><a href="SCIMMY.Schemas.html" class="active">Schemas</a></h4></summary><ul><li><a href="SCIMMY.Schemas.EnterpriseUser.html">EnterpriseUser</a></li><li><a href="SCIMMY.Schemas.Group.html">Group</a></li><li><a href="SCIMMY.Schemas.ResourceType.html">ResourceType</a></li><li><a href="SCIMMY.Schemas.ServiceProviderConfig.html">ServiceProviderConfig</a></li><li><a href="SCIMMY.Schemas.User.html">User</a></li></ul></details></li><li><details><summary><h4><a href="SCIMMY.Types.html">Types</a></h4></summary><ul><li><a href="SCIMMY.Types.Attribute.html">Attribute</a></li><li><a href="SCIMMY.Types.SchemaDefinition.html">SchemaDefinition</a></li><li><a href="SCIMMY.Types.Error.html">Error</a></li><li><a href="SCIMMY.Types.Filter.html">Filter</a></li><li><a href="SCIMMY.Types.Resource.html">Resource</a></li><li><a href="SCIMMY.Types.Schema.html">Schema</a></li></ul></details></li></ul>
</div>
</nav>
<main id="main">
<article class="content-container class-definition">
<header class="section-header">
<h2 class="page-title subsection-title">Namespace: <span class="ancestors"><a href="index.html">SCIMMY</a>.</span>Schemas</h2>
<h2 class="class-title hidden">Namespace: SCIMMY.Schemas</h2>
</header>
<section id="description" class="container-overview">
<header>
<h3 class="hidden">Description</h3>
</header>
<div class="description"><p>SCIMMY provides a singleton class, <code>SCIMMY.Schemas</code>, that is used to declare schema definitions implemented by a SCIM Service Provider.
It also provides access to supplied implementations of core resource type schema definitions.
It is also used to retrieve a service provider's declared schema definitions to be sent via the Schemas HTTP endpoint.</p>
<blockquote>
<p><strong>Note:</strong><br>
The <code>SCIMMY.Schemas</code> class is a singleton, which means that declared schema definitions
will remain the same, regardless of where the class is accessed from within your code.</p>
</blockquote>
<h2 id="declaring-definitions">Declaring Definitions</h2>
<p>Schema definitions are typically declared automatically at the same time as resource type instances are declared in <code><a href="SCIMMY.Resources.html">SCIMMY.Resources</a></code>.
If necessary, schema definitions can be declared manually with the <code><a href="SCIMMY.Schemas.html#.declare">SCIMMY.Schemas.declare</a></code> method.
Nested definitions that extend declared schema definitions are also automatically declared to the <code>SCIMMY.Schemas</code> class.</p>
<pre class="prettyprint source"><code>// Manually declare the EnterpriseUser schema definition
SCIMMY.Schemas.declare(SCIMMY.Schemas.EnterpriseUser.definition);
</code></pre>
<p>Once declared, schema definitions are made available to the <code><a href="SCIMMY.Resources.Schema.html">SCIMMY.Resources.Schema</a></code>
resource type, which handles formatting them for transmission/consumption according to the Schema Definition schema
set out in <a href="https://datatracker.ietf.org/doc/html/rfc7643#section-7">RFC7643§7</a>.</p>
<p>Each schema definition must be declared with a unique name, and each name can only be declared once.
Attempting to declare a new schema definition with a name that has already been declared will throw a TypeError with the
message <code>"Schema definition '<name>' already declared with id '<id>'"</code>, where <code><name></code> and <code><id></code> are the name and id,
respectively, of the existing schema definition.</p>
<p>Similarly, each schema definition can only be declared under one name.
Attempting to declare an existing schema definition under a new name will throw a TypeError with the message
<code>"Schema definition '<id>' already declared with name '<name>'"</code>, where <code><id></code> and <code><name></code> are the id and name,
respectively, of the existing schema definition.</p>
<pre class="prettyprint source"><code>// Declaring a schema definition under a different name
let definition = new SCIMMY.Types.SchemaDefinition("User", "urn:ietf:params:scim:schemas:MyOrg:CustomUser", "MyOrg Custom User");
SCIMMY.Schemas.declare(definition, "CustomUser");
</code></pre>
<h2 id="modifying-definitions">Modifying Definitions</h2>
<p>Not all SCIM clients and service providers support every attribute defined in the SCIM core schemas,
and conversely, some custom attributes may not be defined in the core schemas. In such situations,
it is possible to modify schema definitions using their <code><a href="SCIMMY.Types.SchemaDefinition.html#extend">extend</a></code>
and <code><a href="SCIMMY.Types.SchemaDefinition.html#truncate">truncate</a></code> instance methods.</p>
<blockquote>
<p><strong>Note:</strong><br>
Like the <code>SCIMMY.Schemas</code> class, the schema implementations included in this class are all singletons,
and any changes to their schema definitions will persist across any location they are accessed.</p>
</blockquote>
<pre class="prettyprint source"><code>// Remove unsupported "name" sub-attributes from the User schema definition
SCIMMY.Schemas.User.definition.truncate(["name.middleName", "name.honorificPrefix", "name.honorificSuffix"]);
// Remove unsupported "ims" attribute and its sub-attributes from the User schema
SCIMMY.Schemas.User.definition.truncate(["ims"]);
// Add custom "mail" attribute to the Group schema definition
SCIMMY.Schemas.Group.definition.extend([new SCIMMY.Types.Attribute("string", "mail", {required: true})]);
// Extend the User schema definition with the EnterpriseUser schema definition, and make it required
SCIMMY.Schemas.User.definition.extend(SCIMMY.Schemas.EnterpriseUser.definition, true);
// Remove the EnterpriseUser extension schema definition from the User schema definition
SCIMMY.Schemas.User.definition.truncate(SCIMMY.Schemas.EnterpriseUser.definition);
</code></pre></div>
</section>
<section id="usage" class="class-usage">
<h3 class="subsection-title">Usage</h3>
<section id="details" class="details">
<dl class="details-list">
<div class="detail tag-kind">
<dt>Kind:</dt>
<dd><span class="signature type-signature">singleton</span></dd>
</div>
<div class="detail tag-source">
<dt>Source:</dt>
<dd><a href="https://github.com/scimmyjs/scimmy/blob/ea53d92787d2a5db844c7699a7aeb4c1eafa13a7/src/lib/schemas.js#L11">src/lib/schemas.js, line 11</a></dd>
</div>
</dl>
</section>
</section>
<section id="classes" class="child-classes">
<h3 class="subsection-title">Classes</h3>
<ul class="subsection-list">
<li>
<div class="name">
<code><a href="SCIMMY.Schemas.EnterpriseUser.html">SCIMMY.Schemas.EnterpriseUser</a></code>
</div>
<ul>
<li>Ensures an EnterpriseUser instance conforms to the EnterpriseUser schema extension set out in <a href="https://datatracker.ietf.org/doc/html/rfc7643#section-4.3">RFC7643§4.3</a>.</li>
<li>Can be used directly, but is typically used to extend the <code>SCIMMY.Schemas.User</code> schema definition.</li>
</ul>
</li>
<li>
<div class="name">
<code><a href="SCIMMY.Schemas.Group.html">SCIMMY.Schemas.Group</a></code>
</div>
<ul>
<li>Ensures a Group instance conforms to the Group schema set out in <a href="https://datatracker.ietf.org/doc/html/rfc7643#section-4.2">RFC7643§4.2</a>.</li>
</ul>
</li>
<li>
<div class="name">
<code><a href="SCIMMY.Schemas.ResourceType.html">SCIMMY.Schemas.ResourceType</a></code>
</div>
<ul>
<li>Ensures a ResourceType instance conforms to the ResourceType schema set out in <a href="https://datatracker.ietf.org/doc/html/rfc7643#section-6">RFC7643§6</a>.</li>
</ul>
</li>
<li>
<div class="name">
<code><a href="SCIMMY.Schemas.ServiceProviderConfig.html">SCIMMY.Schemas.ServiceProviderConfig</a></code>
</div>
<ul>
<li>Ensures a ServiceProviderConfig instance conforms to the Service Provider Configuration schema set out in <a href="https://datatracker.ietf.org/doc/html/rfc7643#section-5">RFC7643§5</a>.</li>
</ul>
</li>
<li>
<div class="name">
<code><a href="SCIMMY.Schemas.User.html">SCIMMY.Schemas.User</a></code>
</div>
<ul>
<li>Ensures a User instance conforms to the User schema set out in <a href="https://datatracker.ietf.org/doc/html/rfc7643#section-4.1">RFC7643§4.1</a>.</li>
</ul>
</li>
</ul>
</section>
<section id="methods" class="child-methods">
<h3 class="subsection-title">Methods</h3>
<div class="subsection-content">
<article id=".declare">
<header>
<h4 class="name"><span class="type-signature">(static) </span>declare<span class="signature">(definition, name<span class="signature-attributes">opt</span>)</span><span class="type-signature returns"> → {<a href="SCIMMY.Schemas.html">SCIMMY.Schemas</a>}</span></h4>
<div class="description"><p>Register a SchemaDefinition implementation for exposure via Schemas HTTP endpoint</p></div>
</header>
<section class="details">
<dl class="details-list">
<div class="detail tag-source">
<dt>Source:</dt>
<dd><a href="https://github.com/scimmyjs/scimmy/blob/ea53d92787d2a5db844c7699a7aeb4c1eafa13a7/src/lib/schemas.js#L105">src/lib/schemas.js, line 105</a></dd>
</div>
</dl>
</section>
<section class="params">
<h5 class="subsection-title">Parameters:</h5>
<div class="subsection-content">
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name">
<code>
definition<span class="signature-attributes"></span>
</code>
</td>
<td class="type">
<span class="param">
<code>
<span class="param-type"><a href="SCIMMY.Types.SchemaDefinition.html">SCIMMY.Types.SchemaDefinition</a></span>
</code>
</span>
</td>
<td class="description last">
<p>the schema definition to register</p>
</td>
</tr>
<tr>
<td class="name">
<code>
name<span class="signature-attributes">opt</span>
</code>
</td>
<td class="type">
<span class="param">
<code>
<span class="param-type">String</span>
</code>
</span>
</td>
<td class="description last">
<p>the name of the definition being declared, if different from definition's name property</p>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="returns">
<h5 class="subsection-title">Returns:</h5>
<div class="param-desc"><p>the Schemas class for chaining</p></div>
<div class="detail tag-type">
<dt>Type:</dt>
<dd><span class="signature type-signature">{<span class="param-type"><a href="SCIMMY.Schemas.html">SCIMMY.Schemas</a></span>}</span></dd>
</div>
</section>
</article><article id=".declared">
<header>
<h4 class="name"><span class="type-signature">(static) </span>declared<span class="signature">(definition<span class="signature-attributes">opt</span>)</span><span class="type-signature returns"> → {<a href="SCIMMY.Types.SchemaDefinition.html">SCIMMY.Types.SchemaDefinition</a>[]|<a href="SCIMMY.Types.SchemaDefinition.html">SCIMMY.Types.SchemaDefinition</a>|Boolean}</span></h4>
<div class="description"><p>Get declaration status of specific schema definition, or get all declared schema definitions</p></div>
</header>
<section class="details">
<dl class="details-list">
<div class="detail tag-source">
<dt>Source:</dt>
<dd><a href="https://github.com/scimmyjs/scimmy/blob/ea53d92787d2a5db844c7699a7aeb4c1eafa13a7/src/lib/schemas.js#L154">src/lib/schemas.js, line 154</a></dd>
</div>
</dl>
</section>
<section class="params">
<h5 class="subsection-title">Parameters:</h5>
<div class="subsection-content">
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name">
<code>
definition<span class="signature-attributes">opt</span>
</code>
</td>
<td class="type">
<span class="param">
<code>
<span class="param-type"><a href="SCIMMY.Types.SchemaDefinition.html">SCIMMY.Types.SchemaDefinition</a></span>
</code><code>
<span class="param-type">String</span>
</code>
</span>
</td>
<td class="description last">
<p>the schema definition or name to query declaration status for</p>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="returns">
<h5 class="subsection-title">Returns:</h5>
<div class="param-desc"><ul>
<li>Array containing declared schema definitions for exposure via Schemas HTTP endpoint, if no arguments are supplied.</li>
<li>The declared schema definition with matching name or ID, or undefined, if a string argument is supplied.</li>
<li>The declaration status of the specified schema definition, if a class extending <code>SCIMMY.Types.SchemaDefinition</code> was supplied.</li>
</ul></div>
<div class="detail tag-type">
<dt>Type:</dt>
<dd><span class="signature type-signature">{<span class="param-type"><a href="SCIMMY.Types.SchemaDefinition.html">SCIMMY.Types.SchemaDefinition</a>[]</span><span class="param-join">|</span><span class="param-type"><a href="SCIMMY.Types.SchemaDefinition.html">SCIMMY.Types.SchemaDefinition</a></span><span class="param-join">|</span><span class="param-type">Boolean</span>}</span></dd>
</div>
</section>
</article>
</div>
</section>
</article>
<aside class="content-aside">
<div class="toc toc-tiny">
<h2 class="page-title">Namespace: <span class="ancestors"><a href="index.html">SCIMMY</a>.</span>Schemas</h2>
<details class="toc-container">
<summary class="toc-title">Table of Contents</summary>
<nav class="toc-content"><ul><li><h5 class="toc-section"><a href="#description">Description</a></h5><ul class="no-indent"><li><a href="#declaring-definitions">Declaring Definitions</a></li><li><a href="#modifying-definitions">Modifying Definitions</a></li></ul></li><li><h5 class="toc-section"><a href="#usage">Usage</a></h5><ul><li><a href="#details">Details</a></li></ul></li><li><h5 class="toc-section"><a href="#classes">Classes</a></h5></li><li><h5 class="toc-section"><a href="#methods">Methods</a></h5><ul><li><a href="#.declare"><span class="type-signature">(static) </span>declare</a></li><li><a href="#.declared"><span class="type-signature">(static) </span>declared</a></li></ul></li></ul></nav>
</details>
</div>
<div class="toc toc-regular">
<nav class="toc-container">
<h5 class="toc-title">Table of Contents</h5>
<div class="toc-content"><ul><li><h5 class="toc-section"><a href="#description">Description</a></h5><ul class="no-indent"><li><a href="#declaring-definitions">Declaring Definitions</a></li><li><a href="#modifying-definitions">Modifying Definitions</a></li></ul></li><li><h5 class="toc-section"><a href="#usage">Usage</a></h5><ul><li><a href="#details">Details</a></li></ul></li><li><h5 class="toc-section"><a href="#classes">Classes</a></h5></li><li><h5 class="toc-section"><a href="#methods">Methods</a></h5><ul><li><a href="#.declare"><span class="type-signature">(static) </span>declare</a></li><li><a href="#.declared"><span class="type-signature">(static) </span>declared</a></li></ul></li></ul></div>
</nav>
</div>
</aside>
<footer>
Generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a>
using <a href="https://github.com/sleelin/classy-template">classy-template</a>
<span class="creation-timestamp">2025-03-05T04:14:54.691Z</span>
</footer>
</main>
<script>hljs.highlightAll();</script>
</body>
</html>