@ductape/sdk 0.3.5 → 0.3.7
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/api/services/productsApi.service.js +1 -1
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/clients/function.client.js +2 -0
- package/dist/clients/function.client.js.map +1 -1
- package/dist/clients/interceptors.js +5 -2
- package/dist/clients/interceptors.js.map +1 -1
- package/dist/graph/adapters/neo4j.adapter.js +20 -1
- package/dist/graph/adapters/neo4j.adapter.js.map +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/products/services/products.service.d.ts +1 -0
- package/dist/products/services/products.service.js +48 -5
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/storage/types/index.d.ts +4 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vector/actions/action-manager.js +19 -0
- package/dist/vector/actions/action-manager.js.map +1 -1
- package/dist/vector/vector-database.service.d.ts +3 -0
- package/dist/vector/vector-database.service.js +9 -2
- package/dist/vector/vector-database.service.js.map +1 -1
- package/package.json +269 -3
package/dist/index.mjs
ADDED
|
@@ -586,6 +586,7 @@ export default class ProductsBuilderService implements IProductsBuilderService {
|
|
|
586
586
|
fetchJobs(): Promise<Array<IProductJobs>>;
|
|
587
587
|
fetchJob(tag: string): Promise<IProductJobs | null>;
|
|
588
588
|
deleteJob(tag: string): Promise<void>;
|
|
589
|
+
private featureMatchesWrite;
|
|
589
590
|
createFeature(data: Partial<IProductFeature>, throwErrorIfExists?: boolean): Promise<IProductFeature>;
|
|
590
591
|
updateFeature(tag: string, data: Partial<IProductFeature>): Promise<void>;
|
|
591
592
|
fetchFeatures(): Promise<Array<IProductFeature>>;
|
|
@@ -2267,7 +2267,11 @@ class ProductsBuilderService {
|
|
|
2267
2267
|
component: enums_1.ProductComponents.VECTOR,
|
|
2268
2268
|
action: enums_1.RequestAction.UPDATE,
|
|
2269
2269
|
}, this.getUserAccess());
|
|
2270
|
-
|
|
2270
|
+
const persisted = await this.fetchVectorAction(vectorTag, fullTag);
|
|
2271
|
+
if (!persisted || !this.featureMatchesWrite(persisted, { template: newAction.template, parameters: newAction.parameters, type: newAction.type })) {
|
|
2272
|
+
throw new Error(`Vector action ${fullTag} persistence differs from the submitted definition; do not execute it`);
|
|
2273
|
+
}
|
|
2274
|
+
return persisted;
|
|
2271
2275
|
}
|
|
2272
2276
|
catch (e) {
|
|
2273
2277
|
throw e;
|
|
@@ -2304,7 +2308,11 @@ class ProductsBuilderService {
|
|
|
2304
2308
|
component: enums_1.ProductComponents.VECTOR,
|
|
2305
2309
|
action: enums_1.RequestAction.UPDATE,
|
|
2306
2310
|
}, this.getUserAccess());
|
|
2307
|
-
|
|
2311
|
+
const persisted = await this.fetchVectorAction(vectorTag, updatedAction.tag);
|
|
2312
|
+
if (!persisted || !this.featureMatchesWrite(persisted, { template: updatedAction.template, parameters: updatedAction.parameters, type: updatedAction.type })) {
|
|
2313
|
+
throw new Error(`Vector action ${updatedAction.tag} persistence differs from the submitted definition; do not execute it`);
|
|
2314
|
+
}
|
|
2315
|
+
return persisted;
|
|
2308
2316
|
}
|
|
2309
2317
|
catch (e) {
|
|
2310
2318
|
throw e;
|
|
@@ -5276,6 +5284,17 @@ class ProductsBuilderService {
|
|
|
5276
5284
|
}
|
|
5277
5285
|
}
|
|
5278
5286
|
// ==================== WORKFLOW CRUD METHODS ====================
|
|
5287
|
+
featureMatchesWrite(actual, expected) {
|
|
5288
|
+
if (expected === undefined)
|
|
5289
|
+
return true;
|
|
5290
|
+
if (expected === null || typeof expected !== 'object')
|
|
5291
|
+
return actual === expected;
|
|
5292
|
+
if (!actual || typeof actual !== 'object')
|
|
5293
|
+
return false;
|
|
5294
|
+
if (Array.isArray(expected))
|
|
5295
|
+
return Array.isArray(actual) && actual.length === expected.length && expected.every((value, index) => this.featureMatchesWrite(actual[index], value));
|
|
5296
|
+
return Object.entries(expected).every(([key, value]) => this.featureMatchesWrite(actual[key], value));
|
|
5297
|
+
}
|
|
5279
5298
|
async createFeature(data, throwErrorIfExists = false) {
|
|
5280
5299
|
var _a, _b, _c;
|
|
5281
5300
|
try {
|
|
@@ -5307,8 +5326,16 @@ class ProductsBuilderService {
|
|
|
5307
5326
|
// the feature was there all along and this is that false negative resolving
|
|
5308
5327
|
// itself -- fall through to the read-back below instead of failing the caller.
|
|
5309
5328
|
const isDuplicate = createErr instanceof Error && /already exists|duplicate|in use/i.test(createErr.message);
|
|
5310
|
-
if (!isDuplicate)
|
|
5311
|
-
|
|
5329
|
+
if (!isDuplicate) {
|
|
5330
|
+
let persisted;
|
|
5331
|
+
try {
|
|
5332
|
+
persisted = await this.fetchFeature(data.tag);
|
|
5333
|
+
}
|
|
5334
|
+
catch ( /* Preserve an unverified mutation outcome. */_d) { /* Preserve an unverified mutation outcome. */ }
|
|
5335
|
+
if (persisted && this.featureMatchesWrite(persisted, data))
|
|
5336
|
+
return persisted;
|
|
5337
|
+
throw Object.assign(new Error(`Feature ${data.tag} create could not be verified; inspect its catalogue entry before retrying`), { mutationState: 'unknown', featureTag: data.tag });
|
|
5338
|
+
}
|
|
5312
5339
|
}
|
|
5313
5340
|
// A successful mutation response is insufficient: execution and Workbench
|
|
5314
5341
|
// use the catalogue read API. Confirm that exact path can observe the write.
|
|
@@ -5368,7 +5395,23 @@ class ProductsBuilderService {
|
|
|
5368
5395
|
}
|
|
5369
5396
|
}
|
|
5370
5397
|
}
|
|
5371
|
-
|
|
5398
|
+
let writeError;
|
|
5399
|
+
try {
|
|
5400
|
+
await this.productApi.updateProduct(this.product_id, Object.assign(Object.assign({ _id }, data), { tag, component: enums_1.ProductComponents.FEATURE, action: enums_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
5401
|
+
}
|
|
5402
|
+
catch (error) {
|
|
5403
|
+
writeError = error;
|
|
5404
|
+
}
|
|
5405
|
+
let persisted;
|
|
5406
|
+
try {
|
|
5407
|
+
persisted = await this.fetchFeature(tag);
|
|
5408
|
+
}
|
|
5409
|
+
catch ( /* Readback failed; do not replay the mutation. */_d) { /* Readback failed; do not replay the mutation. */ }
|
|
5410
|
+
if (!persisted || !this.featureMatchesWrite(persisted, Object.assign(Object.assign({}, data), { tag }))) {
|
|
5411
|
+
throw Object.assign(new Error(`Feature ${tag} update could not be verified; inspect its catalogue entry before retrying`), {
|
|
5412
|
+
mutationState: 'unknown', featureTag: tag, writeAcknowledged: !writeError,
|
|
5413
|
+
});
|
|
5414
|
+
}
|
|
5372
5415
|
}
|
|
5373
5416
|
catch (e) {
|
|
5374
5417
|
throw e;
|