dcql 0.2.11 → 0.2.13

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 (103) hide show
  1. package/dist/src/dcql-error/e-base.d.ts.map +1 -0
  2. package/dist/src/dcql-error/e-base.js.map +1 -0
  3. package/dist/src/{e-dcql.d.ts → dcql-error/e-dcql.d.ts} +12 -0
  4. package/dist/src/dcql-error/e-dcql.d.ts.map +1 -0
  5. package/dist/src/{e-dcql.js → dcql-error/e-dcql.js} +14 -2
  6. package/dist/src/dcql-error/e-dcql.js.map +1 -0
  7. package/dist/src/dcql-error/index.d.ts +3 -0
  8. package/dist/src/dcql-error/index.d.ts.map +1 -0
  9. package/dist/src/dcql-error/index.js +23 -0
  10. package/dist/src/dcql-error/index.js.map +1 -0
  11. package/dist/src/dcql-parser/claims-path.test.d.ts.map +1 -0
  12. package/dist/src/{dcql-query → dcql-parser}/claims-path.test.js +1 -1
  13. package/dist/src/dcql-parser/claims-path.test.js.map +1 -0
  14. package/dist/src/{dcql-query-result → dcql-parser}/dcql-claims-query-result.d.ts +5 -2
  15. package/dist/src/dcql-parser/dcql-claims-query-result.d.ts.map +1 -0
  16. package/dist/src/{dcql-query-result → dcql-parser}/dcql-claims-query-result.js +18 -15
  17. package/dist/src/dcql-parser/dcql-claims-query-result.js.map +1 -0
  18. package/dist/src/dcql-parser/dcql-credential-query-result.d.ts +8 -0
  19. package/dist/src/dcql-parser/dcql-credential-query-result.d.ts.map +1 -0
  20. package/dist/src/{dcql-query-result → dcql-parser}/dcql-credential-query-result.js +4 -4
  21. package/dist/src/dcql-parser/dcql-credential-query-result.js.map +1 -0
  22. package/dist/src/dcql-presentation/index.d.ts +3 -2
  23. package/dist/src/dcql-presentation/index.d.ts.map +1 -1
  24. package/dist/src/dcql-presentation/index.js +10 -16
  25. package/dist/src/dcql-presentation/index.js.map +1 -1
  26. package/dist/src/dcql-presentation/m-dcql-credential-presentation.d.ts +45 -0
  27. package/dist/src/dcql-presentation/m-dcql-credential-presentation.d.ts.map +1 -0
  28. package/dist/src/dcql-presentation/m-dcql-credential-presentation.js +52 -0
  29. package/dist/src/dcql-presentation/m-dcql-credential-presentation.js.map +1 -0
  30. package/dist/src/dcql-presentation/{m-dcql-presentation-query.d.ts → m-dcql-presentation-result.d.ts} +204 -381
  31. package/dist/src/dcql-presentation/m-dcql-presentation-result.d.ts.map +1 -0
  32. package/dist/src/dcql-presentation/m-dcql-presentation-result.js +127 -0
  33. package/dist/src/dcql-presentation/m-dcql-presentation-result.js.map +1 -0
  34. package/dist/src/dcql-presentation/{m-dcql-presentation-record.d.ts → m-dcql-presentation.d.ts} +3 -3
  35. package/dist/src/dcql-presentation/m-dcql-presentation.d.ts.map +1 -0
  36. package/dist/src/dcql-presentation/{m-dcql-presentation-record.js → m-dcql-presentation.js} +10 -10
  37. package/dist/src/dcql-presentation/m-dcql-presentation.js.map +1 -0
  38. package/dist/src/dcql-query/dcql-query.test.js +22 -19
  39. package/dist/src/dcql-query/dcql-query.test.js.map +1 -1
  40. package/dist/src/dcql-query/index.d.ts +5 -0
  41. package/dist/src/dcql-query/index.d.ts.map +1 -0
  42. package/dist/src/dcql-query/index.js +12 -0
  43. package/dist/src/dcql-query/index.js.map +1 -0
  44. package/dist/src/dcql-query/m-dcql-credential-query.js +1 -1
  45. package/dist/src/dcql-query/m-dcql-credential-query.js.map +1 -1
  46. package/dist/src/dcql-query/m-dcql-query.d.ts +199 -52
  47. package/dist/src/dcql-query/m-dcql-query.d.ts.map +1 -1
  48. package/dist/src/dcql-query/m-dcql-query.js +4 -6
  49. package/dist/src/dcql-query/m-dcql-query.js.map +1 -1
  50. package/dist/src/dcql-query-result/index.d.ts +3 -0
  51. package/dist/src/dcql-query-result/index.d.ts.map +1 -0
  52. package/dist/src/dcql-query-result/index.js +8 -0
  53. package/dist/src/dcql-query-result/index.js.map +1 -0
  54. package/dist/src/dcql-query-result/m-dcql-query-result.d.ts +366 -80
  55. package/dist/src/dcql-query-result/m-dcql-query-result.d.ts.map +1 -1
  56. package/dist/src/dcql-query-result/m-dcql-query-result.js +12 -17
  57. package/dist/src/dcql-query-result/m-dcql-query-result.js.map +1 -1
  58. package/dist/src/dcql-query-result/run-dcql-query.d.ts +8 -0
  59. package/dist/src/dcql-query-result/run-dcql-query.d.ts.map +1 -0
  60. package/dist/src/{dcql-query/dcql-query.js → dcql-query-result/run-dcql-query.js} +14 -10
  61. package/dist/src/dcql-query-result/run-dcql-query.js.map +1 -0
  62. package/dist/src/index.d.ts +5 -8
  63. package/dist/src/index.d.ts.map +1 -1
  64. package/dist/src/index.js +10 -14
  65. package/dist/src/index.js.map +1 -1
  66. package/dist/src/u-dcql-credential.d.ts +77 -0
  67. package/dist/src/u-dcql-credential.d.ts.map +1 -0
  68. package/dist/src/u-dcql-credential.js +68 -0
  69. package/dist/src/u-dcql-credential.js.map +1 -0
  70. package/dist/src/u-model.d.ts +27 -0
  71. package/dist/src/u-model.d.ts.map +1 -0
  72. package/dist/src/{u-dcql-credential-representation.js → u-model.js} +39 -6
  73. package/dist/src/u-model.js.map +1 -0
  74. package/package.json +1 -1
  75. package/dist/src/dcql-presentation/m-dcql-presentation-query.d.ts.map +0 -1
  76. package/dist/src/dcql-presentation/m-dcql-presentation-query.js +0 -132
  77. package/dist/src/dcql-presentation/m-dcql-presentation-query.js.map +0 -1
  78. package/dist/src/dcql-presentation/m-dcql-presentation-record.d.ts.map +0 -1
  79. package/dist/src/dcql-presentation/m-dcql-presentation-record.js.map +0 -1
  80. package/dist/src/dcql-query/claims-path.d.ts +0 -14
  81. package/dist/src/dcql-query/claims-path.d.ts.map +0 -1
  82. package/dist/src/dcql-query/claims-path.js +0 -23
  83. package/dist/src/dcql-query/claims-path.js.map +0 -1
  84. package/dist/src/dcql-query/claims-path.test.d.ts.map +0 -1
  85. package/dist/src/dcql-query/claims-path.test.js.map +0 -1
  86. package/dist/src/dcql-query/dcql-query.d.ts +0 -8
  87. package/dist/src/dcql-query/dcql-query.d.ts.map +0 -1
  88. package/dist/src/dcql-query/dcql-query.js.map +0 -1
  89. package/dist/src/dcql-query-result/dcql-claims-query-result.d.ts.map +0 -1
  90. package/dist/src/dcql-query-result/dcql-claims-query-result.js.map +0 -1
  91. package/dist/src/dcql-query-result/dcql-credential-query-result.d.ts +0 -8
  92. package/dist/src/dcql-query-result/dcql-credential-query-result.d.ts.map +0 -1
  93. package/dist/src/dcql-query-result/dcql-credential-query-result.js.map +0 -1
  94. package/dist/src/e-base.d.ts.map +0 -1
  95. package/dist/src/e-base.js.map +0 -1
  96. package/dist/src/e-dcql.d.ts.map +0 -1
  97. package/dist/src/e-dcql.js.map +0 -1
  98. package/dist/src/u-dcql-credential-representation.d.ts +0 -29
  99. package/dist/src/u-dcql-credential-representation.d.ts.map +0 -1
  100. package/dist/src/u-dcql-credential-representation.js.map +0 -1
  101. /package/dist/src/{e-base.d.ts → dcql-error/e-base.d.ts} +0 -0
  102. /package/dist/src/{e-base.js → dcql-error/e-base.js} +0 -0
  103. /package/dist/src/{dcql-query → dcql-parser}/claims-path.test.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"m-dcql-query-result.d.ts","sourceRoot":"","sources":["../../../src/dcql-query-result/m-dcql-query-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAY7B,yBAAiB,eAAe,CAAC;IAC/B,MAAM,CAAC,MAAM,yBAAyB;;iBAAoC,CAAC;IAC3E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,yBAAyB,CACjC,CAAC;IAEF,MAAM,CAAC,MAAM,2BAA2B;;;iBAGtC,CAAC;IACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CACpD,OAAO,2BAA2B,CACnC,CAAC;IAEF,MAAM,CAAC,MAAM,0BAA0B;;;iBAGrC,CAAC;IACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CACnD,OAAO,0BAA0B,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 = require("../dcql-query/m-dcql-credential-query.js");
29
29
  const m_dcql_credential_set_query_js_1 = require("../dcql-query/m-dcql-credential-set-query.js");
30
- const u_dcql_credential_representation_js_1 = require("../u-dcql-credential-representation.js");
30
+ const u_dcql_credential_js_1 = require("../u-dcql-credential.js");
31
31
  const u_dcql_js_1 = require("../u-dcql.js");
32
32
  var DcqlQueryResult;
33
33
  (function (DcqlQueryResult) {
34
- DcqlQueryResult.vW3cCredentialParseOutput = v.object({ claims: u_dcql_js_1.vJsonRecord });
35
- DcqlQueryResult.vSdJwtCredentialParseOutput = v.object({
36
- vct: v.string(),
37
- claims: u_dcql_js_1.vJsonRecord,
38
- });
39
- DcqlQueryResult.vMdocCredentialParseOutput = v.object({
40
- docType: v.string(),
41
- namespaces: u_dcql_credential_representation_js_1.DcqlMdocRepresentation.vNamespaces,
42
- });
43
34
  const vCredentialParseSuccess = v.object({
44
35
  ...u_dcql_js_1.vParseSuccess.entries,
45
- output: v.union([
46
- DcqlQueryResult.vW3cCredentialParseOutput,
47
- DcqlQueryResult.vSdJwtCredentialParseOutput,
48
- DcqlQueryResult.vMdocCredentialParseOutput,
49
- ]),
36
+ output: u_dcql_credential_js_1.DcqlCredential.model.v,
50
37
  });
51
38
  DcqlQueryResult.vCredentialParseResult = v.union([
52
39
  vCredentialParseSuccess,
@@ -58,11 +45,19 @@ var DcqlQueryResult;
58
45
  credential_matches: v.record(v.pipe(v.string(), v.regex(u_dcql_js_1.idRegex)), v.union([
59
46
  v.object({
60
47
  ...vCredentialParseSuccess.entries,
61
- all: v.pipe(v.array(v.array(v.union([v.undefined(), vCredentialParseSuccess, u_dcql_js_1.vParseFailure]))), (0, u_dcql_js_1.vNonEmptyArray)()),
48
+ all: v.pipe(v.array(v.pipe(v.array(v.union([
49
+ v.undefined(),
50
+ vCredentialParseSuccess,
51
+ u_dcql_js_1.vParseFailure,
52
+ ])), (0, u_dcql_js_1.vNonEmptyArray)())), (0, u_dcql_js_1.vNonEmptyArray)()),
62
53
  }),
63
54
  v.object({
64
55
  ...u_dcql_js_1.vParseFailure.entries,
65
- all: v.pipe(v.array(v.array(v.union([v.undefined(), vCredentialParseSuccess, u_dcql_js_1.vParseFailure]))), (0, u_dcql_js_1.vNonEmptyArray)()),
56
+ all: v.pipe(v.array(v.pipe(v.array(v.union([
57
+ v.undefined(),
58
+ vCredentialParseSuccess,
59
+ u_dcql_js_1.vParseFailure,
60
+ ])), (0, u_dcql_js_1.vNonEmptyArray)())), (0, u_dcql_js_1.vNonEmptyArray)()),
66
61
  }),
67
62
  ])),
68
63
  credential_sets: v.optional(v.pipe(v.array(v.object({
@@ -1 +1 @@
1
- {"version":3,"file":"m-dcql-query-result.js","sourceRoot":"","sources":["../../../src/dcql-query-result/m-dcql-query-result.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,yFAA+E;AAC/E,iGAAkF;AAClF,gGAAgF;AAChF,4CAMsB;AAEtB,IAAiB,eAAe,CAqH/B;AArHD,WAAiB,eAAe;IACjB,yCAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,uBAAW,EAAE,CAAC,CAAC;IAK9D,2CAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;QAClD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,MAAM,EAAE,uBAAW;KACpB,CAAC,CAAC;IAKU,0CAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;QACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,UAAU,EAAE,4DAAsB,CAAC,WAAW;KAC/C,CAAC,CAAC;IAKH,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;QACvC,GAAG,yBAAa,CAAC,OAAO;QACxB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;YACd,gBAAA,yBAAyB;YACzB,gBAAA,2BAA2B;YAC3B,gBAAA,0BAA0B;SAC3B,CAAC;KACH,CAAC,CAAC;IAMU,sCAAs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CAAC,CAAC,CACjE,CACF,EACD,IAAA,0BAAc,GAAE,CACjB;aACF,CAAC;SACH,CAAC,CACH;QAED,eAAe,EAAE,CAAC,CAAC,QAAQ,CACzB,CAAC,CAAC,IAAI,CACJ,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;YACP,GAAG,mDAAkB,CAAC,MAAM,CAAC,OAAO;YACpC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC;gBACxB,CAAC,CAAC,SAAS,EAAE;gBACb,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,IAAA,0BAAc,GAAE,CAAC;aACvD,CAAC;SACH,CAAC,CACH,EACD,IAAA,0BAAc,GAAE,EAChB,CAAC,CAAC,WAAW,CACX,yJAAyJ,CAC1J,CACF,CACF;QAED,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;KAC5B,CAAC,CAAC;AAML,CAAC,EArHgB,eAAe,+BAAf,eAAe,QAqH/B"}
1
+ {"version":3,"file":"m-dcql-query-result.js","sourceRoot":"","sources":["../../../src/dcql-query-result/m-dcql-query-result.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,yFAA+E;AAC/E,iGAAkF;AAClF,kEAAyD;AACzD,4CAKsB;AAEtB,IAAiB,eAAe,CA0G/B;AA1GD,WAAiB,eAAe;IAC9B,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;QACvC,GAAG,yBAAa,CAAC,OAAO;QACxB,MAAM,EAAE,qCAAc,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAC,CAAC;IAMU,sCAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;QAC5C,uBAAuB;QACvB,yBAAa;KACd,CAAC,CAAC;IAMU,sCAAsB,GAAG,CAAC,CAAC,IAAI,CAC1C,CAAC,CAAC,KAAK,CACL,CA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GAAE,CACjB;aACF,CAAC;SACH,CAAC,CACH;QAED,eAAe,EAAE,CAAC,CAAC,QAAQ,CACzB,CAAC,CAAC,IAAI,CACJ,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;YACP,GAAG,mDAAkB,CAAC,MAAM,CAAC,OAAO;YACpC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC;gBACxB,CAAC,CAAC,SAAS,EAAE;gBACb,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,IAAA,0BAAc,GAAE,CAAC;aACvD,CAAC;SACH,CAAC,CACH,EACD,IAAA,0BAAc,GAAE,EAChB,CAAC,CAAC,WAAW,CACX,yJAAyJ,CAC1J,CACF,CACF;QAED,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;KAC5B,CAAC,CAAC;AAML,CAAC,EA1GgB,eAAe,+BAAf,eAAe,QA0G/B"}
@@ -0,0 +1,8 @@
1
+ import type { DcqlQuery } from '../dcql-query/m-dcql-query.js';
2
+ import type { DcqlCredential } from '../u-dcql-credential.js';
3
+ import type { DcqlQueryResult } from './m-dcql-query-result.js';
4
+ export declare const runDcqlQuery: (dcqlQuery: DcqlQuery.Output, ctx: {
5
+ credentials: DcqlCredential[];
6
+ presentation: boolean;
7
+ }) => DcqlQueryResult;
8
+ //# sourceMappingURL=run-dcql-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-dcql-query.d.ts","sourceRoot":"","sources":["../../../src/dcql-query-result/run-dcql-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,eAAO,MAAM,YAAY,cACZ,SAAS,CAAC,MAAM,OACtB;IACH,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,YAAY,EAAE,OAAO,CAAC;CACvB,KACA,eA4EF,CAAC"}
@@ -1,25 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.performDcqlQuery = void 0;
4
- const dcql_credential_query_result_js_1 = require("../dcql-query-result/dcql-credential-query-result.js");
5
- const performDcqlQuery = (dcqlQuery, ctx) => {
3
+ exports.runDcqlQuery = void 0;
4
+ const dcql_credential_query_result_js_1 = require("../dcql-parser/dcql-credential-query-result.js");
5
+ const runDcqlQuery = (dcqlQuery, ctx) => {
6
6
  const credentialQueriesResults = Object.fromEntries(dcqlQuery.credentials.map(credentialQuery => [
7
7
  credentialQuery.id,
8
- (0, dcql_credential_query_result_js_1.queryCredentialFromCredentialQuery)(credentialQuery, ctx),
8
+ (0, dcql_credential_query_result_js_1.runCredentialQuery)(credentialQuery, ctx),
9
9
  ]));
10
10
  const credentialMatches = Object.fromEntries(Object.entries(credentialQueriesResults).map(([key, credentialQueryResult]) => {
11
11
  // Find the best match for each credential query
12
12
  let bestMatch = undefined;
13
13
  for (const credentialParseResult of credentialQueryResult) {
14
14
  const bestMatchForCredential = credentialParseResult.find(result => result?.success == true);
15
- if (!bestMatch) {
16
- bestMatch = bestMatchForCredential;
15
+ if (!bestMatch && bestMatchForCredential) {
16
+ const { issues, ...matchWithoutIssues } = bestMatchForCredential;
17
+ bestMatch = matchWithoutIssues;
17
18
  continue;
18
19
  }
19
20
  if (bestMatchForCredential &&
20
21
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
21
- bestMatchForCredential.claim_set_index < bestMatch.claim_set_index) {
22
- bestMatch = bestMatchForCredential;
22
+ bestMatchForCredential.claim_set_index <
23
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
24
+ bestMatch?.claim_set_index) {
25
+ const { issues, ...matchWithoutIssues } = bestMatchForCredential;
26
+ bestMatch = matchWithoutIssues;
23
27
  }
24
28
  }
25
29
  return [
@@ -49,5 +53,5 @@ const performDcqlQuery = (dcqlQuery, ctx) => {
49
53
  credential_sets: credentialSetResults,
50
54
  };
51
55
  };
52
- exports.performDcqlQuery = performDcqlQuery;
53
- //# sourceMappingURL=dcql-query.js.map
56
+ exports.runDcqlQuery = runDcqlQuery;
57
+ //# sourceMappingURL=run-dcql-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-dcql-query.js","sourceRoot":"","sources":["../../../src/dcql-query-result/run-dcql-query.ts"],"names":[],"mappings":";;;AAAA,oGAAoF;AAK7E,MAAM,YAAY,GAAG,CAC1B,SAA2B,EAC3B,GAGC,EACgB,EAAE;IACnB,MAAM,wBAAwB,GAAG,MAAM,CAAC,WAAW,CACjD,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;QAC3C,eAAe,CAAC,EAAE;QAClB,IAAA,oDAAkB,EAAC,eAAe,EAAE,GAAG,CAAC;KACzC,CAAC,CACH,CAAC;IAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAC1C,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAC1C,CAAC,CAAC,GAAG,EAAE,qBAAqB,CAAC,EAAE,EAAE;QAC/B,gDAAgD;QAChD,IAAI,SAAS,GACX,SAAS,CAAC;QAEZ,KAAK,MAAM,qBAAqB,IAAI,qBAAqB,EAAE,CAAC;YAC1D,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,IAAI,CACvD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,IAAI,IAAI,CAClC,CAAC;YAEF,IAAI,CAAC,SAAS,IAAI,sBAAsB,EAAE,CAAC;gBACzC,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,GAAG,sBAAsB,CAAC;gBACjE,SAAS,GAAG,kBAAkB,CAAC;gBAC/B,SAAS;YACX,CAA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AAO,CAAC,CAAC;IAEnE,OAAO;QACL,GAAG,SAAS;QACZ,cAAc,EAAE,gBAAgB;QAChC,kBAAkB,EAChB,iBAA0D;QAC5D,eAAe,EAAE,oBAAoB;KACtC,CAAC;AACJ,CAAC,CAAC;AAlFW,QAAA,YAAY,gBAkFvB"}
@@ -1,9 +1,6 @@
1
- export { DcqlPresentationQueryResult, DcqlPresentationRecord, } from './dcql-presentation/index.js';
2
- export { DcqlQueryResult } from './dcql-query-result/m-dcql-query-result.js';
3
- export { DcqlClaimsQuery as ClaimsQuery } from './dcql-query/m-dcql-claims-query.js';
4
- export { DcqlCredentialQuery } from './dcql-query/m-dcql-credential-query.js';
5
- export { DcqlQuery } from './dcql-query/m-dcql-query.js';
6
- export * from './e-base.js';
7
- export * from './e-dcql.js';
8
- export type { DcqlCredentialRepresentation, DcqlMdocRepresentation, DcqlPresentationRepresentation, DcqlSdJwtVcRepresentation, DcqlW3cVcRepresentation, } from './u-dcql-credential-representation.js';
1
+ export * from './dcql-error/index.js';
2
+ export * from './dcql-presentation/index.js';
3
+ export * from './dcql-query-result/index.js';
4
+ export * from './dcql-query/index.js';
5
+ export { DcqlCredential, DcqlMdocCredential, DcqlSdJwtVcCredential, DcqlW3cVcCredential, } from './u-dcql-credential.js';
9
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAE5B,YAAY,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC"}
package/dist/src/index.js CHANGED
@@ -14,18 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DcqlQuery = exports.DcqlCredentialQuery = exports.ClaimsQuery = exports.DcqlQueryResult = exports.DcqlPresentationRecord = exports.DcqlPresentationQueryResult = void 0;
18
- var index_js_1 = require("./dcql-presentation/index.js");
19
- Object.defineProperty(exports, "DcqlPresentationQueryResult", { enumerable: true, get: function () { return index_js_1.DcqlPresentationQueryResult; } });
20
- Object.defineProperty(exports, "DcqlPresentationRecord", { enumerable: true, get: function () { return index_js_1.DcqlPresentationRecord; } });
21
- var m_dcql_query_result_js_1 = require("./dcql-query-result/m-dcql-query-result.js");
22
- Object.defineProperty(exports, "DcqlQueryResult", { enumerable: true, get: function () { return m_dcql_query_result_js_1.DcqlQueryResult; } });
23
- var m_dcql_claims_query_js_1 = require("./dcql-query/m-dcql-claims-query.js");
24
- Object.defineProperty(exports, "ClaimsQuery", { enumerable: true, get: function () { return m_dcql_claims_query_js_1.DcqlClaimsQuery; } });
25
- var m_dcql_credential_query_js_1 = require("./dcql-query/m-dcql-credential-query.js");
26
- Object.defineProperty(exports, "DcqlCredentialQuery", { enumerable: true, get: function () { return m_dcql_credential_query_js_1.DcqlCredentialQuery; } });
27
- var m_dcql_query_js_1 = require("./dcql-query/m-dcql-query.js");
28
- Object.defineProperty(exports, "DcqlQuery", { enumerable: true, get: function () { return m_dcql_query_js_1.DcqlQuery; } });
29
- __exportStar(require("./e-base.js"), exports);
30
- __exportStar(require("./e-dcql.js"), exports);
17
+ exports.DcqlW3cVcCredential = exports.DcqlSdJwtVcCredential = exports.DcqlMdocCredential = exports.DcqlCredential = void 0;
18
+ __exportStar(require("./dcql-error/index.js"), exports);
19
+ __exportStar(require("./dcql-presentation/index.js"), exports);
20
+ __exportStar(require("./dcql-query-result/index.js"), exports);
21
+ __exportStar(require("./dcql-query/index.js"), exports);
22
+ var u_dcql_credential_js_1 = require("./u-dcql-credential.js");
23
+ Object.defineProperty(exports, "DcqlCredential", { enumerable: true, get: function () { return u_dcql_credential_js_1.DcqlCredential; } });
24
+ Object.defineProperty(exports, "DcqlMdocCredential", { enumerable: true, get: function () { return u_dcql_credential_js_1.DcqlMdocCredential; } });
25
+ Object.defineProperty(exports, "DcqlSdJwtVcCredential", { enumerable: true, get: function () { return u_dcql_credential_js_1.DcqlSdJwtVcCredential; } });
26
+ Object.defineProperty(exports, "DcqlW3cVcCredential", { enumerable: true, get: function () { return u_dcql_credential_js_1.DcqlW3cVcCredential; } });
31
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAGsC;AAFpC,uHAAA,2BAA2B,OAAA;AAC3B,kHAAA,sBAAsB,OAAA;AAExB,qFAA6E;AAApE,yHAAA,eAAe,OAAA;AACxB,8EAAqF;AAA5E,qHAAA,eAAe,OAAe;AACvC,sFAA8E;AAArE,iIAAA,mBAAmB,OAAA;AAC5B,gEAAyD;AAAhD,4GAAA,SAAS,OAAA;AAClB,8CAA4B;AAC5B,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,+DAA6C;AAC7C,+DAA6C;AAC7C,wDAAsC;AAEtC,+DAKgC;AAJ9B,sHAAA,cAAc,OAAA;AACd,0HAAA,kBAAkB,OAAA;AAClB,6HAAA,qBAAqB,OAAA;AACrB,2HAAA,mBAAmB,OAAA"}
@@ -0,0 +1,77 @@
1
+ import * as v from 'valibot';
2
+ import type { InferModelTypes } from './u-model';
3
+ export declare namespace DcqlMdocCredential {
4
+ const vNamespaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
5
+ const vModel: v.ObjectSchema<{
6
+ readonly credentialFormat: v.LiteralSchema<"mso_mdoc", undefined>;
7
+ readonly doctype: v.StringSchema<undefined>;
8
+ readonly namespaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
9
+ }, undefined>;
10
+ const model: import("./u-model").Model<v.ObjectSchema<{
11
+ readonly credentialFormat: v.LiteralSchema<"mso_mdoc", undefined>;
12
+ readonly doctype: v.StringSchema<undefined>;
13
+ readonly namespaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
14
+ }, undefined>>;
15
+ type Model = InferModelTypes<typeof model>;
16
+ type NameSpaces = v.InferOutput<typeof vNamespaces>;
17
+ }
18
+ export type DcqlMdocCredential = DcqlMdocCredential.Model['Output'];
19
+ export declare namespace DcqlSdJwtVcCredential {
20
+ const vClaims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
21
+ const vModel: v.ObjectSchema<{
22
+ readonly credentialFormat: v.LiteralSchema<"vc+sd-jwt", undefined>;
23
+ readonly vct: v.StringSchema<undefined>;
24
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
25
+ }, undefined>;
26
+ const model: import("./u-model").Model<v.ObjectSchema<{
27
+ readonly credentialFormat: v.LiteralSchema<"vc+sd-jwt", undefined>;
28
+ readonly vct: v.StringSchema<undefined>;
29
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
30
+ }, undefined>>;
31
+ type Model = InferModelTypes<typeof model>;
32
+ type Claims = Model['Output']['claims'];
33
+ }
34
+ export type DcqlSdJwtVcCredential = DcqlSdJwtVcCredential.Model['Output'];
35
+ export declare namespace DcqlW3cVcCredential {
36
+ const vClaims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
37
+ const vModel: v.ObjectSchema<{
38
+ readonly credentialFormat: v.PicklistSchema<["jwt_vc_json-ld", "jwt_vc_json"], undefined>;
39
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
40
+ }, undefined>;
41
+ const model: import("./u-model").Model<v.ObjectSchema<{
42
+ readonly credentialFormat: v.PicklistSchema<["jwt_vc_json-ld", "jwt_vc_json"], undefined>;
43
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
44
+ }, undefined>>;
45
+ type Model = InferModelTypes<typeof model>;
46
+ type Claims = Model['Output']['claims'];
47
+ }
48
+ export type DcqlW3cVcCredential = DcqlW3cVcCredential.Model['Output'];
49
+ export declare namespace DcqlCredential {
50
+ const vModel: v.VariantSchema<"credentialFormat", [v.ObjectSchema<{
51
+ readonly credentialFormat: v.LiteralSchema<"mso_mdoc", undefined>;
52
+ readonly doctype: v.StringSchema<undefined>;
53
+ readonly namespaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
54
+ }, undefined>, v.ObjectSchema<{
55
+ readonly credentialFormat: v.LiteralSchema<"vc+sd-jwt", undefined>;
56
+ readonly vct: v.StringSchema<undefined>;
57
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
58
+ }, undefined>, v.ObjectSchema<{
59
+ readonly credentialFormat: v.PicklistSchema<["jwt_vc_json-ld", "jwt_vc_json"], undefined>;
60
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
61
+ }, undefined>], undefined>;
62
+ const model: import("./u-model").Model<v.VariantSchema<"credentialFormat", [v.ObjectSchema<{
63
+ readonly credentialFormat: v.LiteralSchema<"mso_mdoc", undefined>;
64
+ readonly doctype: v.StringSchema<undefined>;
65
+ readonly namespaces: v.RecordSchema<v.StringSchema<undefined>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
66
+ }, undefined>, v.ObjectSchema<{
67
+ readonly credentialFormat: v.LiteralSchema<"vc+sd-jwt", undefined>;
68
+ readonly vct: v.StringSchema<undefined>;
69
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
70
+ }, undefined>, v.ObjectSchema<{
71
+ readonly credentialFormat: v.PicklistSchema<["jwt_vc_json-ld", "jwt_vc_json"], undefined>;
72
+ readonly claims: v.RecordSchema<v.StringSchema<undefined>, v.GenericSchema<import("./u-dcql.js").Json, import("./u-dcql.js").Json, v.BaseIssue<unknown>>, undefined>;
73
+ }, undefined>], undefined>>;
74
+ type Model = InferModelTypes<typeof model>;
75
+ }
76
+ export type DcqlCredential = DcqlCredential.Model['Output'];
77
+ //# sourceMappingURL=u-dcql-credential.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"u-dcql-credential.d.ts","sourceRoot":"","sources":["../../src/u-dcql-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,yBAAiB,kBAAkB,CAAC;IAC3B,MAAM,WAAW,6HAGvB,CAAC;IACK,MAAM,MAAM;;;;iBAIjB,CAAC;IAEI,MAAM,KAAK;;;;kBAAwB,CAAC;IAC3C,KAAY,KAAK,GAAG,eAAe,CAAC,OAAO,KAAK,CAAC,CAAC;IAClD,KAAY,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC;CAC5D;AACD,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEpE,yBAAiB,qBAAqB,CAAC;IAC9B,MAAM,OAAO,qJAAc,CAAC;IAC5B,MAAM,MAAM;;;;iBAIjB,CAAC;IACI,MAAM,KAAK;;;;kBAAwB,CAAC;IAC3C,KAAY,KAAK,GAAG,eAAe,CAAC,OAAO,KAAK,CAAC,CAAC;IAClD,KAAY,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CAChD;AACD,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE1E,yBAAiB,mBAAmB,CAAC;IAC5B,MAAM,OAAO,qJAAc,CAAC;IAC5B,MAAM,MAAM;;;iBAGjB,CAAC;IAEI,MAAM,KAAK;;;kBAAwB,CAAC;IAC3C,KAAY,KAAK,GAAG,eAAe,CAAC,OAAO,KAAK,CAAC,CAAC;IAClD,KAAY,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CAChD;AACD,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEtE,yBAAiB,cAAc,CAAC;IACvB,MAAM,MAAM;;;;;;;;;;;8BAIjB,CAAC;IACI,MAAM,KAAK;;;;;;;;;;;+BAAwB,CAAC;IAC3C,KAAY,KAAK,GAAG,eAAe,CAAC,OAAO,KAAK,CAAC,CAAC;CACnD;AACD,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.DcqlCredential = exports.DcqlW3cVcCredential = exports.DcqlSdJwtVcCredential = exports.DcqlMdocCredential = void 0;
27
+ const v = __importStar(require("valibot"));
28
+ const u_dcql_js_1 = require("./u-dcql.js");
29
+ const u_model_js_1 = require("./u-model.js");
30
+ var DcqlMdocCredential;
31
+ (function (DcqlMdocCredential) {
32
+ DcqlMdocCredential.vNamespaces = v.record(v.string(), v.record(v.string(), v.unknown()));
33
+ DcqlMdocCredential.vModel = v.object({
34
+ credentialFormat: v.literal('mso_mdoc'),
35
+ doctype: v.string(),
36
+ namespaces: DcqlMdocCredential.vNamespaces,
37
+ });
38
+ DcqlMdocCredential.model = new u_model_js_1.Model({ vModel: DcqlMdocCredential.vModel });
39
+ })(DcqlMdocCredential || (exports.DcqlMdocCredential = DcqlMdocCredential = {}));
40
+ var DcqlSdJwtVcCredential;
41
+ (function (DcqlSdJwtVcCredential) {
42
+ DcqlSdJwtVcCredential.vClaims = u_dcql_js_1.vJsonRecord;
43
+ DcqlSdJwtVcCredential.vModel = v.object({
44
+ credentialFormat: v.literal('vc+sd-jwt'),
45
+ vct: v.string(),
46
+ claims: DcqlSdJwtVcCredential.vClaims,
47
+ });
48
+ DcqlSdJwtVcCredential.model = new u_model_js_1.Model({ vModel: DcqlSdJwtVcCredential.vModel });
49
+ })(DcqlSdJwtVcCredential || (exports.DcqlSdJwtVcCredential = DcqlSdJwtVcCredential = {}));
50
+ var DcqlW3cVcCredential;
51
+ (function (DcqlW3cVcCredential) {
52
+ DcqlW3cVcCredential.vClaims = u_dcql_js_1.vJsonRecord;
53
+ DcqlW3cVcCredential.vModel = v.object({
54
+ credentialFormat: v.picklist(['jwt_vc_json-ld', 'jwt_vc_json']),
55
+ claims: DcqlW3cVcCredential.vClaims,
56
+ });
57
+ DcqlW3cVcCredential.model = new u_model_js_1.Model({ vModel: DcqlW3cVcCredential.vModel });
58
+ })(DcqlW3cVcCredential || (exports.DcqlW3cVcCredential = DcqlW3cVcCredential = {}));
59
+ var DcqlCredential;
60
+ (function (DcqlCredential) {
61
+ DcqlCredential.vModel = v.variant('credentialFormat', [
62
+ DcqlMdocCredential.vModel,
63
+ DcqlSdJwtVcCredential.vModel,
64
+ DcqlW3cVcCredential.vModel,
65
+ ]);
66
+ DcqlCredential.model = new u_model_js_1.Model({ vModel: DcqlCredential.vModel });
67
+ })(DcqlCredential || (exports.DcqlCredential = DcqlCredential = {}));
68
+ //# sourceMappingURL=u-dcql-credential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"u-dcql-credential.js","sourceRoot":"","sources":["../../src/u-dcql-credential.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,2CAA0C;AAE1C,6CAAqC;AAErC,IAAiB,kBAAkB,CAclC;AAdD,WAAiB,kBAAkB;IACpB,8BAAW,GAAG,CAAC,CAAC,MAAM,CACjC,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAClC,CAAC;IACW,yBAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QAC7B,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QACvC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,UAAU,EAAE,mBAAA,WAAW;KACxB,CAAC,CAAC;IAEU,wBAAK,GAAG,IAAI,kBAAK,CAAC,EAAE,MAAM,EAAN,mBAAA,MAAM,EAAE,CAAC,CAAC;AAG7C,CAAC,EAdgB,kBAAkB,kCAAlB,kBAAkB,QAclC;AAGD,IAAiB,qBAAqB,CAUrC;AAVD,WAAiB,qBAAqB;IACvB,6BAAO,GAAG,uBAAW,CAAC;IACtB,4BAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QAC7B,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;QACxC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,MAAM,EAAE,sBAAA,OAAO;KAChB,CAAC,CAAC;IACU,2BAAK,GAAG,IAAI,kBAAK,CAAC,EAAE,MAAM,EAAN,sBAAA,MAAM,EAAE,CAAC,CAAC;AAG7C,CAAC,EAVgB,qBAAqB,qCAArB,qBAAqB,QAUrC;AAGD,IAAiB,mBAAmB,CAUnC;AAVD,WAAiB,mBAAmB;IACrB,2BAAO,GAAG,uBAAW,CAAC;IACtB,0BAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QAC7B,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;QAC/D,MAAM,EAAE,oBAAA,OAAO;KAChB,CAAC,CAAC;IAEU,yBAAK,GAAG,IAAI,kBAAK,CAAC,EAAE,MAAM,EAAN,oBAAA,MAAM,EAAE,CAAC,CAAC;AAG7C,CAAC,EAVgB,mBAAmB,mCAAnB,mBAAmB,QAUnC;AAGD,IAAiB,cAAc,CAQ9B;AARD,WAAiB,cAAc;IAChB,qBAAM,GAAG,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE;QAClD,kBAAkB,CAAC,MAAM;QACzB,qBAAqB,CAAC,MAAM;QAC5B,mBAAmB,CAAC,MAAM;KAC3B,CAAC,CAAC;IACU,oBAAK,GAAG,IAAI,kBAAK,CAAC,EAAE,MAAM,EAAN,eAAA,MAAM,EAAE,CAAC,CAAC;AAE7C,CAAC,EARgB,cAAc,8BAAd,cAAc,QAQ9B"}
@@ -0,0 +1,27 @@
1
+ import * as v from 'valibot';
2
+ import { DcqlParseError } from './dcql-error/e-dcql';
3
+ export type UnknownBaseSchema = v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>;
4
+ type EnsureOutputAssignableToInput<T extends UnknownBaseSchema> = v.InferOutput<T> extends v.InferInput<T> ? T : never;
5
+ export declare class Model<T extends UnknownBaseSchema> {
6
+ private input;
7
+ constructor(input: {
8
+ vModel: EnsureOutputAssignableToInput<T>;
9
+ });
10
+ get v(): EnsureOutputAssignableToInput<T>;
11
+ parse(input: T): DcqlParseError | v.InferOutput<T>;
12
+ safeParse(input: unknown): {
13
+ success: true;
14
+ output: v.InferOutput<T>;
15
+ } | {
16
+ success: false;
17
+ flattened: v.FlatErrors<T>;
18
+ error: v.ValiError<T>;
19
+ };
20
+ is(input: unknown): input is v.InferOutput<T>;
21
+ }
22
+ export type InferModelTypes<T extends Model<any>> = T extends Model<infer U> ? {
23
+ Input: v.InferInput<U>;
24
+ Output: v.InferOutput<U>;
25
+ } : never;
26
+ export {};
27
+ //# sourceMappingURL=u-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"u-model.d.ts","sourceRoot":"","sources":["../../src/u-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,UAAU,CAC1C,OAAO,EACP,OAAO,EACP,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CACrB,CAAC;AAEF,KAAK,6BAA6B,CAAC,CAAC,SAAS,iBAAiB,IAC5D,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEvD,qBAAa,KAAK,CAAC,CAAC,SAAS,iBAAiB;IAChC,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE;QAAE,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC,CAAA;KAAE;IAEvE,IAAW,CAAC,qCAEX;IAEM,KAAK,CAAC,KAAK,EAAE,CAAC;IAad,SAAS,CACd,KAAK,EAAE,OAAO,GAEZ;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;KAAE,GAC3C;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;KAAE;IAalE,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;CAGrD;AAGD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,IAC9C,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACpB;IACE,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC1B,GACD,KAAK,CAAC"}
@@ -23,10 +23,43 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.DcqlMdocRepresentation = void 0;
26
+ exports.Model = void 0;
27
27
  const v = __importStar(require("valibot"));
28
- var DcqlMdocRepresentation;
29
- (function (DcqlMdocRepresentation) {
30
- DcqlMdocRepresentation.vNamespaces = v.record(v.string(), v.record(v.string(), v.unknown()));
31
- })(DcqlMdocRepresentation || (exports.DcqlMdocRepresentation = DcqlMdocRepresentation = {}));
32
- //# sourceMappingURL=u-dcql-credential-representation.js.map
28
+ const e_dcql_1 = require("./dcql-error/e-dcql");
29
+ class Model {
30
+ input;
31
+ constructor(input) {
32
+ this.input = input;
33
+ }
34
+ get v() {
35
+ return this.input.vModel;
36
+ }
37
+ parse(input) {
38
+ const result = this.safeParse(input);
39
+ if (result.success) {
40
+ return result.output;
41
+ }
42
+ return new e_dcql_1.DcqlParseError({
43
+ message: JSON.stringify(result.flattened),
44
+ cause: result.error,
45
+ });
46
+ }
47
+ safeParse(input) {
48
+ const res = v.safeParse(this.input.vModel, input);
49
+ if (res.success) {
50
+ return { success: true, output: res.output };
51
+ }
52
+ else {
53
+ return {
54
+ success: false,
55
+ error: new v.ValiError(res.issues),
56
+ flattened: v.flatten(res.issues),
57
+ };
58
+ }
59
+ }
60
+ is(input) {
61
+ return v.is(this.v, input);
62
+ }
63
+ }
64
+ exports.Model = Model;
65
+ //# sourceMappingURL=u-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"u-model.js","sourceRoot":"","sources":["../../src/u-model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,gDAAqD;AAWrD,MAAa,KAAK;IACI;IAApB,YAAoB,KAAmD;QAAnD,UAAK,GAAL,KAAK,CAA8C;IAAG,CAAC;IAE3E,IAAW,CAAC;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,KAAQ;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC;QAED,OAAO,IAAI,uBAAc,CAAC;YACxB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC;YACzC,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;IACL,CAAC;IAEM,SAAS,CACd,KAAc;QAId,MAAM,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAClD,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC;gBAClC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAI,GAAG,CAAC,MAAM,CAAC;aACpC,CAAC;QACJ,CAAC;IACH,CAAC;IAEM,EAAE,CAAC,KAAc;QACtB,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF;AAxCD,sBAwCC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dcql",
3
3
  "description": "Digital Credentials Query Language (DCQL)",
4
4
  "author": "Martin Auer",
5
- "version": "0.2.11",
5
+ "version": "0.2.13",
6
6
  "private": false,
7
7
  "main": "./dist/src/index.js",
8
8
  "module": "./dist/src/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"m-dcql-presentation-query.d.ts","sourceRoot":"","sources":["../../../src/dcql-presentation/m-dcql-presentation-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAE9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAG7F,yBAAiB,2BAA2B,CAAC;IACpC,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAcjB,CAAC;IAEH,KAAY,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;IAChD,KAAY,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,CAAC;IAElD,KAAY,aAAa,GACrB,CAAC,eAAe,GAAG;QACjB,cAAc,EAAE,KAAK,CAAC;QACtB,oBAAoB,CAAC,EAAE,SAAS,CAAC;KAClC,CAAC,GACF,2BAA2B,CAAC;IAEzB,MAAM,KAAK,UAAW,KAAK,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEnD,CAAC;IAEF;;;;;;OAMG;IACI,MAAM,KAAK,kBACD,8BAA8B,EAAE,OAC1C;QAAE,SAAS,EAAE,SAAS,CAAA;KAAE,KAC5B,2BAA2B,CAAC,aAa9B,CAAC;IAEK,MAAM,QAAQ,oBACF,2BAA2B,CAAC,aAAa,KACzD,2BASF,CAAC;IAEK,MAAM,mBAAmB,oBACb,eAAe,KAC/B,2BAmEF,CAAC;CACH;AACD,MAAM,MAAM,2BAA2B,GAAG,2BAA2B,CAAC,MAAM,CAAC"}
@@ -1,132 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.DcqlPresentationQueryResult = void 0;
27
- const v = __importStar(require("valibot"));
28
- const m_dcql_query_result_js_1 = require("../dcql-query-result/m-dcql-query-result.js");
29
- const dcql_query_js_1 = require("../dcql-query/dcql-query.js");
30
- const e_dcql_js_1 = require("../e-dcql.js");
31
- const u_dcql_js_1 = require("../u-dcql.js");
32
- var DcqlPresentationQueryResult;
33
- (function (DcqlPresentationQueryResult) {
34
- DcqlPresentationQueryResult.vModel = v.object({
35
- ...m_dcql_query_result_js_1.DcqlQueryResult.vModel.entries,
36
- canBeSatisfied: v.literal(true),
37
- presentation_matches: v.record(v.pipe(v.string(), v.regex(u_dcql_js_1.idRegex)), v.object({
38
- ...v.omit(m_dcql_query_result_js_1.DcqlQueryResult.vModel.entries.credential_matches.value.options[0], ['all', 'issues', 'credential_index']).entries,
39
- presentation_id: v.pipe(v.string(), v.regex(u_dcql_js_1.idRegex)),
40
- presentation_index: v.number(),
41
- })),
42
- });
43
- DcqlPresentationQueryResult.parse = (input) => {
44
- return v.parse(DcqlPresentationQueryResult.vModel, input);
45
- };
46
- /**
47
- * Query if the presentation record can be satisfied by the provided presentations
48
- * considering the dcql query
49
- *
50
- * @param dcqlQuery
51
- * @param presentations
52
- */
53
- DcqlPresentationQueryResult.query = (presentations, ctx) => {
54
- const { dcqlQuery } = ctx;
55
- const result = (0, dcql_query_js_1.performDcqlQuery)(dcqlQuery, {
56
- credentials: presentations,
57
- presentation: true,
58
- });
59
- if (!result.canBeSatisfied) {
60
- return { ...result, canBeSatisfied: false };
61
- }
62
- return DcqlPresentationQueryResult.fromDcqlQueryResult(result);
63
- };
64
- DcqlPresentationQueryResult.validate = (dcqlQueryResult) => {
65
- if (!dcqlQueryResult.canBeSatisfied) {
66
- throw new e_dcql_js_1.DcqlInvalidPresentationRecordError({
67
- message: 'Invalid Presentation record',
68
- cause: dcqlQueryResult,
69
- });
70
- }
71
- return dcqlQueryResult;
72
- };
73
- DcqlPresentationQueryResult.fromDcqlQueryResult = (dcqlQueryResult) => {
74
- const { canBeSatisfied } = dcqlQueryResult;
75
- if (!canBeSatisfied) {
76
- throw new e_dcql_js_1.DcqlInvalidPresentationRecordError({
77
- message: 'Invalid Presentation record',
78
- cause: dcqlQueryResult,
79
- });
80
- }
81
- const presentation_matches = {};
82
- if (!dcqlQueryResult.credential_sets) {
83
- for (const credentialQueryId of dcqlQueryResult.credentials.map(c => c.id)) {
84
- const match = dcqlQueryResult.credential_matches[credentialQueryId];
85
- if (!match?.success) {
86
- throw new e_dcql_js_1.DcqlInvalidPresentationRecordError({
87
- message: `Credential query ${credentialQueryId} is required but not satisfied.`,
88
- });
89
- }
90
- const { all, issues, credential_index, ...rest } = match;
91
- presentation_matches[credentialQueryId] = {
92
- ...rest,
93
- presentation_id: credentialQueryId,
94
- presentation_index: credential_index,
95
- };
96
- }
97
- return {
98
- ...dcqlQueryResult,
99
- canBeSatisfied,
100
- presentation_matches,
101
- };
102
- }
103
- for (const credentialSet of dcqlQueryResult.credential_sets ?? []) {
104
- const matchingOption = credentialSet.matching_options?.find(Boolean);
105
- if (!matchingOption)
106
- throw new Error('Invalid matching option');
107
- for (const credentialQueryId of matchingOption) {
108
- const match = dcqlQueryResult.credential_matches[credentialQueryId];
109
- if (match?.success) {
110
- const { all, issues, credential_index, ...rest } = match;
111
- presentation_matches[credentialQueryId] = {
112
- presentation_id: credentialQueryId,
113
- ...rest,
114
- presentation_index: credential_index,
115
- };
116
- continue;
117
- }
118
- if (credentialSet.required) {
119
- throw new e_dcql_js_1.DcqlInvalidPresentationRecordError({
120
- message: `Credential query ${credentialQueryId} is required but not satisfied.`,
121
- });
122
- }
123
- }
124
- }
125
- return {
126
- ...dcqlQueryResult,
127
- canBeSatisfied,
128
- presentation_matches,
129
- };
130
- };
131
- })(DcqlPresentationQueryResult || (exports.DcqlPresentationQueryResult = DcqlPresentationQueryResult = {}));
132
- //# sourceMappingURL=m-dcql-presentation-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"m-dcql-presentation-query.js","sourceRoot":"","sources":["../../../src/dcql-presentation/m-dcql-presentation-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,wFAA8E;AAC9E,+DAA+D;AAE/D,4CAAkE;AAElE,4CAAuC;AAEvC,IAAiB,2BAA2B,CA2I3C;AA3ID,WAAiB,2BAA2B;IAC7B,kCAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QAC7B,GAAG,wCAAe,CAAC,MAAM,CAAC,OAAO;QACjC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;QAC/B,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAC5B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAO,CAAC,CAAC,EACpC,CAAC,CAAC,MAAM,CAAC;YACP,GAAG,CAAC,CAAC,IAAI,CACP,wCAAe,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAClE,CAAC,KAAK,EAA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AAO,EAAE,CAAC;oBACnB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;oBACzD,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;wBACxC,eAAe,EAAE,iBAAiB;wBAClC,GAAG,IAAI;wBACP,kBAAkB,EAAE,gBAAgB;qBACrC,CAAC;oBACF,SAAS;gBACX,CAAC;gBAED,IAAI,aAAa,CAAC,QAAQ,EAAE,CAAC;oBAC3B,MAAM,IAAI,8CAAkC,CAAC;wBAC3C,OAAO,EAAE,oBAAoB,iBAAiB,iCAAiC;qBAChF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,GAAG,eAAe;YAClB,cAAc;YACd,oBAAoB;SACrB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA3IgB,2BAA2B,2CAA3B,2BAA2B,QA2I3C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"m-dcql-presentation-record.d.ts","sourceRoot":"","sources":["../../../src/dcql-presentation/m-dcql-presentation-record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAG7B,yBAAiB,sBAAsB,CAAC;IAC/B,MAAM,MAAM,0TAGlB,CAAC;IAEF,KAAY,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;IAChD,KAAY,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,CAAC;IAC3C,MAAM,KAAK,UAAW,KAAK,GAAG,MAAM;;;;KAM1C,CAAC;IAEK,MAAM,MAAM,UAAW,MAAM,WAEnC,CAAC;CACH;AACD,MAAM,MAAM,sBAAsB,GAAG,sBAAsB,CAAC,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"m-dcql-presentation-record.js","sourceRoot":"","sources":["../../../src/dcql-presentation/m-dcql-presentation-record.ts"],"names":[],"mappings":";;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