proskomma-core 0.10.1 → 0.10.3

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/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/dist/index.js CHANGED
@@ -15986,7 +15986,7 @@ var bitset = {
15986
15986
  })(bitset, bitsetExports);
15987
15987
  const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
15988
15988
  const name = "proskomma-core";
15989
- const version = "0.10.1";
15989
+ const version = "0.10.3";
15990
15990
  const description$b = "A Scripture Runtime Engine";
15991
15991
  const files = [
15992
15992
  "dist"
@@ -17749,6 +17749,9 @@ const succinctScopeLabel$1 = (enums2, enumIndexes2, succinct2, itemSubtype, pos)
17749
17749
  }
17750
17750
  return `${scopeType}${scopeBits}`;
17751
17751
  };
17752
+ const succinctScopeType = (itemSubtype) => {
17753
+ return scopeDefs.scopeEnumLabels[itemSubtype];
17754
+ };
17752
17755
  const succinctGraftName$1 = (enums2, enumIndexes2, itemSubtype) => {
17753
17756
  const graftIndex = enumIndexes2.graftTypes[itemSubtype];
17754
17757
  return enums2.graftTypes.countedString(graftIndex);
@@ -17854,6 +17857,7 @@ const succinct = {
17854
17857
  pushSuccinctScopeBytes: pushSuccinctScopeBytes$3,
17855
17858
  succinctTokenChars: succinctTokenChars$1,
17856
17859
  succinctScopeLabel: succinctScopeLabel$1,
17860
+ succinctScopeType,
17857
17861
  succinctGraftName: succinctGraftName$1,
17858
17862
  succinctGraftSeqId: succinctGraftSeqId$1,
17859
17863
  unpackEnum
@@ -18599,7 +18603,18 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18599
18603
  let tokenCount = nextToken || 0;
18600
18604
  const scopes = new Set(openScopes || []);
18601
18605
  while (pos < succinct2.length) {
18602
- const [item, itemLength] = docSet.unsuccinctifyItem(succinct2, pos, {});
18606
+ const [itemLength, itemType, itemSubtype] = utils.succinct.headerBytes(
18607
+ succinct2,
18608
+ pos
18609
+ );
18610
+ if ([utils.itemDefs.itemEnum.startScope, utils.itemDefs.itemEnum.endScope].includes(itemType)) {
18611
+ const itemTypeName = utils.succinct.succinctScopeType(itemSubtype);
18612
+ if (Object.keys(options2).length > 0 && options2.scopes && options2.excludeScopeTypes && options2.excludeScopeTypes.includes(itemTypeName)) {
18613
+ pos += itemLength;
18614
+ continue;
18615
+ }
18616
+ }
18617
+ const item = docSet.unsuccinctifyItem(succinct2, pos, {})[0];
18603
18618
  if (item[0] === "token") {
18604
18619
  if (Object.keys(options2).length === 0 || options2.tokens) {
18605
18620
  if (nextToken !== null) {
@@ -18613,12 +18628,21 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18613
18628
  } else if (item[0] === "scope" && item[1] === "start") {
18614
18629
  scopes.add(item[2]);
18615
18630
  if (Object.keys(options2).length === 0 || options2.scopes) {
18616
- ret.push(item);
18631
+ if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18632
+ ret.push(item);
18633
+ } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18634
+ ret.push(item);
18635
+ }
18617
18636
  }
18618
18637
  } else if (item[0] === "scope" && item[1] === "end") {
18619
18638
  scopes.delete(item[2]);
18620
18639
  if (Object.keys(options2).length === 0 || options2.scopes) {
18621
- ret.push(item);
18640
+ if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18641
+ ret.push(item);
18642
+ } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18643
+ ret.push(item);
18644
+ } else
18645
+ ;
18622
18646
  }
18623
18647
  } else if (item[0] === "graft") {
18624
18648
  if (Object.keys(options2).length === 0 || options2.grafts) {
@@ -44135,6 +44159,8 @@ type Block {
44135
44159
  withScriptureCV: String
44136
44160
  """If true, adds scope and nextToken information to each token"""
44137
44161
  includeContext: Boolean
44162
+ """Do not return scopes types in list (eg milestone)"""
44163
+ excludeScopeTypes: [String!]
44138
44164
  ) : [Item!]!
44139
44165
  """A list of tokens from the c (content) field of the block"""
44140
44166
  tokens(
@@ -44213,6 +44239,7 @@ const blockResolvers = {
44213
44239
  tokens: true,
44214
44240
  scopes: true,
44215
44241
  grafts: true,
44242
+ excludeScopeTypes: args.excludeScopeTypes || [],
44216
44243
  requiredScopes: args.withScopes || [],
44217
44244
  anyScope: args.anyScope || false
44218
44245
  });
package/dist/index.mjs CHANGED
@@ -15984,7 +15984,7 @@ var bitset = {
15984
15984
  })(bitset, bitsetExports);
15985
15985
  const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
15986
15986
  const name = "proskomma-core";
15987
- const version = "0.10.1";
15987
+ const version = "0.10.3";
15988
15988
  const description$b = "A Scripture Runtime Engine";
15989
15989
  const files = [
15990
15990
  "dist"
@@ -17747,6 +17747,9 @@ const succinctScopeLabel$1 = (enums2, enumIndexes2, succinct2, itemSubtype, pos)
17747
17747
  }
17748
17748
  return `${scopeType}${scopeBits}`;
17749
17749
  };
17750
+ const succinctScopeType = (itemSubtype) => {
17751
+ return scopeDefs.scopeEnumLabels[itemSubtype];
17752
+ };
17750
17753
  const succinctGraftName$1 = (enums2, enumIndexes2, itemSubtype) => {
17751
17754
  const graftIndex = enumIndexes2.graftTypes[itemSubtype];
17752
17755
  return enums2.graftTypes.countedString(graftIndex);
@@ -17852,6 +17855,7 @@ const succinct = {
17852
17855
  pushSuccinctScopeBytes: pushSuccinctScopeBytes$3,
17853
17856
  succinctTokenChars: succinctTokenChars$1,
17854
17857
  succinctScopeLabel: succinctScopeLabel$1,
17858
+ succinctScopeType,
17855
17859
  succinctGraftName: succinctGraftName$1,
17856
17860
  succinctGraftSeqId: succinctGraftSeqId$1,
17857
17861
  unpackEnum
@@ -18597,7 +18601,18 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18597
18601
  let tokenCount = nextToken || 0;
18598
18602
  const scopes = new Set(openScopes || []);
18599
18603
  while (pos < succinct2.length) {
18600
- const [item, itemLength] = docSet.unsuccinctifyItem(succinct2, pos, {});
18604
+ const [itemLength, itemType, itemSubtype] = utils.succinct.headerBytes(
18605
+ succinct2,
18606
+ pos
18607
+ );
18608
+ if ([utils.itemDefs.itemEnum.startScope, utils.itemDefs.itemEnum.endScope].includes(itemType)) {
18609
+ const itemTypeName = utils.succinct.succinctScopeType(itemSubtype);
18610
+ if (Object.keys(options2).length > 0 && options2.scopes && options2.excludeScopeTypes && options2.excludeScopeTypes.includes(itemTypeName)) {
18611
+ pos += itemLength;
18612
+ continue;
18613
+ }
18614
+ }
18615
+ const item = docSet.unsuccinctifyItem(succinct2, pos, {})[0];
18601
18616
  if (item[0] === "token") {
18602
18617
  if (Object.keys(options2).length === 0 || options2.tokens) {
18603
18618
  if (nextToken !== null) {
@@ -18611,12 +18626,21 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18611
18626
  } else if (item[0] === "scope" && item[1] === "start") {
18612
18627
  scopes.add(item[2]);
18613
18628
  if (Object.keys(options2).length === 0 || options2.scopes) {
18614
- ret.push(item);
18629
+ if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18630
+ ret.push(item);
18631
+ } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18632
+ ret.push(item);
18633
+ }
18615
18634
  }
18616
18635
  } else if (item[0] === "scope" && item[1] === "end") {
18617
18636
  scopes.delete(item[2]);
18618
18637
  if (Object.keys(options2).length === 0 || options2.scopes) {
18619
- ret.push(item);
18638
+ if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18639
+ ret.push(item);
18640
+ } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18641
+ ret.push(item);
18642
+ } else
18643
+ ;
18620
18644
  }
18621
18645
  } else if (item[0] === "graft") {
18622
18646
  if (Object.keys(options2).length === 0 || options2.grafts) {
@@ -44133,6 +44157,8 @@ type Block {
44133
44157
  withScriptureCV: String
44134
44158
  """If true, adds scope and nextToken information to each token"""
44135
44159
  includeContext: Boolean
44160
+ """Do not return scopes types in list (eg milestone)"""
44161
+ excludeScopeTypes: [String!]
44136
44162
  ) : [Item!]!
44137
44163
  """A list of tokens from the c (content) field of the block"""
44138
44164
  tokens(
@@ -44211,6 +44237,7 @@ const blockResolvers = {
44211
44237
  tokens: true,
44212
44238
  scopes: true,
44213
44239
  grafts: true,
44240
+ excludeScopeTypes: args.excludeScopeTypes || [],
44214
44241
  requiredScopes: args.withScopes || [],
44215
44242
  anyScope: args.anyScope || false
44216
44243
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proskomma-core",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "A Scripture Runtime Engine",
5
5
  "files": [
6
6
  "dist"