oca_package 1.0.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.
Files changed (57) hide show
  1. package/LICENSE +287 -0
  2. package/README.md +7 -0
  3. package/dist/cjs/index.js +11 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/oca_extensions/extensions.js +84 -0
  6. package/dist/cjs/oca_extensions/extensions.js.map +1 -0
  7. package/dist/cjs/oca_extensions/state/attribute.js +13 -0
  8. package/dist/cjs/oca_extensions/state/attribute.js.map +1 -0
  9. package/dist/cjs/oca_extensions/state/extenstionContainer.js +29 -0
  10. package/dist/cjs/oca_extensions/state/extenstionContainer.js.map +1 -0
  11. package/dist/cjs/oca_extensions/state/overlays/ordering.js +38 -0
  12. package/dist/cjs/oca_extensions/state/overlays/ordering.js.map +1 -0
  13. package/dist/cjs/oca_extensions/state/overlays/separator.js +90 -0
  14. package/dist/cjs/oca_extensions/state/overlays/separator.js.map +1 -0
  15. package/dist/cjs/oca_package.js +41 -0
  16. package/dist/cjs/oca_package.js.map +1 -0
  17. package/dist/cjs/types/types.js +10 -0
  18. package/dist/cjs/types/types.js.map +1 -0
  19. package/dist/cjs/utils/helpers.js +63 -0
  20. package/dist/cjs/utils/helpers.js.map +1 -0
  21. package/dist/esm/index.js +3 -0
  22. package/dist/esm/index.js.map +1 -0
  23. package/dist/esm/oca_extensions/extensions.js +77 -0
  24. package/dist/esm/oca_extensions/extensions.js.map +1 -0
  25. package/dist/esm/oca_extensions/state/attribute.js +11 -0
  26. package/dist/esm/oca_extensions/state/attribute.js.map +1 -0
  27. package/dist/esm/oca_extensions/state/extenstionContainer.js +24 -0
  28. package/dist/esm/oca_extensions/state/extenstionContainer.js.map +1 -0
  29. package/dist/esm/oca_extensions/state/overlays/ordering.js +36 -0
  30. package/dist/esm/oca_extensions/state/overlays/ordering.js.map +1 -0
  31. package/dist/esm/oca_extensions/state/overlays/separator.js +88 -0
  32. package/dist/esm/oca_extensions/state/overlays/separator.js.map +1 -0
  33. package/dist/esm/oca_package.js +36 -0
  34. package/dist/esm/oca_package.js.map +1 -0
  35. package/dist/esm/types/types.js +7 -0
  36. package/dist/esm/types/types.js.map +1 -0
  37. package/dist/esm/utils/helpers.js +56 -0
  38. package/dist/esm/utils/helpers.js.map +1 -0
  39. package/dist/types/index.d.ts +3 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/types/oca_extensions/extensions.d.ts +41 -0
  42. package/dist/types/oca_extensions/extensions.d.ts.map +1 -0
  43. package/dist/types/oca_extensions/state/attribute.d.ts +13 -0
  44. package/dist/types/oca_extensions/state/attribute.d.ts.map +1 -0
  45. package/dist/types/oca_extensions/state/extenstionContainer.d.ts +11 -0
  46. package/dist/types/oca_extensions/state/extenstionContainer.d.ts.map +1 -0
  47. package/dist/types/oca_extensions/state/overlays/ordering.d.ts +17 -0
  48. package/dist/types/oca_extensions/state/overlays/ordering.d.ts.map +1 -0
  49. package/dist/types/oca_extensions/state/overlays/separator.d.ts +48 -0
  50. package/dist/types/oca_extensions/state/overlays/separator.d.ts.map +1 -0
  51. package/dist/types/oca_package.d.ts +18 -0
  52. package/dist/types/oca_package.d.ts.map +1 -0
  53. package/dist/types/types/types.d.ts +15 -0
  54. package/dist/types/types/types.d.ts.map +1 -0
  55. package/dist/types/utils/helpers.d.ts +6 -0
  56. package/dist/types/utils/helpers.d.ts.map +1 -0
  57. package/package.json +59 -0
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ocabundleDigest = exports.getDigest = exports.isPresent = exports.getCaptureBase = void 0;
4
+ // Get capture base from the OCA bundle
5
+ const getCaptureBase = (oca_bundle) => {
6
+ try {
7
+ if (!oca_bundle) {
8
+ throw new Error('OCA bundle is undefined or null.');
9
+ }
10
+ if (!oca_bundle.bundle) {
11
+ throw new Error('OCA bundle does not contain a bundle property.');
12
+ }
13
+ if (!oca_bundle.bundle.capture_base) {
14
+ throw new Error('OCA bundle does not contain a capture_base property.');
15
+ }
16
+ return oca_bundle.bundle.capture_base;
17
+ }
18
+ catch (error) {
19
+ console.error('Error in getting capture base:', error);
20
+ throw new Error(`Failed to get the capture base from the OCA bundle: ${error.message}`);
21
+ }
22
+ };
23
+ exports.getCaptureBase = getCaptureBase;
24
+ // Validate if the attribute exists in the OCA bundle capture base
25
+ const isPresent = (attribute, oca_bundle) => {
26
+ try {
27
+ const capture_base = (0, exports.getCaptureBase)(oca_bundle);
28
+ if (!capture_base.attributes) {
29
+ throw new Error('OCA bundle capture_base does not contain attributes.');
30
+ }
31
+ return attribute in capture_base.attributes;
32
+ }
33
+ catch (error) {
34
+ console.error('Error in validation:', error);
35
+ throw new Error(`Failed to check if the attribute is present in the capture base: ${error.message}`);
36
+ }
37
+ };
38
+ exports.isPresent = isPresent;
39
+ // Get the said (digest) from the OCA bundle capture base
40
+ const getDigest = (oca_bundle) => {
41
+ try {
42
+ const capture_base = (0, exports.getCaptureBase)(oca_bundle);
43
+ return capture_base.d;
44
+ }
45
+ catch (error) {
46
+ console.error('Error in getting said:', error);
47
+ throw new Error(`Failed to get the said from the capture base: ${error.message}`);
48
+ }
49
+ };
50
+ exports.getDigest = getDigest;
51
+ // Get oca bundle digest
52
+ const ocabundleDigest = (oca_bundle) => {
53
+ try {
54
+ const oca_bundle_d = oca_bundle.bundle.d;
55
+ return oca_bundle_d;
56
+ }
57
+ catch (error) {
58
+ console.error('Error in getting oca bundle digest:', error);
59
+ throw new Error(`Failed to get the oca bundle digest: ${error.message}`);
60
+ }
61
+ };
62
+ exports.ocabundleDigest = ocabundleDigest;
63
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":";;;AAEA,uCAAuC;AAChC,MAAM,cAAc,GAAG,CAAC,UAAe,EAAwB,EAAE;IACtE,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,EA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,YAAY,GAAG,IAAA,sBAAc,EAAC,UAAU,CAAC,CAAC;QAChD,OAAO,YAAY,CAAC,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,iDAAiD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;AACH,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB;AAEF,wBAAwB;AACjB,MAAM,eAAe,GAAG,CAAC,UAAe,EAAU,EAAE;IACzD,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACzC,OAAO,YAAY,CAAC;IACtB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,wCAAwC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B"}
@@ -0,0 +1,3 @@
1
+ export { default as OcaPackage } from './oca_package.js';
2
+ export { default as ExtensionContainer } from './oca_extensions/state/extenstionContainer.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+CAA+C,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { ocabundleDigest } from '../utils/helpers.js';
2
+ import Ordering from './state/overlays/ordering.js';
3
+ import { saidify } from 'saidify';
4
+ // Internal representation of the extension json input
5
+ // From this state, we can generate the extension overlay in any format
6
+ export class ExtensionState {
7
+ constructor(extension_obj) {
8
+ if (!extension_obj) {
9
+ throw new Error('Extension object is required');
10
+ }
11
+ this._attributes_ordering_arr = this.extractAttributeOrdering(extension_obj);
12
+ this._entry_code_ordering_arr = this.extractEntryCodeOrdering(extension_obj);
13
+ }
14
+ extractAttributeOrdering(extension_obj) {
15
+ if (extension_obj['ordering_overlay']) {
16
+ return extension_obj.ordering_overlay?.ordering_attributes;
17
+ }
18
+ else {
19
+ throw new Error('Ordering overlay is required');
20
+ }
21
+ }
22
+ extractEntryCodeOrdering(extension_obj) {
23
+ return extension_obj.ordering_overlay ? extension_obj.ordering_overlay.ordering_entry_codes || {} : {};
24
+ }
25
+ get ordering_arr() {
26
+ return this._attributes_ordering_arr;
27
+ }
28
+ get entry_code_ordering_arr() {
29
+ return this._entry_code_ordering_arr;
30
+ }
31
+ }
32
+ // Generates a serialized extension overlay per OCA bundle
33
+ class Extension {
34
+ constructor(extension_obj, oca_bundle) {
35
+ this.d = '';
36
+ this.type = 'community/adc/extension/1.0';
37
+ this.bundle_digest = '';
38
+ this.overlays = {};
39
+ if (!extension_obj || !oca_bundle) {
40
+ throw new Error('Extension object and OCA bundle are required');
41
+ }
42
+ this.extensionState = new ExtensionState(extension_obj);
43
+ this.oca_bundle = oca_bundle;
44
+ this.overlays = this.generateOverlays();
45
+ }
46
+ generateOverlays() {
47
+ const overlays = {};
48
+ try {
49
+ if (this.extensionState.ordering_arr) {
50
+ const ordering = new Ordering(this.extensionState, this.oca_bundle);
51
+ overlays['ordering'] = JSON.parse(ordering.generateOverlay());
52
+ }
53
+ }
54
+ catch (error) {
55
+ console.error('Error generating overlays:', error);
56
+ }
57
+ return overlays;
58
+ }
59
+ toJSON() {
60
+ const oca_bundle_digest = ocabundleDigest(this.oca_bundle);
61
+ return {
62
+ d: '',
63
+ type: 'community/adc/extension/1.0',
64
+ bundle_digest: oca_bundle_digest,
65
+ overlays: this.overlays,
66
+ };
67
+ }
68
+ saidifying() {
69
+ const [, sad] = saidify(this.toJSON());
70
+ return sad;
71
+ }
72
+ generateExtension() {
73
+ return JSON.stringify(this.saidifying());
74
+ }
75
+ }
76
+ export default Extension;
77
+ //# sourceMappingURL=extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../src/oca_extensions/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,QAAQ,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAelC,sDAAsD;AACtD,uEAAuE;AACvE,MAAM,OAAO,cAAc;IAIzB,YAAY,aAAiC;QAC3C,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAC/E,CAAC;IAEO,wBAAwB,CAAC,aAAiC;QAChE,IAAI,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QAC7D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAEO,wBAAwB,CAAC,aAAiC;QAChE,OAAO,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzG,CAAC;IAED,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,wBAAwB,CAAC;IACvC,CAAC;IAED,IAAW,uBAAuB;QAChC,OAAO,IAAI,CAAC,wBAAwB,CAAC;IACvC,CAAC;CACF;AASD,0DAA0D;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,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,iBAAiB;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ class Attribute {
2
+ constructor(attribute) {
3
+ this.name = attribute;
4
+ this.attribute_separators = {};
5
+ }
6
+ setAttributeSeparators(attribute_separators) {
7
+ this.attribute_separators = attribute_separators;
8
+ }
9
+ }
10
+ export default Attribute;
11
+ //# sourceMappingURL=attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../../src/oca_extensions/state/attribute.ts"],"names":[],"mappings":"AAQA,MAAM,SAAS;IAIb,YAAY,SAAiB;QAC3B,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,oBAAoB,GAAG,EAAqB,CAAC;IACpD,CAAC;IAEM,sBAAsB,CAAC,oBAAqC;QACjE,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,24 @@
1
+ // Todo: To generate extension container, we need to iterate the extensions json input,
2
+ // and create an extension object for each
3
+ import Extension from '../extensions.js';
4
+ class ExtensionContainer {
5
+ constructor() {
6
+ this.extensionsContainer = [];
7
+ }
8
+ // Currently, this method only generate extension overlay for a single layer oca bundle
9
+ generate_extensions(extension_obj, oca_bundle) {
10
+ try {
11
+ if (extension_obj) {
12
+ // const extension = new Extension(extension_obj['extensions'][0], oca_bundle);
13
+ const extension = new Extension(extension_obj['extensions'][0], oca_bundle);
14
+ this.extensionsContainer.push(JSON.parse(extension.generateExtension()));
15
+ }
16
+ }
17
+ catch (error) {
18
+ throw new Error(`Failed to generate extension overlay: ${error}`);
19
+ }
20
+ return this.extensionsContainer;
21
+ }
22
+ }
23
+ export default ExtensionContainer;
24
+ //# sourceMappingURL=extenstionContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extenstionContainer.js","sourceRoot":"","sources":["../../../../src/oca_extensions/state/extenstionContainer.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,0CAA0C;AAE1C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAQzC,MAAM,kBAAkB;IAGtB;QACE,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,uFAAuF;IAChF,mBAAmB,CAAC,aAAiC,EAAE,UAAe;QAC3E,IAAI,CAAC;YACH,IAAI,aAAa,EAAE,CAAC;gBAClB,+EAA+E;gBAC/E,MAAM,SAAS,GAAG,IAAI,SAAS,CAAE,aAAqB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAErF,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { getDigest } from '../../../utils/helpers.js';
2
+ import { saidify } from 'saidify';
3
+ class Ordering {
4
+ constructor(extensionState, oca_bundle) {
5
+ if (!oca_bundle || !extensionState) {
6
+ throw new Error('OCA bundle and ExtensionState are required');
7
+ }
8
+ this.oca_bundle = oca_bundle;
9
+ this.extensionState = extensionState;
10
+ this.ordering_overlay = this.getAttributeOrdering();
11
+ }
12
+ getAttributeOrdering() {
13
+ return this.extensionState.ordering_arr;
14
+ }
15
+ getEntryCodeOrdering() {
16
+ return this.extensionState.entry_code_ordering_arr;
17
+ }
18
+ toJSON() {
19
+ return {
20
+ d: '',
21
+ type: 'community/overlays/adc/ordering/1.0',
22
+ capture_base: getDigest(this.oca_bundle),
23
+ ordering_attribute: this.getAttributeOrdering(),
24
+ entry_code_ordering: this.getEntryCodeOrdering(),
25
+ };
26
+ }
27
+ saidifying() {
28
+ const [, sad] = saidify(this.toJSON());
29
+ return sad;
30
+ }
31
+ generateOverlay() {
32
+ return JSON.stringify(this.saidifying());
33
+ }
34
+ }
35
+ export default Ordering;
36
+ //# sourceMappingURL=ordering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordering.js","sourceRoot":"","sources":["../../../../../src/oca_extensions/state/overlays/ordering.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMlC,MAAM,QAAQ;IAKZ,YAAY,cAA8B,EAAE,UAAe;QACzD,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC;IACtD,CAAC;IAEO,oBAAoB;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC;IAC1C,CAAC;IAEO,oBAAoB;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC;IACrD,CAAC;IAEO,MAAM;QACZ,OAAO;YACL,CAAC,EAAE,EAAE;YACL,IAAI,EAAE,qCAAqC;YAC3C,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;YACxC,kBAAkB,EAAE,IAAI,CAAC,oBAAoB,EAAE;YAC/C,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,EAAE;SACjD,CAAC;IACJ,CAAC;IAEO,UAAU;QAChB,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,88 @@
1
+ /*
2
+ Separator overlay
3
+
4
+ This overlay is used to define the separators used in the dataset and the attributes in the dataset.
5
+
6
+ Canoncial rules:
7
+ - d, type, capture_base has to be present in this order
8
+ - other properties (dataset_separator, attribute_separators) will be lexically sorted by key
9
+ - attributes in attribute_separators will lexically sorted by key as currently current canonical rules applied in the OCA bundle
10
+
11
+ - Example:
12
+ {
13
+ "d": "said:...",
14
+ "type": "community/adc/overlays/separator/1.0",
15
+ "capture_base": "said:...",
16
+ "attribute_separators": {
17
+ "attribute_name": {
18
+ "attr1": {
19
+ "delimiter": "...",
20
+ "escape": "..."
21
+ }
22
+ }
23
+ },
24
+ "dataset_separator": {
25
+ "delimiter": "...",
26
+ "escape": "..."
27
+ }
28
+ }
29
+ */
30
+ import { saidify } from 'saidify';
31
+ import { getDigest, isPresent } from '../../../utils/helpers.js';
32
+ import { OverlayTypes } from '../../../types/types.js';
33
+ class Separator {
34
+ constructor(separators, oca_bundle) {
35
+ this.said = '';
36
+ this.type = OverlayTypes.Separator;
37
+ this.separators = separators;
38
+ this.oca_bundle = oca_bundle;
39
+ this.capture_base = getDigest(this.oca_bundle);
40
+ }
41
+ overlay_type() {
42
+ return this.type;
43
+ }
44
+ attributes() {
45
+ const sorted_attribute_separators = [];
46
+ if (this.separators.attribute_separators) {
47
+ for (const key in this.separators.attribute_separators) {
48
+ if (Object.prototype.hasOwnProperty.call(this.separators.attribute_separators, key)) {
49
+ if (!isPresent(key, this.oca_bundle)) {
50
+ throw new Error(`Attribute ${key} not found in OCA bundle Capture Base.`);
51
+ }
52
+ sorted_attribute_separators.push({ key, value: this.separators.attribute_separators[key] });
53
+ }
54
+ }
55
+ // Sort the attribute separators by key
56
+ sorted_attribute_separators.sort((a, b) => a.key.localeCompare(b.key));
57
+ }
58
+ return sorted_attribute_separators;
59
+ }
60
+ // serialize the separator overlay
61
+ toJSON() {
62
+ const serialized_attribute_separators = {};
63
+ for (const attr of this.attributes()) {
64
+ serialized_attribute_separators[attr.key] = attr.value;
65
+ }
66
+ return {
67
+ d: this.said,
68
+ type: 'community/adc/overlays/separator/1.0',
69
+ capture_base: this.capture_base,
70
+ dataset_separator: this.separators.dataset_separator,
71
+ attribute_separators: serialized_attribute_separators,
72
+ };
73
+ }
74
+ saidifying() {
75
+ const [, sad] = saidify(this.toJSON());
76
+ return sad;
77
+ }
78
+ generate_overlay() {
79
+ return JSON.stringify(this.saidifying());
80
+ }
81
+ // TODO: find out if it neccessary to implement this methood for all overlays
82
+ static deser(separator_ov_json_string) {
83
+ const separator_ov_json = JSON.parse(separator_ov_json_string);
84
+ return new Separator(separator_ov_json, separator_ov_json.capture_base);
85
+ }
86
+ }
87
+ export default Separator;
88
+ //# sourceMappingURL=separator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.js","sourceRoot":"","sources":["../../../../../src/oca_extensions/state/overlays/separator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BE;AAEF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAQ,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA8B7D,MAAM,SAAS;IASb,YAAY,UAA2B,EAAE,UAAe;QACtD,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CA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AI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QACzD,CAAC;QAED,OAAO;YACL,CAAC,EAAE,IAAI,CAAC,IAAI;YACZ,IAAI,EAAE,sCAAsC;YAC5C,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,iBAAiB,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB;YACpD,oBAAoB,EAAE,+BAA+B;SACtD,CAAC;IACJ,CAAC;IAEO,UAAU;QAChB,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,gBAAgB;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,6EAA6E;IAC7E,MAAM,CAAC,KAAK,CAAC,wBAAgC;QAC3C,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC/D,OAAO,IAAI,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC1E,CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,36 @@
1
+ import ExtensionContainer from './oca_extensions/state/extenstionContainer.js';
2
+ import { saidify } from 'saidify';
3
+ class OcaPackage {
4
+ constructor(extension_input, oca_bundle) {
5
+ this.extensions = new ExtensionContainer();
6
+ this.extension_input = extension_input;
7
+ this.oca_bundle = oca_bundle;
8
+ }
9
+ saidifying() {
10
+ const [, sad] = saidify(this.toJSON());
11
+ return JSON.stringify(sad);
12
+ }
13
+ said() {
14
+ const [said] = saidify(this.toJSON());
15
+ return said;
16
+ }
17
+ toJSON() {
18
+ try {
19
+ const extension_container = this.extensions.generate_extensions(this.extension_input, this.oca_bundle);
20
+ return {
21
+ d: '',
22
+ type: 'adc/oca_package/1.0',
23
+ oca_bundle: this.oca_bundle,
24
+ extensions: extension_container,
25
+ };
26
+ }
27
+ catch (error) {
28
+ throw new Error(`Failed to parse Extension JSON: ${error}`);
29
+ }
30
+ }
31
+ generateOcaPackage() {
32
+ return this.saidifying();
33
+ }
34
+ }
35
+ export default OcaPackage;
36
+ //# sourceMappingURL=oca_package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oca_package.js","sourceRoot":"","sources":["../../src/oca_package.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAOlC,MAAM,UAAU;IAKd,YAAY,eAAmC,EAAE,UAAkB;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAEO,UAAU;QAChB,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,IAAI;QACT,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC;YACH,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YACvG,OAAO;gBACL,CAAC,EAAE,EAAE;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,UAAU,EAAE,mBAAmB;aAChC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CACF;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ // overlay types
2
+ export var OverlayTypes;
3
+ (function (OverlayTypes) {
4
+ OverlayTypes["Separator"] = "separator";
5
+ OverlayTypes["Example"] = "example";
6
+ })(OverlayTypes || (OverlayTypes = {}));
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types/types.ts"],"names":[],"mappings":"AAYA,gBAAgB;AAChB,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB"}
@@ -0,0 +1,56 @@
1
+ // Get capture base from the OCA bundle
2
+ export const getCaptureBase = (oca_bundle) => {
3
+ try {
4
+ if (!oca_bundle) {
5
+ throw new Error('OCA bundle is undefined or null.');
6
+ }
7
+ if (!oca_bundle.bundle) {
8
+ throw new Error('OCA bundle does not contain a bundle property.');
9
+ }
10
+ if (!oca_bundle.bundle.capture_base) {
11
+ throw new Error('OCA bundle does not contain a capture_base property.');
12
+ }
13
+ return oca_bundle.bundle.capture_base;
14
+ }
15
+ catch (error) {
16
+ console.error('Error in getting capture base:', error);
17
+ throw new Error(`Failed to get the capture base from the OCA bundle: ${error.message}`);
18
+ }
19
+ };
20
+ // Validate if the attribute exists in the OCA bundle capture base
21
+ export const isPresent = (attribute, oca_bundle) => {
22
+ try {
23
+ const capture_base = getCaptureBase(oca_bundle);
24
+ if (!capture_base.attributes) {
25
+ throw new Error('OCA bundle capture_base does not contain attributes.');
26
+ }
27
+ return attribute in capture_base.attributes;
28
+ }
29
+ catch (error) {
30
+ console.error('Error in validation:', error);
31
+ throw new Error(`Failed to check if the attribute is present in the capture base: ${error.message}`);
32
+ }
33
+ };
34
+ // Get the said (digest) from the OCA bundle capture base
35
+ export const getDigest = (oca_bundle) => {
36
+ try {
37
+ const capture_base = getCaptureBase(oca_bundle);
38
+ return capture_base.d;
39
+ }
40
+ catch (error) {
41
+ console.error('Error in getting said:', error);
42
+ throw new Error(`Failed to get the said from the capture base: ${error.message}`);
43
+ }
44
+ };
45
+ // Get oca bundle digest
46
+ export const ocabundleDigest = (oca_bundle) => {
47
+ try {
48
+ const oca_bundle_d = oca_bundle.bundle.d;
49
+ return oca_bundle_d;
50
+ }
51
+ catch (error) {
52
+ console.error('Error in getting oca bundle digest:', error);
53
+ throw new Error(`Failed to get the oca bundle digest: ${error.message}`);
54
+ }
55
+ };
56
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/helpers.ts"],"names":[],"mappings":"AAEA,uCAAuC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAe,EAAwB,EAAE;IACtE,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC;IACxC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,uDAAuD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1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D,MAAM,IAAI,KAAK,CAAC,wCAAwC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as OcaPackage } from './oca_package.js';
2
+ export { default as ExtensionContainer } from './oca_extensions/state/extenstionContainer.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+CAA+C,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Said } from '../types/types.js';
2
+ export interface ExtensionInputJson {
3
+ ordering_overlay?: {
4
+ ordering_attributes: any;
5
+ ordering_entry_codes?: Record<string, any>;
6
+ };
7
+ }
8
+ export interface IExtensionState {
9
+ ordering_arr: string[];
10
+ entry_code_ordering_arr: object;
11
+ }
12
+ export declare class ExtensionState implements IExtensionState {
13
+ private _attributes_ordering_arr;
14
+ private _entry_code_ordering_arr;
15
+ constructor(extension_obj: ExtensionInputJson);
16
+ private extractAttributeOrdering;
17
+ private extractEntryCodeOrdering;
18
+ get ordering_arr(): string[];
19
+ get entry_code_ordering_arr(): Record<string, any>;
20
+ }
21
+ export interface IExtension {
22
+ d: Said;
23
+ type: string;
24
+ bundle_digest: Said;
25
+ overlays: Record<string, any>;
26
+ }
27
+ declare class Extension implements IExtension {
28
+ d: Said;
29
+ type: string;
30
+ bundle_digest: Said;
31
+ overlays: Record<string, any>;
32
+ private extensionState;
33
+ private oca_bundle;
34
+ constructor(extension_obj: ExtensionInputJson, oca_bundle: any);
35
+ private generateOverlays;
36
+ private toJSON;
37
+ private saidifying;
38
+ generateExtension(): string;
39
+ }
40
+ export default Extension;
41
+ //# sourceMappingURL=extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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AAO,CAAC,UAAU;IAKX,iBAAiB,IAAI,MAAM;CAGnC;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { SeparatorValues } from '../state/overlays/separator.js';
2
+ interface IAttribute {
3
+ name: string;
4
+ attribute_separators: SeparatorValues;
5
+ }
6
+ declare class Attribute implements IAttribute {
7
+ name: string;
8
+ attribute_separators: SeparatorValues;
9
+ constructor(attribute: string);
10
+ setAttributeSeparators(attribute_separators: SeparatorValues): void;
11
+ }
12
+ export default Attribute;
13
+ //# sourceMappingURL=attribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute.d.ts","sourceRoot":"","sources":["../../../../src/oca_extensions/state/attribute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,eAAe,CAAC;CACvC;AAED,cAAM,SAAU,YAAW,UAAU;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,eAAe,CAAC;gBAEjC,SAAS,EAAE,MAAM;IAKtB,sBAAsB,CAAC,oBAAoB,EAAE,eAAe,GAAG,IAAI;CAG3E;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { ExtensionInputJson } from '../extensions.js';
2
+ export interface IExtensionContainer {
3
+ extensionsContainer: string[];
4
+ }
5
+ declare class ExtensionContainer implements IExtensionContainer {
6
+ extensionsContainer: string[];
7
+ constructor();
8
+ generate_extensions(extension_obj: ExtensionInputJson, oca_bundle: any): string[];
9
+ }
10
+ export default ExtensionContainer;
11
+ //# sourceMappingURL=extenstionContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extenstionContainer.d.ts","sourceRoot":"","sources":["../../../../src/oca_extensions/state/extenstionContainer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,cAAM,kBAAmB,YAAW,mBAAmB;IAC9C,mBAAmB,EAAE,MAAM,EAAE,CAAC;;IAO9B,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,GAAG,GAAG,MAAM,EAAE;CAazF;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { ExtensionState } from '../../extensions.js';
2
+ export interface IOrdering {
3
+ ordering_overlay: string[];
4
+ }
5
+ declare class Ordering implements IOrdering {
6
+ ordering_overlay: string[];
7
+ oca_bundle: any;
8
+ private extensionState;
9
+ constructor(extensionState: ExtensionState, oca_bundle: any);
10
+ private getAttributeOrdering;
11
+ private getEntryCodeOrdering;
12
+ private toJSON;
13
+ private saidifying;
14
+ generateOverlay(): string;
15
+ }
16
+ export default Ordering;
17
+ //# sourceMappingURL=ordering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordering.d.ts","sourceRoot":"","sources":["../../../../../src/oca_extensions/state/overlays/ordering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD,MAAM,WAAW,SAAS;IACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,cAAM,QAAS,YAAW,SAAS;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,EAAE,GAAG,CAAC;IACvB,OAAO,CAAC,cAAc,CAAiB;gBAE3B,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG;IAS3D,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,UAAU;IAKX,eAAe,IAAI,MAAM;CAGjC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { Said, OverlayTypes } from '../../../types/types.js';
2
+ export interface SeparatorOverlayInput {
3
+ type: string;
4
+ dataset_separator: SeparatorValues;
5
+ attribute_separators: {
6
+ [key: string]: SeparatorValues;
7
+ };
8
+ }
9
+ export interface SeparatorsInput {
10
+ type: string;
11
+ dataset_separator?: SeparatorValues;
12
+ attribute_separators?: {
13
+ [key: string]: SeparatorValues;
14
+ };
15
+ }
16
+ export interface ISeparatorOverlay {
17
+ said?: Said;
18
+ type: OverlayTypes.Separator;
19
+ capture_base: Said;
20
+ dataset_separator?: SeparatorsInput['dataset_separator'];
21
+ attribute_separators?: SeparatorsInput['attribute_separators'];
22
+ overlay_type(): string;
23
+ }
24
+ export interface SeparatorValues {
25
+ delimiter: string;
26
+ escape: string;
27
+ }
28
+ declare class Separator implements ISeparatorOverlay {
29
+ said?: Said;
30
+ type: OverlayTypes.Separator;
31
+ capture_base: Said;
32
+ dataset_separator?: SeparatorsInput['dataset_separator'];
33
+ attribute_separators?: SeparatorsInput['attribute_separators'];
34
+ separators: SeparatorsInput;
35
+ oca_bundle: any;
36
+ constructor(separators: SeparatorsInput, oca_bundle: any);
37
+ overlay_type(): string;
38
+ attributes(): {
39
+ key: string;
40
+ value: SeparatorValues;
41
+ }[];
42
+ private toJSON;
43
+ private saidifying;
44
+ generate_overlay(): string;
45
+ static deser(separator_ov_json_string: string): Separator;
46
+ }
47
+ export default Separator;
48
+ //# sourceMappingURL=separator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../../../src/oca_extensions/state/overlays/separator.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,eAAe,CAAC;IACnC,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;CAC1D;AAED,MAAM,WAAW,eAA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