capdag 0.89.20894 → 0.90.20904
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 +2 -2
- package/capdag.test.js +11 -11
- package/package.json +1 -1
package/capdag.js
CHANGED
|
@@ -748,7 +748,7 @@ const MEDIA_BOOLEAN = 'media:bool;textable';
|
|
|
748
748
|
// Use MEDIA_JSON for textable JSON objects.
|
|
749
749
|
const MEDIA_OBJECT = 'media:record';
|
|
750
750
|
// Media URN for binary data - the most general media type (no constraints)
|
|
751
|
-
const
|
|
751
|
+
const MEDIA_IDENTITY = 'media:';
|
|
752
752
|
|
|
753
753
|
// Array types - URNs must match base.toml definitions
|
|
754
754
|
// Media URN for string array type - textable with list marker
|
|
@@ -4250,7 +4250,7 @@ module.exports = {
|
|
|
4250
4250
|
MEDIA_NUMBER_ARRAY,
|
|
4251
4251
|
MEDIA_BOOLEAN_ARRAY,
|
|
4252
4252
|
MEDIA_OBJECT_ARRAY,
|
|
4253
|
-
|
|
4253
|
+
MEDIA_IDENTITY,
|
|
4254
4254
|
MEDIA_VOID,
|
|
4255
4255
|
MEDIA_PNG,
|
|
4256
4256
|
MEDIA_AUDIO,
|
package/capdag.test.js
CHANGED
|
@@ -17,7 +17,7 @@ const {
|
|
|
17
17
|
MEDIA_STRING, MEDIA_INTEGER, MEDIA_NUMBER, MEDIA_BOOLEAN,
|
|
18
18
|
MEDIA_OBJECT, MEDIA_STRING_ARRAY, MEDIA_INTEGER_ARRAY,
|
|
19
19
|
MEDIA_NUMBER_ARRAY, MEDIA_BOOLEAN_ARRAY, MEDIA_OBJECT_ARRAY,
|
|
20
|
-
|
|
20
|
+
MEDIA_IDENTITY, MEDIA_VOID, MEDIA_PNG, MEDIA_AUDIO, MEDIA_VIDEO,
|
|
21
21
|
MEDIA_PDF, MEDIA_EPUB, MEDIA_MD, MEDIA_TXT, MEDIA_RST, MEDIA_LOG,
|
|
22
22
|
MEDIA_HTML, MEDIA_XML, MEDIA_JSON, MEDIA_YAML, MEDIA_JSON_SCHEMA,
|
|
23
23
|
MEDIA_MODEL_SPEC, MEDIA_AVAILABILITY_OUTPUT, MEDIA_PATH_OUTPUT,
|
|
@@ -673,7 +673,7 @@ function test050_matchingSemanticsDirectionMismatch() {
|
|
|
673
673
|
`cap:in="${MEDIA_STRING}";op=generate;out="${MEDIA_OBJECT}"`
|
|
674
674
|
);
|
|
675
675
|
const request = CapUrn.fromString(
|
|
676
|
-
`cap:in="${
|
|
676
|
+
`cap:in="${MEDIA_IDENTITY}";op=generate;out="${MEDIA_OBJECT}"`
|
|
677
677
|
);
|
|
678
678
|
assert(!cap.accepts(request), 'Incompatible direction types should not match');
|
|
679
679
|
}
|
|
@@ -812,7 +812,7 @@ function test060_wrongPrefixFails() {
|
|
|
812
812
|
// TEST061: isBinary true when textable tag is absent (binary = not textable)
|
|
813
813
|
function test061_isBinary() {
|
|
814
814
|
// Binary types: no textable tag
|
|
815
|
-
assert(MediaUrn.fromString(
|
|
815
|
+
assert(MediaUrn.fromString(MEDIA_IDENTITY).isBinary(), 'MEDIA_IDENTITY (media:) should be binary');
|
|
816
816
|
assert(MediaUrn.fromString(MEDIA_PNG).isBinary(), 'MEDIA_PNG should be binary');
|
|
817
817
|
assert(MediaUrn.fromString(MEDIA_PDF).isBinary(), 'MEDIA_PDF should be binary');
|
|
818
818
|
assert(MediaUrn.fromString('media:video').isBinary(), 'media:video should be binary');
|
|
@@ -883,7 +883,7 @@ function test067_isText() {
|
|
|
883
883
|
assert(MediaUrn.fromString(MEDIA_INTEGER).isText(), 'MEDIA_INTEGER should be text');
|
|
884
884
|
assert(MediaUrn.fromString(MEDIA_JSON).isText(), 'MEDIA_JSON should be text');
|
|
885
885
|
// Without textable tag, is_text is false
|
|
886
|
-
assert(!MediaUrn.fromString(
|
|
886
|
+
assert(!MediaUrn.fromString(MEDIA_IDENTITY).isText(), 'MEDIA_IDENTITY should not be text');
|
|
887
887
|
assert(!MediaUrn.fromString(MEDIA_PNG).isText(), 'MEDIA_PNG should not be text');
|
|
888
888
|
assert(!MediaUrn.fromString(MEDIA_OBJECT).isText(), 'MEDIA_OBJECT (no textable) should not be text');
|
|
889
889
|
}
|
|
@@ -898,7 +898,7 @@ function test068_isVoid() {
|
|
|
898
898
|
|
|
899
899
|
// TEST071: Parse -> toString -> parse equals original
|
|
900
900
|
function test071_toStringRoundtrip() {
|
|
901
|
-
const constants = [MEDIA_STRING, MEDIA_INTEGER, MEDIA_OBJECT,
|
|
901
|
+
const constants = [MEDIA_STRING, MEDIA_INTEGER, MEDIA_OBJECT, MEDIA_IDENTITY, MEDIA_PDF, MEDIA_JSON];
|
|
902
902
|
for (const constant of constants) {
|
|
903
903
|
const parsed = MediaUrn.fromString(constant);
|
|
904
904
|
const reparsed = MediaUrn.fromString(parsed.toString());
|
|
@@ -912,7 +912,7 @@ function test072_constantsParse() {
|
|
|
912
912
|
MEDIA_STRING, MEDIA_INTEGER, MEDIA_NUMBER, MEDIA_BOOLEAN,
|
|
913
913
|
MEDIA_OBJECT, MEDIA_STRING_ARRAY, MEDIA_INTEGER_ARRAY,
|
|
914
914
|
MEDIA_NUMBER_ARRAY, MEDIA_BOOLEAN_ARRAY, MEDIA_OBJECT_ARRAY,
|
|
915
|
-
|
|
915
|
+
MEDIA_IDENTITY, MEDIA_VOID, MEDIA_PNG, MEDIA_PDF, MEDIA_EPUB,
|
|
916
916
|
MEDIA_MD, MEDIA_TXT, MEDIA_RST, MEDIA_LOG, MEDIA_HTML, MEDIA_XML,
|
|
917
917
|
MEDIA_JSON, MEDIA_YAML, MEDIA_JSON_SCHEMA, MEDIA_AUDIO, MEDIA_VIDEO,
|
|
918
918
|
MEDIA_MODEL_SPEC, MEDIA_AVAILABILITY_OUTPUT, MEDIA_PATH_OUTPUT,
|
|
@@ -946,7 +946,7 @@ function test075_accepts() {
|
|
|
946
946
|
const sameReq = MediaUrn.fromString(MEDIA_PDF);
|
|
947
947
|
assert(handler.accepts(sameReq), 'Handler should accept same request');
|
|
948
948
|
|
|
949
|
-
const generalHandler = MediaUrn.fromString(
|
|
949
|
+
const generalHandler = MediaUrn.fromString(MEDIA_IDENTITY);
|
|
950
950
|
const specificReq = MediaUrn.fromString(MEDIA_PDF);
|
|
951
951
|
assert(generalHandler.accepts(specificReq), 'General handler should accept specific request');
|
|
952
952
|
}
|
|
@@ -1032,7 +1032,7 @@ function test093_resolveUnresolvableFailsHard() {
|
|
|
1032
1032
|
|
|
1033
1033
|
// TEST099: MediaSpec with media: (no textable tag) -> isBinary() true
|
|
1034
1034
|
function test099_resolvedIsBinary() {
|
|
1035
|
-
const spec = new MediaSpec('application/octet-stream', null, null, 'Binary', null,
|
|
1035
|
+
const spec = new MediaSpec('application/octet-stream', null, null, 'Binary', null, MEDIA_IDENTITY);
|
|
1036
1036
|
assert(spec.isBinary(), 'Resolved binary spec should be binary');
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
@@ -2326,7 +2326,7 @@ function test549_isNumeric() {
|
|
|
2326
2326
|
// Non-numeric types
|
|
2327
2327
|
assert(!MediaUrn.fromString(MEDIA_STRING).isNumeric(), 'MEDIA_STRING should not be numeric');
|
|
2328
2328
|
assert(!MediaUrn.fromString(MEDIA_BOOLEAN).isNumeric(), 'MEDIA_BOOLEAN should not be numeric');
|
|
2329
|
-
assert(!MediaUrn.fromString(
|
|
2329
|
+
assert(!MediaUrn.fromString(MEDIA_IDENTITY).isNumeric(), 'MEDIA_IDENTITY should not be numeric');
|
|
2330
2330
|
}
|
|
2331
2331
|
|
|
2332
2332
|
// TEST550: isBool returns true only when bool marker tag is present
|
|
@@ -2338,7 +2338,7 @@ function test550_isBool() {
|
|
|
2338
2338
|
// Non-bool types
|
|
2339
2339
|
assert(!MediaUrn.fromString(MEDIA_STRING).isBool(), 'MEDIA_STRING should not be bool');
|
|
2340
2340
|
assert(!MediaUrn.fromString(MEDIA_INTEGER).isBool(), 'MEDIA_INTEGER should not be bool');
|
|
2341
|
-
assert(!MediaUrn.fromString(
|
|
2341
|
+
assert(!MediaUrn.fromString(MEDIA_IDENTITY).isBool(), 'MEDIA_IDENTITY should not be bool');
|
|
2342
2342
|
}
|
|
2343
2343
|
|
|
2344
2344
|
// TEST551: isFilePath returns true for scalar file-path, false for array
|
|
@@ -2348,7 +2348,7 @@ function test551_isFilePath() {
|
|
|
2348
2348
|
assert(!MediaUrn.fromString(MEDIA_FILE_PATH_ARRAY).isFilePath(), 'MEDIA_FILE_PATH_ARRAY should not be isFilePath');
|
|
2349
2349
|
// Non-file-path types
|
|
2350
2350
|
assert(!MediaUrn.fromString(MEDIA_STRING).isFilePath(), 'MEDIA_STRING should not be file-path');
|
|
2351
|
-
assert(!MediaUrn.fromString(
|
|
2351
|
+
assert(!MediaUrn.fromString(MEDIA_IDENTITY).isFilePath(), 'MEDIA_IDENTITY should not be file-path');
|
|
2352
2352
|
}
|
|
2353
2353
|
|
|
2354
2354
|
// TEST552: isFilePathArray returns true for list file-path, false for scalar
|
package/package.json
CHANGED