@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.57.uni.client.169 → 0.34.1-feature.SSISDK.57.uni.client.203
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/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/__tests__/pd-manager.entities.test.ts +11 -11
- package/src/__tests__/pd-manager.store.test.ts +74 -23
- package/src/entities/presentationDefinition/DcqlQueryItemEntity.ts +2 -2
- package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +1 -1
- package/src/migrations/postgres/1726588800000-CreateDcqlQueryItem.ts +1 -1
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
- package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +1 -1
- package/src/presentationDefinition/PDStore.ts +7 -7
- package/src/types/presentationDefinition/presentationDefinition.ts +2 -2
- package/src/utils/presentationDefinition/MappingUtils.ts +11 -11
package/dist/index.cjs
CHANGED
|
@@ -121,6 +121,8 @@ __export(index_exports, {
|
|
|
121
121
|
credentialBrandingFrom: () => credentialBrandingFrom,
|
|
122
122
|
credentialClaimsEntityFrom: () => credentialClaimsEntityFrom,
|
|
123
123
|
credentialLocaleBrandingEntityFrom: () => credentialLocaleBrandingEntityFrom,
|
|
124
|
+
dcqlQueryEntityItemFrom: () => dcqlQueryEntityItemFrom,
|
|
125
|
+
dcqlQueryItemFrom: () => dcqlQueryItemFrom,
|
|
124
126
|
didAuthConfigEntityFrom: () => didAuthConfigEntityFrom,
|
|
125
127
|
didAuthConfigFrom: () => didAuthConfigFrom,
|
|
126
128
|
digitalCredentialFrom: () => digitalCredentialFrom,
|
|
@@ -160,8 +162,6 @@ __export(index_exports, {
|
|
|
160
162
|
partyTypeFrom: () => partyTypeFrom,
|
|
161
163
|
physicalAddressEntityFrom: () => physicalAddressEntityFrom,
|
|
162
164
|
physicalAddressFrom: () => physicalAddressFrom,
|
|
163
|
-
presentationDefinitionEntityItemFrom: () => presentationDefinitionEntityItemFrom,
|
|
164
|
-
presentationDefinitionItemFrom: () => presentationDefinitionItemFrom,
|
|
165
165
|
textAttributesEntityFrom: () => textAttributesEntityFrom
|
|
166
166
|
});
|
|
167
167
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -4212,7 +4212,7 @@ var DcqlQueryItemEntity = class extends import_typeorm33.BaseEntity {
|
|
|
4212
4212
|
tenantId;
|
|
4213
4213
|
purpose;
|
|
4214
4214
|
name;
|
|
4215
|
-
|
|
4215
|
+
query;
|
|
4216
4216
|
createdAt;
|
|
4217
4217
|
lastUpdatedAt;
|
|
4218
4218
|
// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
|
|
@@ -4282,7 +4282,7 @@ _ts_decorate34([
|
|
|
4282
4282
|
], DcqlQueryItemEntity.prototype, "name", void 0);
|
|
4283
4283
|
_ts_decorate34([
|
|
4284
4284
|
(0, import_typeorm33.Column)({
|
|
4285
|
-
name: "
|
|
4285
|
+
name: "query",
|
|
4286
4286
|
type: "text",
|
|
4287
4287
|
nullable: false,
|
|
4288
4288
|
unique: false
|
|
@@ -4291,7 +4291,7 @@ _ts_decorate34([
|
|
|
4291
4291
|
message: "A blank dcql query payload field is not allowed"
|
|
4292
4292
|
}),
|
|
4293
4293
|
_ts_metadata33("design:type", String)
|
|
4294
|
-
], DcqlQueryItemEntity.prototype, "
|
|
4294
|
+
], DcqlQueryItemEntity.prototype, "query", void 0);
|
|
4295
4295
|
_ts_decorate34([
|
|
4296
4296
|
(0, import_typeorm33.CreateDateColumn)({
|
|
4297
4297
|
name: "created_at",
|
|
@@ -6926,7 +6926,7 @@ var import_debug7 = __toESM(require("debug"), 1);
|
|
|
6926
6926
|
// src/utils/presentationDefinition/MappingUtils.ts
|
|
6927
6927
|
var blakepkg = __toESM(require("blakejs"), 1);
|
|
6928
6928
|
var import_dcql = require("dcql");
|
|
6929
|
-
var
|
|
6929
|
+
var dcqlQueryItemFrom = /* @__PURE__ */ __name((entity) => {
|
|
6930
6930
|
const result = {
|
|
6931
6931
|
id: entity.id,
|
|
6932
6932
|
tenantId: entity.tenantId,
|
|
@@ -6934,29 +6934,29 @@ var presentationDefinitionItemFrom = /* @__PURE__ */ __name((entity) => {
|
|
|
6934
6934
|
version: entity.version,
|
|
6935
6935
|
name: entity.name,
|
|
6936
6936
|
purpose: entity.purpose,
|
|
6937
|
-
|
|
6937
|
+
query: import_dcql.DcqlQuery.parse(JSON.parse(entity.query)),
|
|
6938
6938
|
createdAt: entity.createdAt,
|
|
6939
6939
|
lastUpdatedAt: entity.lastUpdatedAt
|
|
6940
6940
|
};
|
|
6941
|
-
if (result.
|
|
6942
|
-
import_dcql.DcqlQuery.validate(result.
|
|
6941
|
+
if (result.query) {
|
|
6942
|
+
import_dcql.DcqlQuery.validate(result.query);
|
|
6943
6943
|
}
|
|
6944
6944
|
return replaceNullWithUndefined(result);
|
|
6945
|
-
}, "
|
|
6946
|
-
var
|
|
6945
|
+
}, "dcqlQueryItemFrom");
|
|
6946
|
+
var dcqlQueryEntityItemFrom = /* @__PURE__ */ __name((item) => {
|
|
6947
6947
|
const entity = new DcqlQueryItemEntity();
|
|
6948
6948
|
entity.tenantId = item.tenantId;
|
|
6949
6949
|
entity.queryId = item.queryId;
|
|
6950
6950
|
entity.version = item.version;
|
|
6951
6951
|
entity.name = item.name;
|
|
6952
6952
|
entity.purpose = item.purpose;
|
|
6953
|
-
if (item.
|
|
6954
|
-
const dcqlQuery = import_dcql.DcqlQuery.parse(item.
|
|
6953
|
+
if (item.query) {
|
|
6954
|
+
const dcqlQuery = import_dcql.DcqlQuery.parse(item.query);
|
|
6955
6955
|
import_dcql.DcqlQuery.validate(dcqlQuery);
|
|
6956
|
-
entity.
|
|
6956
|
+
entity.query = JSON.stringify(item.query);
|
|
6957
6957
|
}
|
|
6958
6958
|
return entity;
|
|
6959
|
-
}, "
|
|
6959
|
+
}, "dcqlQueryEntityItemFrom");
|
|
6960
6960
|
function hashPayload(payload) {
|
|
6961
6961
|
return blakepkg.blake2bHex(JSON.stringify(payload));
|
|
6962
6962
|
}
|
|
@@ -6965,11 +6965,11 @@ function isPresentationDefinitionEqual(base, compare) {
|
|
|
6965
6965
|
if (base.queryId !== compare.queryId || base.tenantId !== compare.tenantId || base.version !== compare.version || base.name !== compare.name || base.purpose !== compare.purpose) {
|
|
6966
6966
|
return false;
|
|
6967
6967
|
}
|
|
6968
|
-
if (base.
|
|
6969
|
-
if (hashPayload(base.
|
|
6968
|
+
if (base.query && compare.query) {
|
|
6969
|
+
if (hashPayload(base.query) !== hashPayload(compare.query)) {
|
|
6970
6970
|
return false;
|
|
6971
6971
|
}
|
|
6972
|
-
} else if (base.
|
|
6972
|
+
} else if (base.query || compare.query) {
|
|
6973
6973
|
return false;
|
|
6974
6974
|
}
|
|
6975
6975
|
return true;
|
|
@@ -6998,7 +6998,7 @@ var PDStore = class extends AbstractPDStore {
|
|
|
6998
6998
|
if (!result) {
|
|
6999
6999
|
return Promise.reject(Error(`No presentation definition item found for id: ${itemId}`));
|
|
7000
7000
|
}
|
|
7001
|
-
return
|
|
7001
|
+
return dcqlQueryItemFrom(result);
|
|
7002
7002
|
}, "getDefinition");
|
|
7003
7003
|
hasDefinition = /* @__PURE__ */ __name(async (args) => {
|
|
7004
7004
|
const { itemId } = args ?? {};
|
|
@@ -7032,16 +7032,16 @@ var PDStore = class extends AbstractPDStore {
|
|
|
7032
7032
|
version: "DESC"
|
|
7033
7033
|
}
|
|
7034
7034
|
});
|
|
7035
|
-
return result.map((entity) =>
|
|
7035
|
+
return result.map((entity) => dcqlQueryItemFrom(entity));
|
|
7036
7036
|
}, "getDefinitions");
|
|
7037
7037
|
addDefinition = /* @__PURE__ */ __name(async (item) => {
|
|
7038
7038
|
const pdRepository = (await this.dbConnection).getRepository(DcqlQueryItemEntity);
|
|
7039
|
-
const entity =
|
|
7039
|
+
const entity = dcqlQueryEntityItemFrom(item);
|
|
7040
7040
|
debug7("Adding presentation definition entity", item);
|
|
7041
7041
|
const result = await pdRepository.save(entity, {
|
|
7042
7042
|
transaction: true
|
|
7043
7043
|
});
|
|
7044
|
-
return
|
|
7044
|
+
return dcqlQueryItemFrom(result);
|
|
7045
7045
|
}, "addDefinition");
|
|
7046
7046
|
updateDefinition = /* @__PURE__ */ __name(async (item) => {
|
|
7047
7047
|
const pdRepository = (await this.dbConnection).getRepository(DcqlQueryItemEntity);
|
|
@@ -7061,12 +7061,12 @@ var PDStore = class extends AbstractPDStore {
|
|
|
7061
7061
|
updatedEntity.version = item.version;
|
|
7062
7062
|
updatedEntity.name = item.name;
|
|
7063
7063
|
updatedEntity.purpose = item.purpose;
|
|
7064
|
-
updatedEntity.
|
|
7064
|
+
updatedEntity.query = JSON.stringify(item.query);
|
|
7065
7065
|
debug7("Updating presentation definition entity", updatedEntity);
|
|
7066
7066
|
const updateResult = await pdRepository.save(updatedEntity, {
|
|
7067
7067
|
transaction: true
|
|
7068
7068
|
});
|
|
7069
|
-
return
|
|
7069
|
+
return dcqlQueryItemFrom(updateResult);
|
|
7070
7070
|
}, "updateDefinition");
|
|
7071
7071
|
deleteDefinition = /* @__PURE__ */ __name(async (args) => {
|
|
7072
7072
|
const { itemId } = args;
|
|
@@ -7316,7 +7316,7 @@ CREATE TABLE "PresentationDefinitionItem" (
|
|
|
7316
7316
|
"version" TEXT NOT NULL,
|
|
7317
7317
|
"purpose" TEXT,
|
|
7318
7318
|
"definition_payload" TEXT NOT NULL,
|
|
7319
|
-
"
|
|
7319
|
+
"query" TEXT,
|
|
7320
7320
|
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7321
7321
|
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7322
7322
|
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
@@ -7342,7 +7342,7 @@ var CreatePresentationDefinitions1716475165344 = class {
|
|
|
7342
7342
|
"version" varchar NOT NULL,
|
|
7343
7343
|
"purpose" varchar,
|
|
7344
7344
|
"definition_payload" varchar NOT NULL,
|
|
7345
|
-
"
|
|
7345
|
+
"query" varchar,
|
|
7346
7346
|
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
7347
7347
|
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7348
7348
|
}
|
|
@@ -7955,7 +7955,7 @@ var CreateDcqlQueryItemPG1726588800000 = class {
|
|
|
7955
7955
|
"name" TEXT,
|
|
7956
7956
|
"version" TEXT NOT NULL,
|
|
7957
7957
|
"purpose" TEXT,
|
|
7958
|
-
"
|
|
7958
|
+
"query" TEXT NOT NULL,
|
|
7959
7959
|
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7960
7960
|
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7961
7961
|
CONSTRAINT "PK_DcqlQueryItem_id" PRIMARY KEY ("id"))
|
|
@@ -7980,7 +7980,7 @@ var CreateDcqlQueryItemSQlite1726617600000 = class {
|
|
|
7980
7980
|
"name" varchar,
|
|
7981
7981
|
"version" varchar NOT NULL,
|
|
7982
7982
|
"purpose" varchar,
|
|
7983
|
-
"
|
|
7983
|
+
"query" varchar NOT NULL,
|
|
7984
7984
|
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
7985
7985
|
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7986
7986
|
}
|