w-serv-orm 1.1.16 → 1.1.17

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.
@@ -0,0 +1,1622 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>Global - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
31
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WServOrm.html">WServOrm</a></li></ul><h3>Global</h3><ul><li><a href="global.html#buildBaseline">buildBaseline</a></li><li><a href="global.html#checkContract">checkContract</a></li><li><a href="global.html#compareBaseline">compareBaseline</a></li><li><a href="global.html#cyrb53">cyrb53</a></li><li><a href="global.html#digestRow">digestRow</a></li><li><a href="global.html#getRejectKey">getRejectKey</a></li><li><a href="global.html#isBaselineValid">isBaselineValid</a></li><li><a href="global.html#pickWriteRow">pickWriteRow</a></li></ul>
33
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">Global</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+
48
+ <header>
49
+
50
+ <h2>
51
+
52
+
53
+
54
+ </h2>
55
+
56
+
57
+ </header>
58
+
59
+ <article>
60
+
61
+ <div class="container-overview">
62
+
63
+
64
+
65
+ <dl class="details">
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
+ </dl>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ </div>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <h3 class="subsection-title">Methods</h3>
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <h4 class="name" id="buildBaseline"><span class="type-signature"></span>buildBaseline<span class="signature">(rows, contract)</span><span class="type-signature"> &rarr; {Array}</span></h4>
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <dl class="details">
141
+
142
+ <dt class="tag-description">Description:</dt>
143
+ <dd class="tag-description"><ul class="dummy"><li><p>建立基準: 有序之 [[id, digest], ...]</p>
144
+ <p>規則(規格 §5): 先依 contract.scope 過濾(有則只留scope回傳真值之列);主鍵依 pkOf 轉字串,同批重複或缺漏拋帶 key 為 'baselineFormat' 之Error;
145
+ 排序: 有 orderKey 依 (order數值, 主鍵碼元序),否則依主鍵碼元序,不用localeCompare;回傳陣列之序即名次: 他人重排會被偵測,系統重編號(名次不變)不會。
146
+ 逐列存檔之基準即只含該列之 [[id, digest]]。</p></li></ul></dd>
147
+
148
+
149
+
150
+ <dt class="tag-source">Source:</dt>
151
+ <dd class="tag-source"><ul class="dummy"><li>
152
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line350">line 350</a>
153
+ </li></ul></dd>
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
+ </dl>
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ <h5 class="h5-parameters">Parameters:</h5>
200
+
201
+
202
+ <table class="params">
203
+ <thead>
204
+ <tr>
205
+
206
+ <th>Name</th>
207
+
208
+
209
+ <th>Type</th>
210
+
211
+
212
+
213
+
214
+
215
+ <th class="last">Description</th>
216
+ </tr>
217
+ </thead>
218
+
219
+ <tbody>
220
+
221
+
222
+ <tr>
223
+
224
+ <td class="name"><code>rows</code></td>
225
+
226
+
227
+ <td class="type">
228
+
229
+
230
+ <span class="param-type">Array</span>
231
+
232
+
233
+
234
+
235
+ </td>
236
+
237
+
238
+
239
+
240
+
241
+ <td class="description last"><p>輸入列陣列(畫面所見之列,或伺服端新鮮讀取之列)</p></td>
242
+ </tr>
243
+
244
+
245
+
246
+ <tr>
247
+
248
+ <td class="name"><code>contract</code></td>
249
+
250
+
251
+ <td class="type">
252
+
253
+
254
+ <span class="param-type">Object</span>
255
+
256
+
257
+
258
+
259
+ </td>
260
+
261
+
262
+
263
+
264
+
265
+ <td class="description last"><p>輸入寫入契約,見checkContract</p></td>
266
+ </tr>
267
+
268
+
269
+ </tbody>
270
+ </table>
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+ <h5 class="h5-returns">Returns:</h5>
288
+
289
+
290
+ <div class="param-desc">
291
+ <p>回傳 [[id, digest], ...]</p>
292
+ </div>
293
+
294
+
295
+
296
+ <dl class="param-type">
297
+ <dt>
298
+ Type
299
+ </dt>
300
+ <dd>
301
+
302
+ <span class="param-type">Array</span>
303
+
304
+
305
+
306
+ </dd>
307
+ </dl>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+
318
+ <h4 class="name" id="checkContract"><span class="type-signature"></span>checkContract<span class="signature">(contract)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
319
+
320
+
321
+
322
+
323
+
324
+
325
+ <dl class="details">
326
+
327
+ <dt class="tag-description">Description:</dt>
328
+ <dd class="tag-description"><ul class="dummy"><li><p>驗證寫入契約(不合者拋Error,不靜默)</p>
329
+ <p>規則: 須為純物件且只含 table、pk、fields、serverOnly、orderKey、scope 六鍵;pk 為非空字串;fields 為非空且不重複之非空字串陣列;
330
+ serverOnly 若給予須為不重複之非空字串陣列且與 fields 無交集;orderKey 若給予須為非空字串,不得在 fields 內,亦不得等於 pk;scope 若給予須為函數;table 若給予須為非空字串。
331
+ 契約以讀取當下之值驗證,不快取;建議使用端於啟動時對每份契約呼叫一次。</p></li></ul></dd>
332
+
333
+
334
+
335
+ <dt class="tag-source">Source:</dt>
336
+ <dd class="tag-source"><ul class="dummy"><li>
337
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line116">line 116</a>
338
+ </li></ul></dd>
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
+ </dl>
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+ <h5 class="h5-parameters">Parameters:</h5>
385
+
386
+
387
+ <table class="params">
388
+ <thead>
389
+ <tr>
390
+
391
+ <th>Name</th>
392
+
393
+
394
+ <th>Type</th>
395
+
396
+
397
+
398
+
399
+
400
+ <th class="last">Description</th>
401
+ </tr>
402
+ </thead>
403
+
404
+ <tbody>
405
+
406
+
407
+ <tr>
408
+
409
+ <td class="name"><code>contract</code></td>
410
+
411
+
412
+ <td class="type">
413
+
414
+
415
+ <span class="param-type">Object</span>
416
+
417
+
418
+
419
+
420
+ </td>
421
+
422
+
423
+
424
+
425
+
426
+ <td class="description last"><p>輸入寫入契約</p></td>
427
+ </tr>
428
+
429
+
430
+ </tbody>
431
+ </table>
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+ <h5 class="h5-returns">Returns:</h5>
449
+
450
+
451
+ <div class="param-desc">
452
+ <p>回傳true(不合者拋Error)</p>
453
+ </div>
454
+
455
+
456
+
457
+ <dl class="param-type">
458
+ <dt>
459
+ Type
460
+ </dt>
461
+ <dd>
462
+
463
+ <span class="param-type">Boolean</span>
464
+
465
+
466
+
467
+ </dd>
468
+ </dl>
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+ <h4 class="name" id="compareBaseline"><span class="type-signature"></span>compareBaseline<span class="signature">(rowsNow, baseline, contract)</span><span class="type-signature"> &rarr; {Object}</span></h4>
480
+
481
+
482
+
483
+
484
+
485
+
486
+ <dl class="details">
487
+
488
+ <dt class="tag-description">Description:</dt>
489
+ <dd class="tag-description"><ul class="dummy"><li><p>以基準比對目前之列(伺服端於表鎖內以新鮮讀取之列呼叫)</p>
490
+ <p>回傳 { ok: true }(相符:增、刪、改、名次皆無差異),或 { ok: false, reason, added, removed, changed, reordered }:
491
+ reason 為固定英文拒收鍵,baselineFormat(基準格式或版本不識;此時 added、removed、changed 為空陣列、reordered 為 false,未比對)、
492
+ rowNotFound(基準只含一列且該列已不在目前之列、且無新增列:逐列存檔時該列已被刪)、baselineMismatch(其餘不符);
493
+ added 為基準沒有而目前有之id,removed 為基準有而目前已無之id,changed 為兩邊皆有而摘要不同之id,皆依各自陣列之序;
494
+ reordered 為布林,兩邊共有之列其相對次序不同者為true(他人重排;系統重編號而名次不變者不算)。
495
+ rowsNow 內之主鍵缺漏或重複拋 key 為 'rowsInvalid' 之Error(庫內資料異常,非客戶端之基準格式錯誤,不歸為baselineFormat),值不可摘要者拋Error;契約不合者拋Error。</p></li></ul></dd>
496
+
497
+
498
+
499
+ <dt class="tag-source">Source:</dt>
500
+ <dd class="tag-source"><ul class="dummy"><li>
501
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line442">line 442</a>
502
+ </li></ul></dd>
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
+ </dl>
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+ <h5 class="h5-parameters">Parameters:</h5>
549
+
550
+
551
+ <table class="params">
552
+ <thead>
553
+ <tr>
554
+
555
+ <th>Name</th>
556
+
557
+
558
+ <th>Type</th>
559
+
560
+
561
+
562
+
563
+
564
+ <th class="last">Description</th>
565
+ </tr>
566
+ </thead>
567
+
568
+ <tbody>
569
+
570
+
571
+ <tr>
572
+
573
+ <td class="name"><code>rowsNow</code></td>
574
+
575
+
576
+ <td class="type">
577
+
578
+
579
+ <span class="param-type">Array</span>
580
+
581
+
582
+
583
+
584
+ </td>
585
+
586
+
587
+
588
+
589
+
590
+ <td class="description last"><p>輸入目前之列(表鎖內之新鮮讀取;經ORM快取之讀取不得用)</p></td>
591
+ </tr>
592
+
593
+
594
+
595
+ <tr>
596
+
597
+ <td class="name"><code>baseline</code></td>
598
+
599
+
600
+ <td class="type">
601
+
602
+
603
+ <span class="param-type">Array</span>
604
+
605
+
606
+
607
+
608
+ </td>
609
+
610
+
611
+
612
+
613
+
614
+ <td class="description last"><p>輸入客戶端送入之基準 [[id, digest], ...]</p></td>
615
+ </tr>
616
+
617
+
618
+
619
+ <tr>
620
+
621
+ <td class="name"><code>contract</code></td>
622
+
623
+
624
+ <td class="type">
625
+
626
+
627
+ <span class="param-type">Object</span>
628
+
629
+
630
+
631
+
632
+ </td>
633
+
634
+
635
+
636
+
637
+
638
+ <td class="description last"><p>輸入寫入契約,見checkContract</p></td>
639
+ </tr>
640
+
641
+
642
+ </tbody>
643
+ </table>
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+ <h5 class="h5-returns">Returns:</h5>
661
+
662
+
663
+ <div class="param-desc">
664
+ <p>回傳比對結果</p>
665
+ </div>
666
+
667
+
668
+
669
+ <dl class="param-type">
670
+ <dt>
671
+ Type
672
+ </dt>
673
+ <dd>
674
+
675
+ <span class="param-type">Object</span>
676
+
677
+
678
+
679
+ </dd>
680
+ </dl>
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+ <h4 class="name" id="cyrb53"><span class="type-signature"></span>cyrb53<span class="signature">(str, seed<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Number}</span></h4>
692
+
693
+
694
+
695
+
696
+
697
+
698
+ <dl class="details">
699
+
700
+ <dt class="tag-description">Description:</dt>
701
+ <dd class="tag-description"><ul class="dummy"><li><p>cyrb53: 53位元非密碼學雜湊(純JS), 用途為一致性比對, 非安全邊界; 以UTF-16碼元逐一計算, 各引擎結果相同</p></li></ul></dd>
702
+
703
+
704
+
705
+ <dt class="tag-source">Source:</dt>
706
+ <dd class="tag-source"><ul class="dummy"><li>
707
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line73">line 73</a>
708
+ </li></ul></dd>
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+ </dl>
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+ <h5 class="h5-parameters">Parameters:</h5>
755
+
756
+
757
+ <table class="params">
758
+ <thead>
759
+ <tr>
760
+
761
+ <th>Name</th>
762
+
763
+
764
+ <th>Type</th>
765
+
766
+
767
+ <th>Attributes</th>
768
+
769
+
770
+
771
+ <th>Default</th>
772
+
773
+
774
+ <th class="last">Description</th>
775
+ </tr>
776
+ </thead>
777
+
778
+ <tbody>
779
+
780
+
781
+ <tr>
782
+
783
+ <td class="name"><code>str</code></td>
784
+
785
+
786
+ <td class="type">
787
+
788
+
789
+ <span class="param-type">String</span>
790
+
791
+
792
+
793
+
794
+ </td>
795
+
796
+
797
+ <td class="attributes">
798
+
799
+
800
+
801
+
802
+
803
+ </td>
804
+
805
+
806
+
807
+ <td class="default">
808
+
809
+ </td>
810
+
811
+
812
+ <td class="description last"><p>輸入字串</p></td>
813
+ </tr>
814
+
815
+
816
+
817
+ <tr>
818
+
819
+ <td class="name"><code>seed</code></td>
820
+
821
+
822
+ <td class="type">
823
+
824
+
825
+ <span class="param-type">Number</span>
826
+
827
+
828
+
829
+
830
+ </td>
831
+
832
+
833
+ <td class="attributes">
834
+
835
+ &lt;optional><br>
836
+
837
+
838
+
839
+
840
+
841
+ </td>
842
+
843
+
844
+
845
+ <td class="default">
846
+
847
+ <code>0</code>
848
+
849
+ </td>
850
+
851
+
852
+ <td class="description last"><p>輸入種子整數,預設0</p></td>
853
+ </tr>
854
+
855
+
856
+ </tbody>
857
+ </table>
858
+
859
+
860
+
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+ <h5 class="h5-returns">Returns:</h5>
875
+
876
+
877
+ <div class="param-desc">
878
+ <p>回傳0至2^53-1之整數</p>
879
+ </div>
880
+
881
+
882
+
883
+ <dl class="param-type">
884
+ <dt>
885
+ Type
886
+ </dt>
887
+ <dd>
888
+
889
+ <span class="param-type">Number</span>
890
+
891
+
892
+
893
+ </dd>
894
+ </dl>
895
+
896
+
897
+
898
+
899
+
900
+
901
+
902
+
903
+
904
+
905
+ <h4 class="name" id="digestRow"><span class="type-signature"></span>digestRow<span class="signature">(row, contract)</span><span class="type-signature"> &rarr; {String}</span></h4>
906
+
907
+
908
+
909
+
910
+
911
+
912
+ <dl class="details">
913
+
914
+ <dt class="tag-description">Description:</dt>
915
+ <dd class="tag-description"><ul class="dummy"><li><p>計算單列摘要(版本h1)</p>
916
+ <p>規則(規格 §5): 取 contract.fields 依宣告之序(orderKey與serverOnly不入);每值正規化後以JSON陣列序列化,取cyrb53,回傳 'h1:' + 14位16進位(補零)。
917
+ 欄位頂層之 undefined、null、'' 為同一空值(含缺欄);Date 轉ISO字串;BigInt 轉十進位字串;物件鍵遞迴排序(UTF-16碼元序),陣列保序;數字與字串不互轉(1 與 '1' 不同);
918
+ 巢狀值只依JSON語意(物件鍵之值為undefined者略去,陣列之undefined元素為null,巢狀之null與''不等價);
919
+ 其餘非JSON值(function、symbol、NaN、±Infinity、無效Date、Map、Set、RegExp、類別實例等)與超過深度100或單列節點10萬者拋Error,不靜默略過;列本身須為一般物件(陣列、Map、Set、Date等拋Error)。</p></li></ul></dd>
920
+
921
+
922
+
923
+ <dt class="tag-source">Source:</dt>
924
+ <dd class="tag-source"><ul class="dummy"><li>
925
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line291">line 291</a>
926
+ </li></ul></dd>
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+ </dl>
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+ <h5 class="h5-parameters">Parameters:</h5>
973
+
974
+
975
+ <table class="params">
976
+ <thead>
977
+ <tr>
978
+
979
+ <th>Name</th>
980
+
981
+
982
+ <th>Type</th>
983
+
984
+
985
+
986
+
987
+
988
+ <th class="last">Description</th>
989
+ </tr>
990
+ </thead>
991
+
992
+ <tbody>
993
+
994
+
995
+ <tr>
996
+
997
+ <td class="name"><code>row</code></td>
998
+
999
+
1000
+ <td class="type">
1001
+
1002
+
1003
+ <span class="param-type">Object</span>
1004
+
1005
+
1006
+
1007
+
1008
+ </td>
1009
+
1010
+
1011
+
1012
+
1013
+
1014
+ <td class="description last"><p>輸入列物件(只讀自有屬性,不執行原型上之getter)</p></td>
1015
+ </tr>
1016
+
1017
+
1018
+
1019
+ <tr>
1020
+
1021
+ <td class="name"><code>contract</code></td>
1022
+
1023
+
1024
+ <td class="type">
1025
+
1026
+
1027
+ <span class="param-type">Object</span>
1028
+
1029
+
1030
+
1031
+
1032
+ </td>
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+ <td class="description last"><p>輸入寫入契約,見checkContract</p></td>
1039
+ </tr>
1040
+
1041
+
1042
+ </tbody>
1043
+ </table>
1044
+
1045
+
1046
+
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+
1054
+
1055
+
1056
+
1057
+
1058
+
1059
+
1060
+ <h5 class="h5-returns">Returns:</h5>
1061
+
1062
+
1063
+ <div class="param-desc">
1064
+ <p>回傳摘要字串,如 'h1:0123456789abcd'</p>
1065
+ </div>
1066
+
1067
+
1068
+
1069
+ <dl class="param-type">
1070
+ <dt>
1071
+ Type
1072
+ </dt>
1073
+ <dd>
1074
+
1075
+ <span class="param-type">String</span>
1076
+
1077
+
1078
+
1079
+ </dd>
1080
+ </dl>
1081
+
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+ <h4 class="name" id="getRejectKey"><span class="type-signature"></span>getRejectKey<span class="signature">(err)</span><span class="type-signature"> &rarr; {String|null}</span></h4>
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+ <dl class="details">
1099
+
1100
+ <dt class="tag-description">Description:</dt>
1101
+ <dd class="tag-description"><ul class="dummy"><li><p>取得拒收鍵: 同時處理 procOrm 之字串 reject(如 'rowNotFound')與 guardWrite 之 Error reject(帶 key)</p></li></ul></dd>
1102
+
1103
+
1104
+
1105
+ <dt class="tag-source">Source:</dt>
1106
+ <dd class="tag-source"><ul class="dummy"><li>
1107
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line541">line 541</a>
1108
+ </li></ul></dd>
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+ </dl>
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1148
+
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+ <h5 class="h5-parameters">Parameters:</h5>
1155
+
1156
+
1157
+ <table class="params">
1158
+ <thead>
1159
+ <tr>
1160
+
1161
+ <th>Name</th>
1162
+
1163
+
1164
+ <th>Type</th>
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+ <th class="last">Description</th>
1171
+ </tr>
1172
+ </thead>
1173
+
1174
+ <tbody>
1175
+
1176
+
1177
+ <tr>
1178
+
1179
+ <td class="name"><code>err</code></td>
1180
+
1181
+
1182
+ <td class="type">
1183
+
1184
+
1185
+ <span class="param-type">*</span>
1186
+
1187
+
1188
+
1189
+
1190
+ </td>
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+ <td class="description last"><p>輸入被 reject 之值</p></td>
1197
+ </tr>
1198
+
1199
+
1200
+ </tbody>
1201
+ </table>
1202
+
1203
+
1204
+
1205
+
1206
+
1207
+
1208
+
1209
+
1210
+
1211
+
1212
+
1213
+
1214
+
1215
+
1216
+
1217
+
1218
+ <h5 class="h5-returns">Returns:</h5>
1219
+
1220
+
1221
+ <div class="param-desc">
1222
+ <p>回傳拒收鍵字串; 不是字串亦無字串 key 者(如一般例外)回 null</p>
1223
+ </div>
1224
+
1225
+
1226
+
1227
+ <dl class="param-type">
1228
+ <dt>
1229
+ Type
1230
+ </dt>
1231
+ <dd>
1232
+
1233
+ <span class="param-type">String</span>
1234
+ |
1235
+
1236
+ <span class="param-type">null</span>
1237
+
1238
+
1239
+
1240
+ </dd>
1241
+ </dl>
1242
+
1243
+
1244
+
1245
+
1246
+
1247
+
1248
+
1249
+
1250
+
1251
+
1252
+ <h4 class="name" id="isBaselineValid"><span class="type-signature"></span>isBaselineValid<span class="signature">(baseline)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
1253
+
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+ <dl class="details">
1260
+
1261
+ <dt class="tag-description">Description:</dt>
1262
+ <dd class="tag-description"><ul class="dummy"><li><p>判斷基準格式是否合法(含版本)</p>
1263
+ <p>合法: 陣列,每項為長度2之陣列 [非空字串id, 摘要字串],摘要須為本模組已知版本之格式('h1:'加14位小寫16進位),id不得重複;空陣列合法(空表)。
1264
+ 不識之格式或版本一律不合法,使用端不得降級為不帶基準。</p></li></ul></dd>
1265
+
1266
+
1267
+
1268
+ <dt class="tag-source">Source:</dt>
1269
+ <dd class="tag-source"><ul class="dummy"><li>
1270
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line407">line 407</a>
1271
+ </li></ul></dd>
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+ </dl>
1304
+
1305
+
1306
+
1307
+
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+ <h5 class="h5-parameters">Parameters:</h5>
1318
+
1319
+
1320
+ <table class="params">
1321
+ <thead>
1322
+ <tr>
1323
+
1324
+ <th>Name</th>
1325
+
1326
+
1327
+ <th>Type</th>
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+ <th class="last">Description</th>
1334
+ </tr>
1335
+ </thead>
1336
+
1337
+ <tbody>
1338
+
1339
+
1340
+ <tr>
1341
+
1342
+ <td class="name"><code>baseline</code></td>
1343
+
1344
+
1345
+ <td class="type">
1346
+
1347
+
1348
+ <span class="param-type">*</span>
1349
+
1350
+
1351
+
1352
+
1353
+ </td>
1354
+
1355
+
1356
+
1357
+
1358
+
1359
+ <td class="description last"><p>輸入客戶端送入之基準</p></td>
1360
+ </tr>
1361
+
1362
+
1363
+ </tbody>
1364
+ </table>
1365
+
1366
+
1367
+
1368
+
1369
+
1370
+
1371
+
1372
+
1373
+
1374
+
1375
+
1376
+
1377
+
1378
+
1379
+
1380
+
1381
+ <h5 class="h5-returns">Returns:</h5>
1382
+
1383
+
1384
+ <div class="param-desc">
1385
+ <p>回傳是否合法</p>
1386
+ </div>
1387
+
1388
+
1389
+
1390
+ <dl class="param-type">
1391
+ <dt>
1392
+ Type
1393
+ </dt>
1394
+ <dd>
1395
+
1396
+ <span class="param-type">Boolean</span>
1397
+
1398
+
1399
+
1400
+ </dd>
1401
+ </dl>
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+ <h4 class="name" id="pickWriteRow"><span class="type-signature"></span>pickWriteRow<span class="signature">(row, contract)</span><span class="type-signature"> &rarr; {Object}</span></h4>
1413
+
1414
+
1415
+
1416
+
1417
+
1418
+
1419
+ <dl class="details">
1420
+
1421
+ <dt class="tag-description">Description:</dt>
1422
+ <dd class="tag-description"><ul class="dummy"><li><p>取得寫入列(存檔採用客戶端值之欄位白名單): 只含 contract.pk 與 contract.fields 內且列上自有、值非undefined之欄位</p>
1423
+ <p>規格 §4、V5: 伺服器專有欄位(serverOnly)與系統欄位存檔不採用客戶端值; 客戶端若持舊列(含舊之伺服器專有欄位值)整列送出,
1424
+ 寫入前須經此白名單,否則會把系統已改之值回寫成舊值。未列入 fields 者(含 orderKey)不輸出, 由使用端自行補(如依列序重編之 order)。
1425
+ 回傳新物件(淺複製, 巢狀值為同一參考; 寫入 ORM 時 ORM 自行複製)。</p></li></ul></dd>
1426
+
1427
+
1428
+
1429
+ <dt class="tag-source">Source:</dt>
1430
+ <dd class="tag-source"><ul class="dummy"><li>
1431
+ <a href="baseline.mjs.html">baseline.mjs</a>, <a href="baseline.mjs.html#line517">line 517</a>
1432
+ </li></ul></dd>
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+
1457
+
1458
+
1459
+
1460
+
1461
+
1462
+
1463
+
1464
+ </dl>
1465
+
1466
+
1467
+
1468
+
1469
+
1470
+
1471
+
1472
+
1473
+
1474
+
1475
+
1476
+
1477
+
1478
+ <h5 class="h5-parameters">Parameters:</h5>
1479
+
1480
+
1481
+ <table class="params">
1482
+ <thead>
1483
+ <tr>
1484
+
1485
+ <th>Name</th>
1486
+
1487
+
1488
+ <th>Type</th>
1489
+
1490
+
1491
+
1492
+
1493
+
1494
+ <th class="last">Description</th>
1495
+ </tr>
1496
+ </thead>
1497
+
1498
+ <tbody>
1499
+
1500
+
1501
+ <tr>
1502
+
1503
+ <td class="name"><code>row</code></td>
1504
+
1505
+
1506
+ <td class="type">
1507
+
1508
+
1509
+ <span class="param-type">Object</span>
1510
+
1511
+
1512
+
1513
+
1514
+ </td>
1515
+
1516
+
1517
+
1518
+
1519
+
1520
+ <td class="description last"><p>輸入列物件</p></td>
1521
+ </tr>
1522
+
1523
+
1524
+
1525
+ <tr>
1526
+
1527
+ <td class="name"><code>contract</code></td>
1528
+
1529
+
1530
+ <td class="type">
1531
+
1532
+
1533
+ <span class="param-type">Object</span>
1534
+
1535
+
1536
+
1537
+
1538
+ </td>
1539
+
1540
+
1541
+
1542
+
1543
+
1544
+ <td class="description last"><p>輸入寫入契約,見checkContract</p></td>
1545
+ </tr>
1546
+
1547
+
1548
+ </tbody>
1549
+ </table>
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+
1561
+
1562
+
1563
+
1564
+
1565
+
1566
+ <h5 class="h5-returns">Returns:</h5>
1567
+
1568
+
1569
+ <div class="param-desc">
1570
+ <p>回傳只含白名單欄位之新物件</p>
1571
+ </div>
1572
+
1573
+
1574
+
1575
+ <dl class="param-type">
1576
+ <dt>
1577
+ Type
1578
+ </dt>
1579
+ <dd>
1580
+
1581
+ <span class="param-type">Object</span>
1582
+
1583
+
1584
+
1585
+ </dd>
1586
+ </dl>
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1598
+ </article>
1599
+
1600
+ </section>
1601
+
1602
+
1603
+
1604
+
1605
+
1606
+
1607
+ </div>
1608
+
1609
+ <br class="clear">
1610
+
1611
+ <footer>
1612
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri Oct 23 2026 00:29:00 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1613
+ </footer>
1614
+
1615
+ <script>prettyPrint();</script>
1616
+ <script src="scripts/polyfill.js"></script>
1617
+ <script src="scripts/linenumber.js"></script>
1618
+
1619
+
1620
+
1621
+ </body>
1622
+ </html>