proskomma-core 0.9.10 → 0.9.13

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.
Files changed (136) hide show
  1. package/.eslintrc.json +79 -0
  2. package/.gitattributes +2 -0
  3. package/docs/_config.yml +1 -0
  4. package/docs/index.md +3 -0
  5. package/docs/pk_edit_0_9.odt +0 -0
  6. package/docs/pk_edit_0_9.pdf +0 -0
  7. package/docs/proskomma_101_slideshow.odp +0 -0
  8. package/docs/proskomma_101_slideshow.pdf +0 -0
  9. package/docs/proskomma_edit_html.png +0 -0
  10. package/docs/proskomma_edit_html.svg +451 -0
  11. package/docs/proskomma_edit_reference.png +0 -0
  12. package/docs/proskomma_edit_reference.svg +349 -0
  13. package/docs/repo_logo.png +0 -0
  14. package/esm/package.json +3 -0
  15. package/esm/wrapper.mjs +5 -0
  16. package/index.cjs +6 -0
  17. package/package.json +18 -15
  18. package/src/graph/index.cjs +201 -0
  19. package/src/graph/lib/do_cv.cjs +249 -0
  20. package/src/graph/lib/dump.cjs +40 -0
  21. package/src/graph/lib/remake_blocks.cjs +57 -0
  22. package/src/graph/lib/sequence_chars.cjs +84 -0
  23. package/src/graph/lib/sort.cjs +39 -0
  24. package/src/graph/lib/tribos.cjs +97 -0
  25. package/src/graph/lib/tribos_expression.cjs +556 -0
  26. package/src/graph/lib/tribos_ohm_UNUSED.cjs +37 -0
  27. package/src/graph/lib/tribos_step.cjs +434 -0
  28. package/src/graph/mutations/add.cjs +91 -0
  29. package/src/graph/mutations/delete.cjs +61 -0
  30. package/src/graph/mutations/index.cjs +54 -0
  31. package/src/graph/mutations/rehash.cjs +17 -0
  32. package/src/graph/mutations/tags.cjs +120 -0
  33. package/src/graph/mutations/update.cjs +210 -0
  34. package/src/graph/mutations/versification.cjs +96 -0
  35. package/src/graph/queries/block.cjs +228 -0
  36. package/src/graph/queries/cIndex.cjs +87 -0
  37. package/src/graph/queries/cell.cjs +42 -0
  38. package/src/graph/queries/cv.cjs +19 -0
  39. package/src/graph/queries/cvBook.cjs +16 -0
  40. package/src/graph/queries/cvChapter.cjs +16 -0
  41. package/src/graph/queries/cvIndex.cjs +47 -0
  42. package/src/graph/queries/cvNavigation.cjs +116 -0
  43. package/src/graph/queries/cvVerseElement.cjs +84 -0
  44. package/src/graph/queries/cvVerses.cjs +14 -0
  45. package/src/graph/queries/doc_set.cjs +220 -0
  46. package/src/graph/queries/document.cjs +555 -0
  47. package/src/graph/queries/idParts.cjs +30 -0
  48. package/src/graph/queries/index.cjs +151 -0
  49. package/src/graph/queries/inputBlockSpec.cjs +17 -0
  50. package/src/graph/queries/inputItemObject.cjs +12 -0
  51. package/src/graph/queries/input_att_spec.cjs +14 -0
  52. package/src/graph/queries/input_key_matches.cjs +11 -0
  53. package/src/graph/queries/input_key_value.cjs +11 -0
  54. package/src/graph/queries/input_key_values.cjs +11 -0
  55. package/src/graph/queries/input_selector_spec.cjs +19 -0
  56. package/src/graph/queries/item.cjs +71 -0
  57. package/src/graph/queries/itemGroup.cjs +75 -0
  58. package/src/graph/queries/key_value.cjs +18 -0
  59. package/src/graph/queries/kv_entry.cjs +21 -0
  60. package/src/graph/queries/kv_sequence.cjs +151 -0
  61. package/src/graph/queries/node.cjs +44 -0
  62. package/src/graph/queries/orig.cjs +11 -0
  63. package/src/graph/queries/regex_index.cjs +18 -0
  64. package/src/graph/queries/row_equals_spec.cjs +11 -0
  65. package/src/graph/queries/row_match_spec.cjs +11 -0
  66. package/src/graph/queries/selector_spec.cjs +29 -0
  67. package/src/graph/queries/sequence.cjs +314 -0
  68. package/src/graph/queries/table_sequence.cjs +192 -0
  69. package/src/graph/queries/tree_sequence.cjs +58 -0
  70. package/src/graph/queries/verseNumber.cjs +44 -0
  71. package/src/graph/queries/verseRange.cjs +11 -0
  72. package/src/graph/queries/versification.cjs +25 -0
  73. package/src/index.cjs +583 -0
  74. package/src/model/doc_set.cjs +389 -0
  75. package/src/model/doc_set_helpers/block.cjs +232 -0
  76. package/src/model/doc_set_helpers/enum.cjs +87 -0
  77. package/src/model/doc_set_helpers/item.cjs +198 -0
  78. package/src/model/doc_set_helpers/rehash.cjs +53 -0
  79. package/src/model/doc_set_helpers/selectors.cjs +58 -0
  80. package/src/model/doc_set_helpers/serialize.cjs +22 -0
  81. package/src/model/doc_set_helpers/unsuccinctify.cjs +288 -0
  82. package/src/model/doc_set_helpers/update.cjs +290 -0
  83. package/src/model/document.cjs +369 -0
  84. package/src/model/document_helpers/blocks.cjs +135 -0
  85. package/src/model/document_helpers/chapter_verse.cjs +291 -0
  86. package/src/model/document_helpers/pre_enums.cjs +67 -0
  87. package/src/model/document_helpers/sequences.cjs +205 -0
  88. package/src/model/document_helpers/serialize_succinct.cjs +55 -0
  89. package/src/model/document_helpers/succinct_filter.cjs +102 -0
  90. package/src/model/versifications/eng_vrs.cjs +455 -0
  91. package/src/model/versifications/index.cjs +38 -0
  92. package/src/model/versifications/lxx_vrs.cjs +950 -0
  93. package/src/model/versifications/org_vrs.cjs +155 -0
  94. package/src/model/versifications/rsc_vrs.cjs +342 -0
  95. package/src/model/versifications/rso_vrs.cjs +541 -0
  96. package/src/model/versifications/vul_vrs.cjs +835 -0
  97. package/src/parser/index.cjs +506 -0
  98. package/src/parser/lexers/index.cjs +11 -0
  99. package/src/parser/lexers/lexingRegexes.cjs +45 -0
  100. package/src/parser/lexers/nodes.cjs +123 -0
  101. package/src/parser/lexers/object_for_fragment.cjs +123 -0
  102. package/src/parser/lexers/tsv.cjs +45 -0
  103. package/src/parser/lexers/usfm.cjs +17 -0
  104. package/src/parser/lexers/usx/index.cjs +7 -0
  105. package/src/parser/lexers/usx/usx_lexer.cjs +321 -0
  106. package/src/parser/lib/tokenize.cjs +37 -0
  107. package/src/parser/model/index.cjs +637 -0
  108. package/src/parser/parser_specs.cjs +781 -0
  109. package/src/pipelines/perf2x/index.cjs +7 -0
  110. package/src/pipelines/perf2x/perf2PkJsonPipeline.json +41 -0
  111. package/src/pipelines/perf2x/perf2usfmPipeline.json +65 -0
  112. package/src/transforms/calculateUsfmChapterPositions.cjs +106 -0
  113. package/src/transforms/index.cjs +9 -0
  114. package/src/transforms/perf2PkJson.cjs +534 -0
  115. package/src/transforms/perf2usfm.cjs +294 -0
  116. package/src/util/byteArray.cjs +251 -0
  117. package/src/util/canons.cjs +117 -0
  118. package/src/util/enums.cjs +41 -0
  119. package/src/util/generateId.cjs +6 -0
  120. package/src/util/graftDefs.cjs +15 -0
  121. package/src/util/index.cjs +29 -0
  122. package/src/util/inspectSuccinct.cjs +59 -0
  123. package/src/util/itemDefs.cjs +33 -0
  124. package/src/util/parserConstantDefs.cjs +30 -0
  125. package/src/util/scopeDefs.cjs +173 -0
  126. package/src/util/scriptlike/blocksSpec.cjs +192 -0
  127. package/src/util/scriptlike/dodson_lexicon.xsl +19 -0
  128. package/src/util/scriptlike/dodson_lexicon_to_entries.cjs +85 -0
  129. package/src/util/scriptlike/open_scriptures_hebrew_lexicon.xsl +28 -0
  130. package/src/util/scriptlike/open_scriptures_hebrew_lexicon_to_entries.cjs +85 -0
  131. package/src/util/succinct.cjs +159 -0
  132. package/src/util/tags.cjs +28 -0
  133. package/src/util/tokenDefs.cjs +27 -0
  134. package/src/util/versification.cjs +364 -0
  135. package/dist/index.js +0 -8
  136. package/dist/index.js.LICENSE.txt +0 -23
