@travetto/model 7.0.4 → 7.0.6

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 CHANGED
@@ -278,11 +278,11 @@ To enforce that these contracts are honored, the module provides shared test sui
278
278
  **Code: Memory Service Test Configuration**
279
279
  ```typescript
280
280
  import { DependencyRegistryIndex } from '@travetto/di';
281
- import { AppError, castTo, Class, classConstruct } from '@travetto/runtime';
281
+ import { AppError, castTo, type Class, classConstruct } from '@travetto/runtime';
282
282
 
283
283
  import { ModelBulkUtil } from '../../src/util/bulk.ts';
284
284
  import { ModelCrudUtil } from '../../src/util/crud.ts';
285
- import { ModelType } from '../../src/types/model.ts';
285
+ import type { ModelType } from '../../src/types/model.ts';
286
286
  import { ModelSuite } from './suite.ts';
287
287
 
288
288
  type ServiceClass = { serviceClass: { new(): unknown } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model",
3
- "version": "7.0.4",
3
+ "version": "7.0.6",
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": "^7.0.4",
31
- "@travetto/di": "^7.0.4",
32
- "@travetto/registry": "^7.0.4",
33
- "@travetto/schema": "^7.0.4"
30
+ "@travetto/config": "^7.0.6",
31
+ "@travetto/di": "^7.0.6",
32
+ "@travetto/registry": "^7.0.6",
33
+ "@travetto/schema": "^7.0.6"
34
34
  },
35
35
  "peerDependencies": {
36
- "@travetto/cli": "^7.0.4",
37
- "@travetto/test": "^7.0.4"
36
+ "@travetto/cli": "^7.0.7",
37
+ "@travetto/test": "^7.0.6"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/runtime';
1
+ import { type Class, AppError } from '@travetto/runtime';
2
2
 
3
3
  /**
4
4
  * Represents when a data item already exists
@@ -1,7 +1,7 @@
1
- import { Class, AppError } from '@travetto/runtime';
1
+ import { type Class, AppError } from '@travetto/runtime';
2
2
 
3
- import { IndexConfig } from '../registry/types.ts';
4
- import { ModelType } from '../types/model.ts';
3
+ import type { IndexConfig } from '../registry/types.ts';
4
+ import type { ModelType } from '../types/model.ts';
5
5
 
6
6
  /**
7
7
  * Represents when an index is invalid
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/runtime';
1
+ import { type Class, AppError } from '@travetto/runtime';
2
2
 
3
3
  /**
4
4
  * Represents when a model subtype class is unable to be used directly
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/runtime';
1
+ import { type Class, AppError } from '@travetto/runtime';
2
2
 
3
3
  /**
4
4
  * Represents when a model of cls and id cannot be found
@@ -1,8 +1,8 @@
1
- import { AppError, castTo, Class, getClass } from '@travetto/runtime';
1
+ import { AppError, castTo, type Class, getClass } from '@travetto/runtime';
2
2
  import { SchemaRegistryIndex } from '@travetto/schema';
3
3
 
4
- import { ModelType } from '../types/model.ts';
5
- import { DataHandler, IndexConfig, ModelConfig, PrePersistScope } from './types.ts';
4
+ import type { ModelType } from '../types/model.ts';
5
+ import type { DataHandler, IndexConfig, ModelConfig, PrePersistScope } from './types.ts';
6
6
  import { ModelRegistryIndex } from './registry-index.ts';
7
7
 
8
8
  /**
@@ -1,8 +1,8 @@
1
1
  import type { RegistryAdapter } from '@travetto/registry';
2
- import { Class } from '@travetto/runtime';
2
+ import type { Class } from '@travetto/runtime';
3
3
  import { SchemaRegistryIndex } from '@travetto/schema';
4
4
 
5
- import { ModelConfig } from './types';
5
+ import type { ModelConfig } from './types.ts';
6
6
 
7
7
  function combineClasses(target: ModelConfig, sources: Partial<ModelConfig>[]): ModelConfig {
8
8
  for (const source of sources) {
@@ -1,12 +1,12 @@
1
- import { RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
2
- import { AppError, castTo, Class } from '@travetto/runtime';
1
+ import { type RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
2
+ import { AppError, castTo, type Class } from '@travetto/runtime';
3
3
  import { SchemaRegistryIndex } from '@travetto/schema';
4
4
 
5
- import { IndexConfig, IndexType, ModelConfig } from './types';
6
- import { ModelType } from '../types/model';
7
- import { ModelRegistryAdapter } from './registry-adapter';
8
- import { IndexNotSupported } from '../error/invalid-index';
9
- import { NotFoundError } from '../error/not-found';
5
+ import type { IndexConfig, IndexType, ModelConfig } from './types.ts';
6
+ import type { ModelType } from '../types/model.ts';
7
+ import { ModelRegistryAdapter } from './registry-adapter.ts';
8
+ import { IndexNotSupported } from '../error/invalid-index.ts';
9
+ import { NotFoundError } from '../error/not-found.ts';
10
10
 
11
11
  type IndexResult<T extends ModelType, K extends IndexType[]> = IndexConfig<T> & { type: K[number] };
12
12
 
@@ -1,6 +1,6 @@
1
1
  import type { Class, RetainPrimitiveFields } from '@travetto/runtime';
2
2
 
3
- import { ModelType } from '../types/model.ts';
3
+ import type { ModelType } from '../types/model.ts';
4
4
 
5
5
  export type SortClauseRaw<T> = {
6
6
  [P in keyof T]?:
@@ -1,5 +1,5 @@
1
- import { Class } from '@travetto/runtime';
2
- import { ModelIdSource, ModelType, OptionalId } from '../types/model.ts';
1
+ import type { Class } from '@travetto/runtime';
2
+ import type { ModelIdSource, ModelType, OptionalId } from '../types/model.ts';
3
3
 
4
4
  /**
5
5
  * Interface for basic data interface
package/src/types/blob.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BinaryInput, BlobMeta, ByteRange, TimeSpan } from '@travetto/runtime';
1
+ import type { BinaryInput, BlobMeta, ByteRange, TimeSpan } from '@travetto/runtime';
2
2
 
3
3
  /**
4
4
  * Support for Blobs CRUD.
package/src/types/bulk.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Class, AppError } from '@travetto/runtime';
2
- import { ValidationError, ValidationResultError } from '@travetto/schema';
1
+ import { type Class, AppError } from '@travetto/runtime';
2
+ import type { ValidationError, ValidationResultError } from '@travetto/schema';
3
3
 
4
- import { ModelCrudSupport } from './crud.ts';
5
- import { ModelType, OptionalId } from '../types/model.ts';
4
+ import type { ModelCrudSupport } from './crud.ts';
5
+ import type { ModelType, OptionalId } from '../types/model.ts';
6
6
 
7
7
  /**
8
8
  * Bulk operation. Each operation has a single action and payload
package/src/types/crud.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Class } from '@travetto/runtime';
1
+ import type { Class } from '@travetto/runtime';
2
2
 
3
- import { ModelType, OptionalId } from '../types/model.ts';
3
+ import type { ModelType, OptionalId } from '../types/model.ts';
4
4
 
5
- import { ModelBasicSupport } from './basic.ts';
5
+ import type { ModelBasicSupport } from './basic.ts';
6
6
 
7
7
  /**
8
8
  * Interface for simple CRUD
@@ -1,7 +1,7 @@
1
- import { Class } from '@travetto/runtime';
1
+ import type { Class } from '@travetto/runtime';
2
2
 
3
- import { ModelType } from '../types/model.ts';
4
- import { ModelCrudSupport } from './crud.ts';
3
+ import type { ModelType } from '../types/model.ts';
4
+ import type { ModelCrudSupport } from './crud.ts';
5
5
 
6
6
  /**
7
7
  * Support for managing expiration of data
@@ -1,7 +1,7 @@
1
- import { Class, DeepPartial } from '@travetto/runtime';
1
+ import type { Class, DeepPartial } from '@travetto/runtime';
2
2
 
3
- import { ModelType, OptionalId } from '../types/model.ts';
4
- import { ModelBasicSupport } from './basic.ts';
3
+ import type { ModelType, OptionalId } from '../types/model.ts';
4
+ import type { ModelBasicSupport } from './basic.ts';
5
5
 
6
6
  /**
7
7
  * Support for simple indexed activity
@@ -1,6 +1,6 @@
1
- import { Class } from '@travetto/runtime';
1
+ import type { Class } from '@travetto/runtime';
2
2
 
3
- import { ModelType } from '../types/model.ts';
3
+ import type { ModelType } from '../types/model.ts';
4
4
 
5
5
  /**
6
6
  * This interface defines the behavior for dealing with the
package/src/util/blob.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Readable } from 'node:stream';
2
- import { AppError, BinaryInput, BinaryUtil, BlobMeta, ByteRange, hasFunction } from '@travetto/runtime';
3
- import { ModelBlobSupport } from '../types/blob.ts';
2
+ import { AppError, type BinaryInput, BinaryUtil, type BlobMeta, type ByteRange, hasFunction } from '@travetto/runtime';
3
+ import type { ModelBlobSupport } from '../types/blob.ts';
4
4
 
5
5
  /**
6
6
  * Utilities for processing blobs
package/src/util/bulk.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Class, hasFunction } from '@travetto/runtime';
1
+ import { type Class, hasFunction } from '@travetto/runtime';
2
2
 
3
- import { BulkOperation, ModelBulkSupport } from '../types/bulk.ts';
4
- import { ModelType } from '../types/model.ts';
5
- import { ModelCrudProvider, ModelCrudUtil } from './crud.ts';
3
+ import type { BulkOperation, ModelBulkSupport } from '../types/bulk.ts';
4
+ import type { ModelType } from '../types/model.ts';
5
+ import { type ModelCrudProvider, ModelCrudUtil } from './crud.ts';
6
6
 
7
7
  export type BulkPreStore<T extends ModelType> = {
8
8
  insertedIds: Map<number, string>;
package/src/util/crud.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { castTo, Class, Util, AppError, hasFunction, JSONUtil } from '@travetto/runtime';
2
- import { DataUtil, SchemaRegistryIndex, SchemaValidator, ValidationError, ValidationResultError } from '@travetto/schema';
1
+ import { castTo, type Class, Util, AppError, hasFunction, JSONUtil } from '@travetto/runtime';
2
+ import { DataUtil, SchemaRegistryIndex, SchemaValidator, type ValidationError, ValidationResultError } from '@travetto/schema';
3
3
 
4
4
  import { ModelRegistryIndex } from '../registry/registry-index.ts';
5
- import { ModelIdSource, ModelType, OptionalId } from '../types/model.ts';
5
+ import type { ModelIdSource, ModelType, OptionalId } from '../types/model.ts';
6
6
  import { NotFoundError } from '../error/not-found.ts';
7
7
  import { ExistsError } from '../error/exists.ts';
8
8
  import { SubTypeNotSupportedError } from '../error/invalid-sub-type.ts';
9
- import { DataHandler, PrePersistScope } from '../registry/types.ts';
10
- import { ModelCrudSupport } from '../types/crud.ts';
9
+ import type { DataHandler, PrePersistScope } from '../registry/types.ts';
10
+ import type { ModelCrudSupport } from '../types/crud.ts';
11
11
 
12
12
  export type ModelCrudProvider = {
13
13
  idSource: ModelIdSource;
@@ -1,7 +1,7 @@
1
- import { ShutdownManager, Class, TimeSpan, TimeUtil, Util, castTo, hasFunction } from '@travetto/runtime';
1
+ import { ShutdownManager, type Class, type TimeSpan, TimeUtil, Util, castTo, hasFunction } from '@travetto/runtime';
2
2
 
3
- import { ModelExpirySupport } from '../types/expiry.ts';
4
- import { ModelType } from '../types/model.ts';
3
+ import type { ModelExpirySupport } from '../types/expiry.ts';
4
+ import type { ModelType } from '../types/model.ts';
5
5
  import { ModelRegistryIndex } from '../registry/registry-index.ts';
6
6
 
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { castTo, Class, DeepPartial, hasFunction, TypedObject } from '@travetto/runtime';
1
+ import { castTo, type Class, type DeepPartial, hasFunction, TypedObject } from '@travetto/runtime';
2
2
 
3
3
  import { IndexNotSupported } from '../error/invalid-index.ts';
4
4
  import { NotFoundError } from '../error/not-found.ts';
@@ -1,7 +1,7 @@
1
- import { Class, hasFunction, Runtime } from '@travetto/runtime';
1
+ import { type Class, hasFunction, Runtime } from '@travetto/runtime';
2
2
  import { SchemaRegistryIndex } from '@travetto/schema';
3
3
 
4
- import { ModelStorageSupport } from '../types/storage.ts';
4
+ import type { ModelStorageSupport } from '../types/storage.ts';
5
5
  import { ModelRegistryIndex } from '../registry/registry-index.ts';
6
6
 
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  import { Env } from '@travetto/runtime';
2
- import { CliValidationError, CliCommandShape, cliTpl } from '@travetto/cli';
2
+ import { type CliValidationError, type CliCommandShape, cliTpl } from '@travetto/cli';
3
3
  import { Registry } from '@travetto/registry';
4
4
  import { Schema } from '@travetto/schema';
5
5
 
@@ -1,5 +1,5 @@
1
- import { toConcrete, Class } from '@travetto/runtime';
2
- import { InjectableCandidate, DependencyRegistryIndex } from '@travetto/di';
1
+ import { toConcrete, type Class } from '@travetto/runtime';
2
+ import { type InjectableCandidate, DependencyRegistryIndex } from '@travetto/di';
3
3
  import { SchemaRegistryIndex } from '@travetto/schema';
4
4
 
5
5
  import type { ModelStorageSupport } from '../../src/types/storage.ts';
@@ -1,14 +1,14 @@
1
1
  /** @jsxImportSource @travetto/doc/support */
2
- import { d, c, DocJSXElementByFn, DocJSXElement, DocFileUtil } from '@travetto/doc';
2
+ import { d, c, type DocJSXElementByFn, type DocJSXElement, DocFileUtil } from '@travetto/doc';
3
3
  import { Config } from '@travetto/config';
4
4
  import { Runtime, toConcrete } from '@travetto/runtime';
5
5
 
6
- import { ModelBasicSupport } from '../src/types/basic.ts';
7
- import { ModelBlobSupport } from '../src/types/blob.ts';
8
- import { ModelBulkSupport } from '../src/types/bulk.ts';
9
- import { ModelCrudSupport } from '../src/types/crud.ts';
10
- import { ModelExpirySupport } from '../src/types/expiry.ts';
11
- import { ModelIndexedSupport } from '../src/types/indexed.ts';
6
+ import type { ModelBasicSupport } from '../src/types/basic.ts';
7
+ import type { ModelBlobSupport } from '../src/types/blob.ts';
8
+ import type { ModelBulkSupport } from '../src/types/bulk.ts';
9
+ import type { ModelCrudSupport } from '../src/types/crud.ts';
10
+ import type { ModelExpirySupport } from '../src/types/expiry.ts';
11
+ import type { ModelIndexedSupport } from '../src/types/indexed.ts';
12
12
 
13
13
  const toLink = (title: string, target: Function): DocJSXElementByFn<'CodeLink'> =>
14
14
  d.codeLink(title, Runtime.getSourceFile(target), new RegExp(`\\binterface\\s+${target.name}`));
@@ -39,7 +39,7 @@ export const ModelTypes = (fn: | Function): DocJSXElement[] => {
39
39
 
40
40
  export const ModelCustomConfig = ({ config }: { config: Function }): DocJSXElement => <>
41
41
  Out of the box, by installing the module, everything should be wired up by default.If you need to customize any aspect of the source
42
- or config, you can override and register it with the {d.mod('Di')} module.
42
+ or config, you can override and register it with the {d.module('Di')} module.
43
43
 
44
44
  <c.Code title='Wiring up a custom Model Source' src='doc/custom-service.ts' />
45
45
 
@@ -48,5 +48,5 @@ export const ModelCustomConfig = ({ config }: { config: Function }): DocJSXEleme
48
48
  <c.Code title={`Structure of ${config.name}`} src={config} startRe={/@Config/} />
49
49
 
50
50
  Additionally, you can see that the class is registered with the {Config} annotation, and so these values can be overridden using the
51
- standard {d.mod('Config')}resolution paths.
51
+ standard {d.module('Config')}resolution paths.
52
52
  </>;
@@ -1,9 +1,9 @@
1
1
  import { DependencyRegistryIndex } from '@travetto/di';
2
- import { AppError, castTo, Class, classConstruct } from '@travetto/runtime';
2
+ import { AppError, castTo, type Class, classConstruct } from '@travetto/runtime';
3
3
 
4
4
  import { ModelBulkUtil } from '../../src/util/bulk.ts';
5
5
  import { ModelCrudUtil } from '../../src/util/crud.ts';
6
- import { ModelType } from '../../src/types/model.ts';
6
+ import type { ModelType } from '../../src/types/model.ts';
7
7
  import { ModelSuite } from './suite.ts';
8
8
 
9
9
  type ServiceClass = { serviceClass: { new(): unknown } };
@@ -1,7 +1,7 @@
1
1
  import assert from 'node:assert';
2
2
 
3
3
  import { Suite, Test } from '@travetto/test';
4
- import { ModelCrudSupport, Model, NotFoundError } from '@travetto/model';
4
+ import { type ModelCrudSupport, Model, NotFoundError } from '@travetto/model';
5
5
 
6
6
  import { BaseModelSuite } from './base.ts';
7
7
 
@@ -5,7 +5,7 @@ import { BinaryUtil, Util } from '@travetto/runtime';
5
5
 
6
6
  import { BaseModelSuite } from '@travetto/model/support/test/base.ts';
7
7
 
8
- import { ModelBlobSupport } from '../../src/types/blob.ts';
8
+ import type { ModelBlobSupport } from '../../src/types/blob.ts';
9
9
  import { ModelBlobUtil } from '../../src/util/blob.ts';
10
10
 
11
11
  const meta = BinaryUtil.getBlobMeta;
@@ -3,7 +3,7 @@ import assert from 'node:assert';
3
3
  import { Suite, Test } from '@travetto/test';
4
4
 
5
5
  import { Model } from '../../src/registry/decorator.ts';
6
- import { ModelBulkSupport } from '../../src/types/bulk.ts';
6
+ import type { ModelBulkSupport } from '../../src/types/bulk.ts';
7
7
  import { BaseModelSuite } from './base.ts';
8
8
 
9
9
  @Model('bulk-user')
@@ -3,7 +3,7 @@ import timers from 'node:timers/promises';
3
3
 
4
4
  import { Suite, Test } from '@travetto/test';
5
5
  import { Schema, Text, Precision, Required, } from '@travetto/schema';
6
- import { ModelCrudSupport, Model, NotFoundError, PersistValue } from '@travetto/model';
6
+ import { type ModelCrudSupport, Model, NotFoundError, PersistValue } from '@travetto/model';
7
7
 
8
8
  import { BaseModelSuite } from './base.ts';
9
9
 
@@ -2,10 +2,10 @@ import assert from 'node:assert';
2
2
  import timers from 'node:timers/promises';
3
3
 
4
4
  import { Suite, Test } from '@travetto/test';
5
- import { TimeSpan, TimeUnit, TimeUtil } from '@travetto/runtime';
5
+ import { type TimeSpan, type TimeUnit, TimeUtil } from '@travetto/runtime';
6
6
 
7
7
  import { ExpiresAt, Model } from '../../src/registry/decorator.ts';
8
- import { ModelExpirySupport } from '../../src/types/expiry.ts';
8
+ import type { ModelExpirySupport } from '../../src/types/expiry.ts';
9
9
  import { ModelExpiryUtil } from '../../src/util/expiry.ts';
10
10
  import { NotFoundError } from '../../src/error/not-found.ts';
11
11
  import { BaseModelSuite } from './base.ts';
@@ -5,7 +5,7 @@ import { Schema } from '@travetto/schema';
5
5
  import { TimeUtil } from '@travetto/runtime';
6
6
 
7
7
  import { Index, Model } from '../../src/registry/decorator.ts';
8
- import { ModelIndexedSupport } from '../../src/types/indexed.ts';
8
+ import type { ModelIndexedSupport } from '../../src/types/indexed.ts';
9
9
  import { NotFoundError } from '../../src/error/not-found.ts';
10
10
  import { IndexNotSupported } from '../../src/error/invalid-index.ts';
11
11
 
@@ -5,7 +5,7 @@ import { Suite, Test } from '@travetto/test';
5
5
  import { castTo } from '@travetto/runtime';
6
6
  import { Schema, DiscriminatorField, Text, TypeMismatchError, Discriminated } from '@travetto/schema';
7
7
  import {
8
- ModelIndexedSupport, Index, ModelCrudSupport, Model,
8
+ type ModelIndexedSupport, Index, type ModelCrudSupport, Model,
9
9
  NotFoundError, SubTypeNotSupportedError, PersistValue
10
10
  } from '@travetto/model';
11
11
 
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/runtime';
1
+ import type { Class } from '@travetto/runtime';
2
2
  import { DependencyRegistryIndex } from '@travetto/di';
3
3
  import { Registry } from '@travetto/registry';
4
4
  import { SuiteRegistryIndex, TestFixtures } from '@travetto/test';