oca_package 1.3.0 → 1.4.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.
- package/dist/cjs/oca_extensions/extensions.js +10 -2
- package/dist/cjs/oca_extensions/state/overlays/framing/attribute_framing.js +23 -13
- package/dist/esm/oca_extensions/extensions.js +10 -2
- package/dist/esm/oca_extensions/state/overlays/framing/attribute_framing.js +20 -13
- package/dist/types/oca_extensions/extensions.d.ts.map +1 -1
- package/dist/types/oca_extensions/state/overlays/framing/attribute_framing.d.ts +2 -1
- package/dist/types/oca_extensions/state/overlays/framing/attribute_framing.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// TODO: use canonicalize to consistently order how properties of overlays should appear
|
|
3
|
+
// Do validation for the generation exentension chunck, and parts of oca_package.
|
|
2
4
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
5
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
6
|
};
|
|
@@ -9,10 +11,11 @@ const unit_framing_js_1 = __importDefault(require("./state/overlays/framing/unit
|
|
|
9
11
|
const example_js_1 = __importDefault(require("./state/overlays/example.js"));
|
|
10
12
|
const range_js_1 = __importDefault(require("./state/overlays/range.js"));
|
|
11
13
|
const sensitive_js_1 = __importDefault(require("./state/overlays/sensitive.js"));
|
|
14
|
+
const attribute_framing_js_1 = __importDefault(require("./state/overlays/framing/attribute_framing.js"));
|
|
12
15
|
const helpers_js_1 = require("../utils/helpers.js");
|
|
13
16
|
const saidify_1 = require("saidify");
|
|
14
17
|
const ADC_COMMUNITY = 'adc';
|
|
15
|
-
const
|
|
18
|
+
const EXTENSION_VERSION = '1.0';
|
|
16
19
|
class ExtensionState {
|
|
17
20
|
constructor(ExtensionInputJson) {
|
|
18
21
|
this._extension_input_json = ExtensionInputJson;
|
|
@@ -66,6 +69,11 @@ class Overlay {
|
|
|
66
69
|
const sensitive_ov = sensitive_instance.GenerateOverlay();
|
|
67
70
|
overlay['sensitive'] = JSON.parse(sensitive_ov);
|
|
68
71
|
}
|
|
72
|
+
else if (ov_type === 'attribute_framing_overlay') {
|
|
73
|
+
const attribute_framing_instance = new attribute_framing_js_1.default(this._overlay.attribute_framing_overlay);
|
|
74
|
+
const attribute_framing_ov = attribute_framing_instance.GenerateOverlay();
|
|
75
|
+
overlay['attribute_framing'] = JSON.parse(attribute_framing_ov);
|
|
76
|
+
}
|
|
69
77
|
else {
|
|
70
78
|
throw new Error(`Unsupported overaly type ${ov_type}. Supported extension overlays at ADC are [ ordering_overlay, unit_framing_overlay, range_overlay, example_overlay, sensitive_overlay ]`);
|
|
71
79
|
}
|
|
@@ -110,7 +118,7 @@ class Extension {
|
|
|
110
118
|
}
|
|
111
119
|
this._community = community;
|
|
112
120
|
this._exensions = _extensions_input;
|
|
113
|
-
this.type = `community/${this._community}/extension/${
|
|
121
|
+
this.type = `community/${this._community}/extension/${EXTENSION_VERSION}`;
|
|
114
122
|
}
|
|
115
123
|
GenerateOverlays() {
|
|
116
124
|
const strategy = this._community === ADC_COMMUNITY ? new ADCOverlayStrategy() : new DefaultOverlayStrategy();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const saidify_1 = require("saidify");
|
|
7
|
+
const canonical_js_1 = __importDefault(require("../../../../utils/canonical.js"));
|
|
4
8
|
class AttributeFraming {
|
|
5
9
|
constructor(dynOverlay) {
|
|
6
10
|
if (!dynOverlay) {
|
|
@@ -8,32 +12,38 @@ class AttributeFraming {
|
|
|
8
12
|
}
|
|
9
13
|
this.dynOverlay = dynOverlay;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
GetFramedAttributes() {
|
|
16
|
+
const attributes = this.dynOverlay.attributes;
|
|
17
|
+
const canonicalizedAttributes = (0, canonical_js_1.default)(attributes);
|
|
18
|
+
const sortedAttributes = JSON.parse(canonicalizedAttributes);
|
|
19
|
+
return sortedAttributes;
|
|
13
20
|
}
|
|
14
21
|
GetId() {
|
|
15
|
-
return this.dynOverlay.
|
|
22
|
+
return this.dynOverlay.framing_metadata.id;
|
|
16
23
|
}
|
|
17
24
|
GetLabel() {
|
|
18
|
-
return this.dynOverlay.
|
|
25
|
+
return this.dynOverlay.framing_metadata.label;
|
|
19
26
|
}
|
|
20
27
|
GetLocation() {
|
|
21
|
-
return this.dynOverlay.
|
|
28
|
+
return this.dynOverlay.framing_metadata.location;
|
|
22
29
|
}
|
|
23
30
|
GetVersion() {
|
|
24
|
-
return this.dynOverlay.
|
|
31
|
+
return this.dynOverlay.framing_metadata.version;
|
|
32
|
+
}
|
|
33
|
+
GetFramingMetadata() {
|
|
34
|
+
return {
|
|
35
|
+
id: this.GetId(),
|
|
36
|
+
label: this.GetLabel(),
|
|
37
|
+
location: this.GetLocation(),
|
|
38
|
+
version: this.GetVersion(),
|
|
39
|
+
};
|
|
25
40
|
}
|
|
26
41
|
toJSON() {
|
|
27
42
|
return {
|
|
28
43
|
d: '',
|
|
29
44
|
type: 'community/overlays/adc/attribute_framing/1.1',
|
|
30
|
-
framing_metadata:
|
|
31
|
-
|
|
32
|
-
label: this.GetLabel(),
|
|
33
|
-
location: this.GetLocation(),
|
|
34
|
-
version: this.GetVersion(),
|
|
35
|
-
},
|
|
36
|
-
attribute_framing: this.GetAttributeFraming(),
|
|
45
|
+
framing_metadata: this.GetFramingMetadata(),
|
|
46
|
+
attributes: this.GetFramedAttributes(),
|
|
37
47
|
};
|
|
38
48
|
}
|
|
39
49
|
Saidifying() {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
// TODO: use canonicalize to consistently order how properties of overlays should appear
|
|
2
|
+
// Do validation for the generation exentension chunck, and parts of oca_package.
|
|
1
3
|
import Ordering from './state/overlays/ordering.js';
|
|
2
4
|
import UnitFraming from './state/overlays/framing/unit_framing.js';
|
|
3
5
|
import ExampleOverlay from './state/overlays/example.js';
|
|
4
6
|
import Range from './state/overlays/range.js';
|
|
5
7
|
import Sensitive from './state/overlays/sensitive.js';
|
|
8
|
+
import AttributeFraming from './state/overlays/framing/attribute_framing.js';
|
|
6
9
|
import { ocabundleDigest, getOcaBundleFromDeps, getDigest, isOcaBundleWithDeps } from '../utils/helpers.js';
|
|
7
10
|
import { saidify } from 'saidify';
|
|
8
11
|
const ADC_COMMUNITY = 'adc';
|
|
9
|
-
const
|
|
12
|
+
const EXTENSION_VERSION = '1.0';
|
|
10
13
|
export class ExtensionState {
|
|
11
14
|
constructor(ExtensionInputJson) {
|
|
12
15
|
this._extension_input_json = ExtensionInputJson;
|
|
@@ -59,6 +62,11 @@ export class Overlay {
|
|
|
59
62
|
const sensitive_ov = sensitive_instance.GenerateOverlay();
|
|
60
63
|
overlay['sensitive'] = JSON.parse(sensitive_ov);
|
|
61
64
|
}
|
|
65
|
+
else if (ov_type === 'attribute_framing_overlay') {
|
|
66
|
+
const attribute_framing_instance = new AttributeFraming(this._overlay.attribute_framing_overlay);
|
|
67
|
+
const attribute_framing_ov = attribute_framing_instance.GenerateOverlay();
|
|
68
|
+
overlay['attribute_framing'] = JSON.parse(attribute_framing_ov);
|
|
69
|
+
}
|
|
62
70
|
else {
|
|
63
71
|
throw new Error(`Unsupported overaly type ${ov_type}. Supported extension overlays at ADC are [ ordering_overlay, unit_framing_overlay, range_overlay, example_overlay, sensitive_overlay ]`);
|
|
64
72
|
}
|
|
@@ -102,7 +110,7 @@ export class Extension {
|
|
|
102
110
|
}
|
|
103
111
|
this._community = community;
|
|
104
112
|
this._exensions = _extensions_input;
|
|
105
|
-
this.type = `community/${this._community}/extension/${
|
|
113
|
+
this.type = `community/${this._community}/extension/${EXTENSION_VERSION}`;
|
|
106
114
|
}
|
|
107
115
|
GenerateOverlays() {
|
|
108
116
|
const strategy = this._community === ADC_COMMUNITY ? new ADCOverlayStrategy() : new DefaultOverlayStrategy();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { saidify } from 'saidify';
|
|
2
|
+
import canonicalize from '../../../../utils/canonical.js';
|
|
2
3
|
class AttributeFraming {
|
|
3
4
|
constructor(dynOverlay) {
|
|
4
5
|
if (!dynOverlay) {
|
|
@@ -6,32 +7,38 @@ class AttributeFraming {
|
|
|
6
7
|
}
|
|
7
8
|
this.dynOverlay = dynOverlay;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
GetFramedAttributes() {
|
|
11
|
+
const attributes = this.dynOverlay.attributes;
|
|
12
|
+
const canonicalizedAttributes = canonicalize(attributes);
|
|
13
|
+
const sortedAttributes = JSON.parse(canonicalizedAttributes);
|
|
14
|
+
return sortedAttributes;
|
|
11
15
|
}
|
|
12
16
|
GetId() {
|
|
13
|
-
return this.dynOverlay.
|
|
17
|
+
return this.dynOverlay.framing_metadata.id;
|
|
14
18
|
}
|
|
15
19
|
GetLabel() {
|
|
16
|
-
return this.dynOverlay.
|
|
20
|
+
return this.dynOverlay.framing_metadata.label;
|
|
17
21
|
}
|
|
18
22
|
GetLocation() {
|
|
19
|
-
return this.dynOverlay.
|
|
23
|
+
return this.dynOverlay.framing_metadata.location;
|
|
20
24
|
}
|
|
21
25
|
GetVersion() {
|
|
22
|
-
return this.dynOverlay.
|
|
26
|
+
return this.dynOverlay.framing_metadata.version;
|
|
27
|
+
}
|
|
28
|
+
GetFramingMetadata() {
|
|
29
|
+
return {
|
|
30
|
+
id: this.GetId(),
|
|
31
|
+
label: this.GetLabel(),
|
|
32
|
+
location: this.GetLocation(),
|
|
33
|
+
version: this.GetVersion(),
|
|
34
|
+
};
|
|
23
35
|
}
|
|
24
36
|
toJSON() {
|
|
25
37
|
return {
|
|
26
38
|
d: '',
|
|
27
39
|
type: 'community/overlays/adc/attribute_framing/1.1',
|
|
28
|
-
framing_metadata:
|
|
29
|
-
|
|
30
|
-
label: this.GetLabel(),
|
|
31
|
-
location: this.GetLocation(),
|
|
32
|
-
version: this.GetVersion(),
|
|
33
|
-
},
|
|
34
|
-
attribute_framing: this.GetAttributeFraming(),
|
|
40
|
+
framing_metadata: this.GetFramingMetadata(),
|
|
41
|
+
attributes: this.GetFramedAttributes(),
|
|
35
42
|
};
|
|
36
43
|
}
|
|
37
44
|
Saidifying() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/oca_extensions/extensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/oca_extensions/extensions.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAQzC,MAAM,WAAW,kBAAkB;IACjC,CAAC,SAAS,EAAE,MAAM,GAAG;QACnB,CAAC,aAAa,EAAE,IAAI,GAAG,UAAU,EAAE,CAAC;KACrC,CAAC;CACH;AAGD,MAAM,WAAW,eAAe;IAC9B,CAAC,SAAS,EAAE,MAAM,GAAG;QACnB,CAAC,aAAa,EAAE,IAAI,GAAG,UAAU,CAAC;KACnC,CAAC;CACH;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,qBAAqB,CAAqB;IAC3C,eAAe,EAAE,eAAe,CAAC;gBAE5B,kBAAkB,EAAE,kBAAkB;IAKlD,OAAO,CAAC,mBAAmB;IAiB3B,IAAW,WAAW,IAAI,eAAe,CAExC;CACF;AAKD,MAAM,WAAW,UAAU;IACzB,CAAC,OAAO,EAAE,MAAM,GAAG;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,qBAAa,OAAQ,YAAW,UAAU;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;gBAEP,iBAAiB,EAAE,UAAU;IAIlC,eAAe,IAAI,QAAQ,CAAC,UAAU,CAAC;CA0C/C;AAiFD,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,IAAI,CAAC;IACR,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,SAAU,YAAW,UAAU;IAC1C,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAM;IACf,UAAU,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,QAAQ,KAAM;gBAEX,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM;IAU5D,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,UAAU;IAKX,iBAAiB,IAAI,GAAG;CAGhC;AAED,KAAK,gBAAgB,GAAG;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,CAAC;AAE9F,cAAM,YAAY;IACT,eAAe,EAAE,gBAAgB,CAAC;IAClC,WAAW,EAAE,GAAG,CAAC;IACjB,eAAe,EAAE,cAAc,CAAC;gBAE3B,oBAAoB,EAAE,kBAAkB,EAAE,UAAU,EAAE,GAAG;IAMrE,IAAW,kBAAkB,IAAI,gBAAgB,CA4BhD;CACF;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -6,11 +6,12 @@ export interface IAttributeFraming {
|
|
|
6
6
|
declare class AttributeFraming implements IAttributeFraming {
|
|
7
7
|
dynOverlay: DynOverlay;
|
|
8
8
|
constructor(dynOverlay: DynOverlay);
|
|
9
|
-
private
|
|
9
|
+
private GetFramedAttributes;
|
|
10
10
|
private GetId;
|
|
11
11
|
private GetLabel;
|
|
12
12
|
private GetLocation;
|
|
13
13
|
private GetVersion;
|
|
14
|
+
private GetFramingMetadata;
|
|
14
15
|
private toJSON;
|
|
15
16
|
private Saidifying;
|
|
16
17
|
GenerateOverlay(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute_framing.d.ts","sourceRoot":"","sources":["../../../../../../src/oca_extensions/state/overlays/framing/attribute_framing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"attribute_framing.d.ts","sourceRoot":"","sources":["../../../../../../src/oca_extensions/state/overlays/framing/attribute_framing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,IAAI,MAAM,CAAC;CAC3B;AAED,cAAM,gBAAiB,YAAW,iBAAiB;IAC1C,UAAU,EAAE,UAAU,CAAC;gBAElB,UAAU,EAAE,UAAU;IAQlC,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,KAAK;IAGb,OAAO,CAAC,QAAQ;IAGhB,OAAO,CAAC,WAAW;IAGnB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,UAAU;IAIX,eAAe,IAAI,MAAM;CAGjC;AACD,eAAe,gBAAgB,CAAC"}
|