@travetto/model 8.0.0-alpha.23 → 8.0.0-alpha.24
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/README.md +50 -44
- package/__index__.ts +1 -0
- package/package.json +7 -7
- package/src/error/unique.ts +13 -0
- package/support/test/blob.ts +1 -1
package/README.md
CHANGED
|
@@ -316,28 +316,31 @@ The module provides the ability to generate an export of the model structure fro
|
|
|
316
316
|
```bash
|
|
317
317
|
$ trv model:export --help
|
|
318
318
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
319
|
+
TypeError: Cannot redefine property: toJSON
|
|
320
|
+
at Object.defineProperty (<anonymous>)
|
|
321
|
+
at file://<workspace-root>/module/runtime/src/json.ts:17:8
|
|
322
|
+
at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
|
|
323
|
+
at async node:internal/modules/esm/loader:650:26
|
|
324
|
+
at async $Runtime.importFrom (<workspace-root>/module/runtime/src/context.ts:136:22)
|
|
325
|
+
at async $Registry.#init (<workspace-root>/module/registry/src/registry.ts:88:9)
|
|
326
|
+
at async ModelExportCommand.help (./support/base-command.ts:38:5)
|
|
327
|
+
at async HelpUtil.getExtendedHelpMessage (<workspace-root>/module/cli/src/help.ts:121:30)
|
|
328
|
+
at async HelpUtil.renderCommandHelp (<workspace-root>/module/cli/src/help.ts:170:11)
|
|
329
|
+
at async ExecutionManager.getExecutionCommand (<workspace-root>/module/cli/src/execute.ts:49:22)
|
|
330
|
+
at async ExecutionManager.run (<workspace-root>/module/cli/src/execute.ts:67:23)
|
|
331
|
+
|
|
332
|
+
TypeError: Cannot redefine property: toJSON
|
|
333
|
+
at Object.defineProperty (<anonymous>)
|
|
334
|
+
at file://<workspace-root>/module/runtime/src/json.ts:17:8
|
|
335
|
+
at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
|
|
336
|
+
at async node:internal/modules/esm/loader:650:26
|
|
337
|
+
at async $Runtime.importFrom (<workspace-root>/module/runtime/src/context.ts:136:22)
|
|
338
|
+
at async $Registry.#init (<workspace-root>/module/registry/src/registry.ts:88:9)
|
|
339
|
+
at async ModelExportCommand.help (./support/base-command.ts:38:5)
|
|
340
|
+
at async HelpUtil.getExtendedHelpMessage (<workspace-root>/module/cli/src/help.ts:121:30)
|
|
341
|
+
at async HelpUtil.renderCommandHelp (<workspace-root>/module/cli/src/help.ts:170:11)
|
|
342
|
+
at async ExecutionManager.getExecutionCommand (<workspace-root>/module/cli/src/execute.ts:49:22)
|
|
343
|
+
at async ExecutionManager.run (<workspace-root>/module/cli/src/execute.ts:67:23)
|
|
341
344
|
```
|
|
342
345
|
|
|
343
346
|
## CLI - model:install
|
|
@@ -347,26 +350,29 @@ The module provides the ability to install all the various [@Model](https://gith
|
|
|
347
350
|
```bash
|
|
348
351
|
$ trv model:install --help
|
|
349
352
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
353
|
+
TypeError: Cannot redefine property: toJSON
|
|
354
|
+
at Object.defineProperty (<anonymous>)
|
|
355
|
+
at file://<workspace-root>/module/runtime/src/json.ts:17:8
|
|
356
|
+
at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
|
|
357
|
+
at async node:internal/modules/esm/loader:650:26
|
|
358
|
+
at async $Runtime.importFrom (<workspace-root>/module/runtime/src/context.ts:136:22)
|
|
359
|
+
at async $Registry.#init (<workspace-root>/module/registry/src/registry.ts:88:9)
|
|
360
|
+
at async ModelInstallCommand.help (./support/base-command.ts:38:5)
|
|
361
|
+
at async HelpUtil.getExtendedHelpMessage (<workspace-root>/module/cli/src/help.ts:121:30)
|
|
362
|
+
at async HelpUtil.renderCommandHelp (<workspace-root>/module/cli/src/help.ts:170:11)
|
|
363
|
+
at async ExecutionManager.getExecutionCommand (<workspace-root>/module/cli/src/execute.ts:49:22)
|
|
364
|
+
at async ExecutionManager.run (<workspace-root>/module/cli/src/execute.ts:67:23)
|
|
365
|
+
|
|
366
|
+
TypeError: Cannot redefine property: toJSON
|
|
367
|
+
at Object.defineProperty (<anonymous>)
|
|
368
|
+
at file://<workspace-root>/module/runtime/src/json.ts:17:8
|
|
369
|
+
at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
|
|
370
|
+
at async node:internal/modules/esm/loader:650:26
|
|
371
|
+
at async $Runtime.importFrom (<workspace-root>/module/runtime/src/context.ts:136:22)
|
|
372
|
+
at async $Registry.#init (<workspace-root>/module/registry/src/registry.ts:88:9)
|
|
373
|
+
at async ModelInstallCommand.help (./support/base-command.ts:38:5)
|
|
374
|
+
at async HelpUtil.getExtendedHelpMessage (<workspace-root>/module/cli/src/help.ts:121:30)
|
|
375
|
+
at async HelpUtil.renderCommandHelp (<workspace-root>/module/cli/src/help.ts:170:11)
|
|
376
|
+
at async ExecutionManager.getExecutionCommand (<workspace-root>/module/cli/src/execute.ts:49:22)
|
|
377
|
+
at async ExecutionManager.run (<workspace-root>/module/cli/src/execute.ts:67:23)
|
|
372
378
|
```
|
package/__index__.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './src/error/exists.ts';
|
|
|
2
2
|
export * from './src/error/invalid-index.ts';
|
|
3
3
|
export * from './src/error/invalid-sub-type.ts';
|
|
4
4
|
export * from './src/error/not-found.ts';
|
|
5
|
+
export * from './src/error/unique.ts';
|
|
5
6
|
export * from './src/registry/decorator.ts';
|
|
6
7
|
export * from './src/registry/registry-adapter.ts';
|
|
7
8
|
export * from './src/registry/registry-index.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Datastore abstraction for core operations.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"directory": "module/model"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/config": "^8.0.0-alpha.
|
|
31
|
-
"@travetto/di": "^8.0.0-alpha.
|
|
32
|
-
"@travetto/registry": "^8.0.0-alpha.
|
|
33
|
-
"@travetto/schema": "^8.0.0-alpha.
|
|
30
|
+
"@travetto/config": "^8.0.0-alpha.23",
|
|
31
|
+
"@travetto/di": "^8.0.0-alpha.21",
|
|
32
|
+
"@travetto/registry": "^8.0.0-alpha.21",
|
|
33
|
+
"@travetto/schema": "^8.0.0-alpha.23"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
37
|
-
"@travetto/test": "^8.0.0-alpha.
|
|
36
|
+
"@travetto/cli": "^8.0.0-alpha.29",
|
|
37
|
+
"@travetto/test": "^8.0.0-alpha.22"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"@travetto/cli": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Class, RuntimeError } from '@travetto/runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents when a data item violates a unique constraint or index
|
|
5
|
+
*/
|
|
6
|
+
export class UniqueError extends RuntimeError {
|
|
7
|
+
constructor(cls: Class | string, constraint: string, details: Record<string, unknown> = {}) {
|
|
8
|
+
super(`${typeof cls === 'string' ? cls : cls.name} violates unique constraint on ${constraint}`, {
|
|
9
|
+
category: 'data',
|
|
10
|
+
details: { constraint, type: typeof cls === 'string' ? cls : cls.name, ...details }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
package/support/test/blob.ts
CHANGED
|
@@ -155,7 +155,7 @@ export abstract class ModelBlobSuite extends BaseModelSuite<ModelBlobSupport> {
|
|
|
155
155
|
const service = await this.service;
|
|
156
156
|
|
|
157
157
|
const bytes = BinaryUtil.binaryArrayToBuffer(BinaryUtil.makeBinaryArray(1.5 * 10000));
|
|
158
|
-
for (let i = 0; i < bytes.byteLength; i
|
|
158
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
159
159
|
bytes.writeUInt8(Math.trunc(Math.random() * 255), i);
|
|
160
160
|
}
|
|
161
161
|
|