capdag 0.96.25093 → 0.100.226
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/capdag.js +3 -0
- package/capdag.test.js +4 -4
- package/package.json +2 -2
package/capdag.js
CHANGED
|
@@ -1781,6 +1781,7 @@ class CapArg {
|
|
|
1781
1781
|
constructor(mediaUrn, required, sources, options = {}) {
|
|
1782
1782
|
this.media_urn = mediaUrn;
|
|
1783
1783
|
this.required = required;
|
|
1784
|
+
this.is_sequence = options.is_sequence || false;
|
|
1784
1785
|
this.sources = sources; // Array of ArgSource
|
|
1785
1786
|
this.arg_description = options.arg_description || null;
|
|
1786
1787
|
this.default_value = options.default_value !== undefined ? options.default_value : null;
|
|
@@ -1799,6 +1800,7 @@ class CapArg {
|
|
|
1799
1800
|
json.required,
|
|
1800
1801
|
sources,
|
|
1801
1802
|
{
|
|
1803
|
+
is_sequence: json.is_sequence,
|
|
1802
1804
|
arg_description: json.arg_description,
|
|
1803
1805
|
default_value: json.default_value,
|
|
1804
1806
|
metadata: json.metadata
|
|
@@ -1816,6 +1818,7 @@ class CapArg {
|
|
|
1816
1818
|
required: this.required,
|
|
1817
1819
|
sources: this.sources.map(s => s.toJSON())
|
|
1818
1820
|
};
|
|
1821
|
+
if (this.is_sequence) result.is_sequence = true;
|
|
1819
1822
|
if (this.arg_description) result.arg_description = this.arg_description;
|
|
1820
1823
|
if (this.default_value !== null && this.default_value !== undefined) {
|
|
1821
1824
|
result.default_value = this.default_value;
|
package/capdag.test.js
CHANGED
|
@@ -1072,7 +1072,7 @@ function test104_resolvedIsText() {
|
|
|
1072
1072
|
function test105_metadataPropagation() {
|
|
1073
1073
|
const mediaSpecs = [
|
|
1074
1074
|
{
|
|
1075
|
-
urn: 'media:custom-setting
|
|
1075
|
+
urn: 'media:custom-setting',
|
|
1076
1076
|
media_type: 'text/plain',
|
|
1077
1077
|
title: 'Custom Setting',
|
|
1078
1078
|
profile_uri: 'https://example.com/schema',
|
|
@@ -1084,7 +1084,7 @@ function test105_metadataPropagation() {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
];
|
|
1087
|
-
const resolved = resolveMediaUrn('media:custom-setting
|
|
1087
|
+
const resolved = resolveMediaUrn('media:custom-setting', mediaSpecs);
|
|
1088
1088
|
assert(resolved.metadata !== null, 'Should have metadata');
|
|
1089
1089
|
assertEqual(resolved.metadata.category_key, 'interface', 'Should propagate category_key');
|
|
1090
1090
|
assertEqual(resolved.metadata.ui_type, 'SETTING_UI_TYPE_CHECKBOX', 'Should propagate ui_type');
|
|
@@ -1095,14 +1095,14 @@ function test105_metadataPropagation() {
|
|
|
1095
1095
|
function test106_metadataWithValidation() {
|
|
1096
1096
|
const mediaSpecs = [
|
|
1097
1097
|
{
|
|
1098
|
-
urn: 'media:bounded-number;numeric
|
|
1098
|
+
urn: 'media:bounded-number;numeric',
|
|
1099
1099
|
media_type: 'text/plain',
|
|
1100
1100
|
title: 'Bounded Number',
|
|
1101
1101
|
validation: { min: 0, max: 100 },
|
|
1102
1102
|
metadata: { category_key: 'inference', ui_type: 'SETTING_UI_TYPE_SLIDER' }
|
|
1103
1103
|
}
|
|
1104
1104
|
];
|
|
1105
|
-
const resolved = resolveMediaUrn('media:bounded-number;numeric
|
|
1105
|
+
const resolved = resolveMediaUrn('media:bounded-number;numeric', mediaSpecs);
|
|
1106
1106
|
assert(resolved.validation !== null, 'Should have validation');
|
|
1107
1107
|
assertEqual(resolved.validation.min, 0, 'Should have min');
|
|
1108
1108
|
assertEqual(resolved.validation.max, 100, 'Should have max');
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Bahram Joharshamshiri",
|
|
3
3
|
"dependencies": {
|
|
4
4
|
"peggy": "^5.1.0",
|
|
5
|
-
"tagged-urn": "^0.
|
|
5
|
+
"tagged-urn": "^0.32.4960"
|
|
6
6
|
},
|
|
7
7
|
"description": "JavaScript implementation of Cap URN (Capability Uniform Resource Names) with strict validation and matching",
|
|
8
8
|
"engines": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"pretest": "npm run build:parser",
|
|
38
38
|
"test": "node capdag.test.js"
|
|
39
39
|
},
|
|
40
|
-
"version": "0.
|
|
40
|
+
"version": "0.100.226"
|
|
41
41
|
}
|