@@ -0,0 +1,534 @@
1
+ const { PerfRenderFromJson } = require('proskomma-json-tools');
2
+ const xre = require('xregexp');
3
+ const { lexingRegexes } = require('../parser/lexers/lexingRegexes.cjs');
4
+
5
+ const wordLikeRegex = lexingRegexes.filter(r => r[1] === 'wordLike')[0][2];
6
+ const lineSpaceRegex = lexingRegexes.filter(r => r[1] === 'lineSpace')[0][2];
7
+ const punctuationRegex = lexingRegexes.filter(r => r[1] === 'punctuation')[0][2];
8
+
9
+ const closeAllOpenScopes = workspace => {
10
+ [...workspace.os]
11
+ .reverse()
12
+ .forEach(o => {
13
+ workspace.block.items.push({
14
+ type: 'scope',
15
+ subType: 'end',
16
+ payload: o,
17
+ },
18
+ );
19
+ },
20
+ );
21
+ workspace.os = [];
22
+ };
23
+
24
+ const closeParagraphScopes = workspace => {
25
+ [...workspace.os.filter(o => ['span'].includes(o.split('/')[1]))]
26
+ .reverse()
27
+ .forEach(o => {
28
+ workspace.block.items.push({
29
+ type: 'scope',
30
+ subType: 'end',
31
+ payload: o,
32
+ });
33
+ workspace.os = [...workspace.os.filter(wo => wo !== o)];
34
+ },
35
+ );
36
+ };
37
+
38
+ const closeVerseScopes = workspace => {
39
+ [...workspace.os.filter(o => ['verse', 'verses'].includes(o.split('/')[0]))]
40
+ .reverse()
41
+ .forEach(o => {
42
+ workspace.block.items.push({
43
+ type: 'scope',
44
+ subType: 'end',
45
+ payload: o,
46
+ });
47
+ workspace.os = [...workspace.os.filter(wo => wo !== o)];
48
+ },
49
+ );
50
+ };
51
+
52
+ const closeChapterScopes = workspace => {
53
+ [...workspace.os.filter(o => ['chapter'].includes(o.split('/')[0]))]
54
+ .reverse()
55
+ .forEach(o => {
56
+ workspace.block.items.push({
57
+ type: 'scope',
58
+ subType: 'end',
59
+ payload: o,
60
+ });
61
+ workspace.os = [...workspace.os.filter(wo => wo !== o)];
62
+ },
63
+ );
64
+ };
65
+
66
+ const perf2PkJsonActions = {
67
+
68
+ startDocument: [
69
+ {
70
+ description: 'Set up word object',
71
+ test: () => true,
72
+ action: ({
73
+ workspace,
74
+ output,
75
+ }) => {
76
+ output.pkJson = {};
77
+ workspace.sequenceId = null;
78
+ workspace.block = null;
79
+ workspace.os = [];
80
+ workspace.waitingBlockGrafts = [];
81
+ },
82
+ },
83
+ ],
84
+
85
+ startSequence: [
86
+ {
87
+ description: 'Add sequence array to output',
88
+ test: () => true,
89
+ action: (environment) => {
90
+ environment.output.pkJson[environment.context.sequences[0].id] = [];
91
+ environment.workspace.sequenceId = environment.context.sequences[0].id;
92
+ },
93
+ },
94
+ ],
95
+
96
+ endSequence: [
97
+ {
98
+ description: 'Reset sequenceId pointer',
99
+ test: () => true,
100
+ action: (environment) => {
101
+ closeAllOpenScopes(environment.workspace);
102
+ environment.workspace.sequenceId = environment.context.sequences[1]?.id;
103
+ },
104
+ },
105
+ ],
106
+
107
+ unresolvedBlockGraft: [
108
+ {
109
+ description: 'Stash for next para',
110
+ test: () => true,
111
+ action: ({
112
+ context,
113
+ workspace,
114
+ }) => {
115
+ const target = context.sequences[0].block.target;
116
+
117
+ if (target) {
118
+ workspace.waitingBlockGrafts.push({
119
+ type: 'graft',
120
+ subType: context.sequences[0].block.subType,
121
+ payload: context.sequences[0].block.target,
122
+ });
123
+ }
124
+ },
125
+ },
126
+ ],
127
+
128
+ unresolvedInlineGraft: [
129
+ {
130
+ description: 'Follow inline grafts',
131
+ test: () => true,
132
+ action: ({
133
+ context,
134
+ workspace,
135
+ }) => {
136
+ const target = context.sequences[0].element.target;
137
+
138
+ if (target) {
139
+ workspace.block.items.push({
140
+ type: 'graft',
141
+ subType: context.sequences[0].element.subType,
142
+ payload: context.sequences[0].element.target,
143
+ });
144
+ }
145
+ },
146
+ },
147
+ ],
148
+
149
+ startParagraph: [
150
+ {
151
+ description: 'Add object for paragraph block',
152
+ test: () => true,
153
+ action: ({
154
+ context,
155
+ workspace,
156
+ output,
157
+ }) => {
158
+ workspace.block = {
159
+ os: [...workspace.os],
160
+ is: [],
161
+ bs: {
162
+ type: 'scope',
163
+ subType: 'start',
164
+ payload: `blockTag/${context.sequences[0].block.subType.split(':')[1]}`,
165
+ },
166
+ bg: [...workspace.waitingBlockGrafts],
167
+ items: [],
168
+ };
169
+ output.pkJson[workspace.sequenceId].push(workspace.block);
170
+ },
171
+ },
172
+ ],
173
+ endParagraph: [
174
+ {
175
+ description: 'Close open scopes',
176
+ test: () => true,
177
+ action: ({ workspace }) => {
178
+ closeParagraphScopes(workspace);
179
+ workspace.waitingBlockGrafts = [];
180
+ },
181
+ },
182
+ ],
183
+ mark: [
184
+ {
185
+ description: 'ts mark as milestone',
186
+ test: ({ context }) => ['usfm:ts'].includes(context.sequences[0].element.subType),
187
+ action: ({ workspace }) => {
188
+ const milestoneScope = `milestone/ts`;
189
+
190
+ if (!workspace.block.is.includes(milestoneScope)) {
191
+ workspace.block.is.push(milestoneScope);
192
+ }
193
+ workspace.os.push(milestoneScope);
194
+ workspace.block.items.push({
195
+ type: 'scope',
196
+ subType: 'start',
197
+ payload: milestoneScope,
198
+ });
199
+ workspace.block.items.push({
200
+ type: 'scope',
201
+ subType: 'end',
202
+ payload: milestoneScope,
203
+ });
204
+ },
205
+ },
206
+ {
207
+ description: 'Chapter',
208
+ test: ({ context }) => ['chapter'].includes(context.sequences[0].element.subType),
209
+ action: ({
210
+ context,
211
+ workspace,
212
+ }) => {
213
+ closeVerseScopes(workspace);
214
+ closeChapterScopes(workspace);
215
+ const element = context.sequences[0].element;
216
+ const chapterScope = `chapter/${element.atts['number']}`;
217
+
218
+ if (!workspace.block.is.includes(chapterScope)) {
219
+ workspace.block.is.push(chapterScope);
220
+ }
221
+ workspace.os.push(chapterScope);
222
+ workspace.block.items.push({
223
+ type: 'scope',
224
+ subType: 'start',
225
+ payload: chapterScope,
226
+ });
227
+ },
228
+ },
229
+ {
230
+ description: 'Verses',
231
+ test: ({ context }) => ['verses'].includes(context.sequences[0].element.subType),
232
+ action: ({
233
+ context,
234
+ workspace,
235
+ }) => {
236
+ closeVerseScopes(workspace);
237
+ const element = context.sequences[0].element;
238
+ const vn = element.atts['number'];
239
+ let va = [parseInt(vn)];
240
+
241
+ if (vn.includes('-')) {
242
+ let [vs, ve] = vn.split('-').map(s => parseInt(s));
243
+ va = [vs];
244
+
245
+ while (vs <= ve) {
246
+ vs++;
247
+ va.push(vs);
248
+ }
249
+ }
250
+
251
+ for (const v of va) {
252
+ const verseScope = `verse/${v}`;
253
+ workspace.os.push(verseScope);
254
+
255
+ if (!workspace.block.is.includes(verseScope)) {
256
+ workspace.block.is.push(verseScope);
257
+ }
258
+ workspace.block.items.push({
259
+ type: 'scope',
260
+ subType: 'start',
261
+ payload: verseScope,
262
+ });
263
+ }
264
+
265
+ const versesScope = `verses/${element.atts['number']}`;
266
+
267
+ if (!workspace.block.is.includes(versesScope)) {
268
+ workspace.block.is.push(versesScope);
269
+ }
270
+ workspace.os.push(versesScope);
271
+ workspace.block.items.push({
272
+ type: 'scope',
273
+ subType: 'start',
274
+ payload: versesScope,
275
+ });
276
+ },
277
+ },
278
+ ],
279
+
280
+ startMilestone: [
281
+ {
282
+ description: 'Add scope and update state',
283
+ test: () => true,
284
+ action: ({
285
+ context,
286
+ workspace,
287
+ }) => {
288
+ const element = context.sequences[0].element;
289
+ const milestoneScope = `milestone/${element.subType.split(':')[1]}`;
290
+
291
+ if (!workspace.block.is.includes(milestoneScope)) {
292
+ workspace.block.is.push(milestoneScope);
293
+ }
294
+ workspace.os.push(milestoneScope);
295
+ workspace.block.items.push({
296
+ type: 'scope',
297
+ subType: 'start',
298
+ payload: milestoneScope,
299
+ });
300
+
301
+ for (const [attKey, attValue] of Object.entries(element.atts || {})) {
302
+ const valueParts = attValue.toString().split(',');
303
+
304
+ for (const [partN, part] of valueParts.entries()) {
305
+ const attScope = `attribute/milestone/${element.subType.split(':')[1]}/${attKey}/${partN}/${part}`;
306
+
307
+ if (!workspace.block.is.includes(attScope)) {
308
+ workspace.block.is.push(attScope);
309
+ }
310
+ workspace.os.push(attScope);
311
+ workspace.block.items.push({
312
+ type: 'scope',
313
+ subType: 'start',
314
+ payload: attScope,
315
+ });
316
+ }
317
+ }
318
+ },
319
+ },
320
+ ],
321
+
322
+ endMilestone: [
323
+ {
324
+ description: 'Remove scope and update state',
325
+ test: () => true,
326
+ action: ({
327
+ context,
328
+ workspace,
329
+ }) => {
330
+ const element = context.sequences[0].element;
331
+ const attScopeRoot = `attribute/milestone/${element.subType.split(':')[1]}`;
332
+
333
+ for (const att of [...workspace.os.filter(s => s.startsWith(attScopeRoot))].reverse()) {
334
+ workspace.os = workspace.os.filter(o => o !== att);
335
+ workspace.block.items.push({
336
+ type: 'scope',
337
+ subType: 'end',
338
+ payload: att,
339
+ });
340
+ }
341
+
342
+ const milestoneScope = `milestone/${element.subType.split(':')[1]}`;
343
+ workspace.os = workspace.os.filter(s => s !== milestoneScope);
344
+ workspace.block.items.push({
345
+ type: 'scope',
346
+ subType: 'end',
347
+ payload: milestoneScope,
348
+ });
349
+ },
350
+ },
351
+ ],
352
+
353
+ startWrapper: [
354
+ {
355
+ description: 'Add scope and update state',
356
+ test: () => true,
357
+ action: ({
358
+ context,
359
+ workspace,
360
+ }) => {
361
+ const element = context.sequences[0].element;
362
+ const wrapperScope = `${element.subType === 'usfm:w' ? 'spanWithAtts' : 'span'}/${element.subType.split(':')[1]}`;
363
+
364
+ if (!workspace.block.is.includes(wrapperScope)) {
365
+ workspace.block.is.push(wrapperScope);
366
+ }
367
+ workspace.os.push(wrapperScope);
368
+ workspace.block.items.push({
369
+ type: 'scope',
370
+ subType: 'start',
371
+ payload: wrapperScope,
372
+ });
373
+
374
+ for (const [attKey, attValue] of Object.entries(element.atts || {})) {
375
+ const valueParts = attValue.toString().split(',');
376
+
377
+ for (const [partN, part] of valueParts.entries()) {
378
+ const attScope = `attribute/spanWithAtts/w/${attKey}/${partN}/${part}`;
379
+
380
+ if (!workspace.block.is.includes(attScope)) {
381
+ workspace.block.is.push(attScope);
382
+ }
383
+ workspace.os.push(attScope);
384
+ workspace.block.items.push({
385
+ type: 'scope',
386
+ subType: 'start',
387
+ payload: attScope,
388
+ });
389
+ }
390
+ }
391
+ },
392
+ },
393
+ ],
394
+
395
+ endWrapper: [
396
+ {
397
+ description: 'Remove scope and update state',
398
+ test: () => true,
399
+ action: ({
400
+ context,
401
+ workspace,
402
+ }) => {
403
+ const element = context.sequences[0].element;
404
+
405
+ for (const [attKey, attValue] of [...Object.entries(element.atts || {})].reverse()) {
406
+ const valueParts = attValue.toString().split(',');
407
+
408
+ for (const [partN, part] of [...valueParts.entries()].reverse()) {
409
+ const attScope = `attribute/spanWithAtts/w/${attKey}/${partN}/${part}`;
410
+ workspace.os = workspace.os.filter(o => o !== attScope);
411
+ workspace.block.items.push({
412
+ type: 'scope',
413
+ subType: 'end',
414
+ payload: attScope,
415
+ });
416
+ }
417
+ }
418
+
419
+ const wrapperScope = `${element.subType === 'usfm:w' ? 'spanWithAtts' : 'span'}/${element.subType.split(':')[1]}`;
420
+ workspace.os = workspace.os.filter(s => s !== wrapperScope);
421
+ workspace.block.items.push({
422
+ type: 'scope',
423
+ subType: 'end',
424
+ payload: wrapperScope,
425
+ });
426
+ },
427
+ },
428
+ ],
429
+
430
+ text: [
431
+ {
432
+ description: 'Log occurrences',
433
+ test: () => true,
434
+ action: ({
435
+ context,
436
+ workspace,
437
+ }) => {
438
+ const text = context.sequences[0].element.text;
439
+ const re = xre.union(lexingRegexes.map((x) => x[2]));
440
+ const words = xre.match(text, re, 'all');
441
+
442
+ for (const word of words) {
443
+ let subType;
444
+
445
+ if (xre.test(word, wordLikeRegex)) {
446
+ subType = 'wordLike';
447
+ } else if (xre.test(word, lineSpaceRegex)) {
448
+ subType = 'lineSpace';
449
+ } else if (xre.test(word, punctuationRegex)) {
450
+ subType = 'punctuation';
451
+ }
452
+ workspace.block.items.push({
453
+ type: 'token',
454
+ subType,
455
+ payload: word,
456
+ });
457
+ }
458
+ },
459
+ },
460
+ ],
461
+
462
+ endDocument: [
463
+ {
464
+ description: 'Rework hanging end cv scopes',
465
+ test: () => true,
466
+ action: ({ output }) => {
467
+ const sequenceBlocks = Object.values(output.pkJson)[0];
468
+
469
+ for (let blockN = 1; blockN < sequenceBlocks.length; blockN++) {
470
+ let thisBlockItems = sequenceBlocks[blockN].items;
471
+ const lastBlockItems = sequenceBlocks[blockN - 1].items;
472
+ let itemN = 0;
473
+
474
+ while (itemN < thisBlockItems.length) {
475
+ const item = thisBlockItems[itemN];
476
+
477
+ if (item.type !== 'scope' || item.subType !== 'end') {
478
+ break;
479
+ }
480
+ itemN++;
481
+ }
482
+
483
+ while (itemN > 0) {
484
+ const movingScope = thisBlockItems.shift();
485
+ lastBlockItems.push(movingScope);
486
+ sequenceBlocks[blockN].os = sequenceBlocks[blockN].os.filter(s => s !== movingScope.payload);
487
+ itemN--;
488
+ }
489
+ }
490
+ },
491
+ },
492
+ ],
493
+
494
+ };
495
+
496
+ const perf2PkJsonCode = function ({ perf }) {
497
+ const cl = new PerfRenderFromJson(
498
+ {
499
+ srcJson: perf,
500
+ ignoreMissingSequences: true,
501
+ actions: perf2PkJsonActions,
502
+ },
503
+ );
504
+ const output = {};
505
+
506
+ cl.renderDocument({
507
+ docId: '',
508
+ config: {},
509
+ output,
510
+ });
511
+ return { pkJson: output.pkJson };
512
+ };
513
+
514
+ const perf2PkJson = {
515
+ name: 'perf2PkJson',
516
+ type: 'Transform',
517
+ description: 'PERF=>JSON: Converts PERF to current Proskomma input format',
518
+ documentation: '',
519
+ inputs: [
520
+ {
521
+ name: 'perf',
522
+ type: 'json',
523
+ source: '',
524
+ },
525
+ ],
526
+ outputs: [
527
+ {
528
+ name: 'pkJson',
529
+ type: 'json',
530
+ },
531
+ ],
532
+ code: perf2PkJsonCode,
533
+ };
534
+ module.exports = perf2PkJson;