@travetto/model 5.0.0-rc.1 → 5.0.0-rc.3

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
@@ -235,7 +235,7 @@ In addition to the provided contracts, the module also provides common utilities
235
235
  ```typescript
236
236
  import { Readable } from 'node:stream';
237
237
  import { buffer as toBuffer } from 'node:stream/consumers';
238
- import { Class, TimeSpan } from '@travetto/base';
238
+ import { Class, TimeSpan } from '@travetto/runtime';
239
239
  import { DeepPartial } from '@travetto/schema';
240
240
  import { Injectable } from '@travetto/di';
241
241
  import { Config } from '@travetto/config';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0-rc.3",
4
4
  "description": "Datastore abstraction for core operations.",
5
5
  "keywords": [
6
6
  "datastore",
@@ -26,14 +26,14 @@
26
26
  "directory": "module/model"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^5.0.0-rc.1",
30
- "@travetto/di": "^5.0.0-rc.0",
31
- "@travetto/registry": "^5.0.0-rc.1",
32
- "@travetto/schema": "^5.0.0-rc.0"
29
+ "@travetto/config": "^5.0.0-rc.3",
30
+ "@travetto/di": "^5.0.0-rc.3",
31
+ "@travetto/registry": "^5.0.0-rc.3",
32
+ "@travetto/schema": "^5.0.0-rc.3"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/cli": "^5.0.0-rc.1",
36
- "@travetto/test": "^5.0.0-rc.1"
35
+ "@travetto/cli": "^5.0.0-rc.3",
36
+ "@travetto/test": "^5.0.0-rc.3"
37
37
  },
38
38
  "peerDependenciesMeta": {
39
39
  "@travetto/cli": {
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/base';
1
+ import { Class, AppError } from '@travetto/runtime';
2
2
 
3
3
  /**
4
4
  * Represents when a data item already exists
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/base';
1
+ import { Class, AppError } from '@travetto/runtime';
2
2
 
3
3
  import { IndexConfig } from '../registry/types';
4
4
  import { ModelType } from '../types/model';
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/base';
1
+ import { 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/base';
1
+ import { Class, AppError } from '@travetto/runtime';
2
2
 
3
3
  /**
4
4
  * Represents when a model of cls and id cannot be found
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
 
3
3
  import { BulkOp } from '../../service/bulk';
4
4
  import { ModelType } from '../../types/model';
@@ -1,6 +1,6 @@
1
1
  import crypto from 'node:crypto';
2
2
 
3
- import { Class, Util } from '@travetto/base';
3
+ import { Class, Util } from '@travetto/runtime';
4
4
  import { DataUtil, SchemaRegistry, SchemaValidator, ValidationError, ValidationResultError } from '@travetto/schema';
5
5
 
6
6
  import { ModelRegistry } from '../../registry/model';
@@ -1,4 +1,4 @@
1
- import { ShutdownManager, Class, TimeSpan, TimeUtil, Util } from '@travetto/base';
1
+ import { ShutdownManager, Class, TimeSpan, TimeUtil, Util } from '@travetto/runtime';
2
2
 
3
3
  import { ModelRegistry } from '../../registry/model';
4
4
  import { ModelExpirySupport } from '../../service/expiry';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { DeepPartial } from '@travetto/schema';
3
3
 
4
4
  import { IndexNotSupported } from '../../error/invalid-index';
@@ -1,4 +1,4 @@
1
- import { Class, Env } from '@travetto/base';
1
+ import { Class, Runtime } from '@travetto/runtime';
2
2
  import { SchemaChangeListener } from '@travetto/schema';
3
3
 
4
4
  import { ModelRegistry } from '../../registry/model';
@@ -13,7 +13,7 @@ export class ModelStorageUtil {
13
13
  * Register change listener on startup
14
14
  */
15
15
  static async registerModelChangeListener(storage: ModelStorageSupport, target?: Class): Promise<void> {
16
- if (!Env.dynamic || !(storage?.config?.autoCreate ?? !Env.production)) {
16
+ if (!Runtime.dynamic || !(storage?.config?.autoCreate ?? !Runtime.production)) {
17
17
  return;
18
18
  }
19
19
 
@@ -1,4 +1,4 @@
1
- import { AppError, Class } from '@travetto/base';
1
+ import { AppError, Class } from '@travetto/runtime';
2
2
 
3
3
  import { ModelType } from '../../types/model';
4
4
  import { StreamRange } from '../../service/stream';
@@ -5,7 +5,7 @@ import { Readable } from 'node:stream';
5
5
  import { pipeline } from 'node:stream/promises';
6
6
  import path from 'node:path';
7
7
 
8
- import { Class, TimeSpan, RuntimeContext } from '@travetto/base';
8
+ import { Class, TimeSpan, Runtime } from '@travetto/runtime';
9
9
  import { Injectable } from '@travetto/di';
10
10
  import { Config } from '@travetto/config';
11
11
  import { Required } from '@travetto/schema';
@@ -36,7 +36,7 @@ export class FileModelConfig {
36
36
  cullRate?: number | TimeSpan;
37
37
 
38
38
  async postConstruct(): Promise<void> {
39
- this.folder ??= path.resolve(os.tmpdir(), `trv_file_${RuntimeContext.main.name.replace(/[^a-z]/ig, '_')}`);
39
+ this.folder ??= path.resolve(os.tmpdir(), `trv_file_${Runtime.main.name.replace(/[^a-z]/ig, '_')}`);
40
40
  }
41
41
  }
42
42
 
@@ -1,7 +1,7 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { buffer as toBuffer } from 'node:stream/consumers';
3
3
 
4
- import { Class, TimeSpan } from '@travetto/base';
4
+ import { Class, TimeSpan } from '@travetto/runtime';
5
5
  import { DeepPartial } from '@travetto/schema';
6
6
  import { Injectable } from '@travetto/di';
7
7
  import { Config } from '@travetto/config';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { SchemaRegistry } from '@travetto/schema';
3
3
 
4
4
  import { ModelType } from '../types/model';
@@ -1,8 +1,7 @@
1
- import { RuntimeIndex } from '@travetto/manifest';
2
1
  import { SchemaRegistry } from '@travetto/schema';
3
2
  import { MetadataRegistry } from '@travetto/registry';
4
3
  import { DependencyRegistry } from '@travetto/di';
5
- import { AppError, Class } from '@travetto/base';
4
+ import { AppError, Class, describeFunction } from '@travetto/runtime';
6
5
  import { AllViewⲐ } from '@travetto/schema/src/internal/types';
7
6
 
8
7
  import { IndexConfig, IndexType, ModelOptions } from './types';
@@ -52,7 +51,14 @@ class $ModelRegistry extends MetadataRegistry<ModelOptions<ModelType>> {
52
51
  }
53
52
 
54
53
  createPending(cls: Class): Partial<ModelOptions<ModelType>> {
55
- return { class: cls, indices: [], autoCreate: true, baseType: RuntimeIndex.getFunctionMetadata(cls)?.abstract, postLoad: [], prePersist: [] };
54
+ return {
55
+ class: cls,
56
+ indices: [],
57
+ autoCreate: true,
58
+ baseType: describeFunction(cls).abstract,
59
+ postLoad: [],
60
+ prePersist: []
61
+ };
56
62
  }
57
63
 
58
64
  registerDataHandlers(cls: Class, pConfig?: Partial<ModelOptions<ModelType>>): void {
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { Primitive } from '@travetto/schema';
3
3
 
4
4
  import { ModelType } from '../types/model';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { ModelType, OptionalId } from '../types/model';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Class, AppError } from '@travetto/base';
1
+ import { Class, AppError } from '@travetto/runtime';
2
2
  import { ValidationResultError } from '@travetto/schema';
3
3
 
4
4
  import { ModelCrudSupport } from './crud';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
 
3
3
  import { ModelType, OptionalId, ModelIdSource } from '../types/model';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
 
3
3
  import { ModelType } from '../types/model';
4
4
  import { ModelCrudSupport } from './crud';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { DeepPartial } from '@travetto/schema';
3
3
 
4
4
  import { ModelType, OptionalId } from '../types/model';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { SchemaChange } from '@travetto/schema';
3
3
 
4
4
  import { ModelType } from '../types/model';
@@ -1,4 +1,4 @@
1
- import { Env } from '@travetto/base';
1
+ import { Env } from '@travetto/runtime';
2
2
  import { CliValidationError, CliCommandShape, cliTpl } from '@travetto/cli';
3
3
  import { RootRegistry } from '@travetto/registry';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { ModelRegistry } from '@travetto/model/src/registry/model';
3
3
  import { InjectableConfig, DependencyRegistry } from '@travetto/di';
4
4
  import { ModelStorageSupportTarget } from '@travetto/model/src/internal/service/common';
@@ -1,4 +1,4 @@
1
- import type { Class } from '@travetto/base';
1
+ import type { Class } from '@travetto/runtime';
2
2
  import type { ModelStorageSupport } from '@travetto/model/src/service/storage';
3
3
  import type { ModelType } from '@travetto/model/src/types/model';
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Class } from '@travetto/base';
1
+ import type { Class } from '@travetto/runtime';
2
2
  import type { ModelStorageSupport } from '@travetto/model/src/service/storage';
3
3
  import type { ModelType } from '@travetto/model/src/types/model';
4
4
 
@@ -1,9 +1,9 @@
1
1
  /** @jsxImportSource @travetto/doc */
2
2
  import { readFileSync } from 'node:fs';
3
3
 
4
- import { RuntimeIndex } from '@travetto/manifest';
5
4
  import { d, c, DocJSXElementByFn, DocJSXElement } from '@travetto/doc';
6
5
  import { Config } from '@travetto/config';
6
+ import { Runtime } from '@travetto/runtime';
7
7
 
8
8
  export const Links = {
9
9
  Basic: d.codeLink('Basic', '@travetto/model/src/service/basic.ts', /export interface/),
@@ -16,7 +16,7 @@ export const Links = {
16
16
 
17
17
  export const ModelTypes = (file: string | Function): DocJSXElement[] => {
18
18
  if (typeof file !== 'string') {
19
- file = RuntimeIndex.getFunctionMetadata(file)!.source;
19
+ file = Runtime.getSource(file);
20
20
  }
21
21
  const contents = readFileSync(file, 'utf8');
22
22
  const found: DocJSXElementByFn<'CodeLink'>[] = [];
@@ -1,5 +1,5 @@
1
1
  import { DependencyRegistry } from '@travetto/di';
2
- import { AppError, Class } from '@travetto/base';
2
+ import { AppError, Class } from '@travetto/runtime';
3
3
 
4
4
  import { isBulkSupported, isCrudSupported } from '../../src/internal/service/common';
5
5
  import { ModelType } from '../../src/types/model';
@@ -2,7 +2,7 @@ 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/base';
5
+ import { TimeSpan, TimeUnit, TimeUtil } from '@travetto/runtime';
6
6
 
7
7
  import { ExpiresAt, Model } from '../../src/registry/decorator';
8
8
  import { ModelExpirySupport } from '../../src/service/expiry';
@@ -2,7 +2,7 @@ import assert from 'node:assert';
2
2
 
3
3
  import { Suite, Test } from '@travetto/test';
4
4
  import { Schema } from '@travetto/schema';
5
- import { TimeUtil } from '@travetto/base';
5
+ import { TimeUtil } from '@travetto/runtime';
6
6
 
7
7
  import { Index, Model } from '../../src/registry/decorator';
8
8
  import { ModelIndexedSupport } from '../../src/service/indexed';
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
  import { DependencyRegistry } from '@travetto/di';
3
3
  import { RootRegistry } from '@travetto/registry';
4
4
  import { SuiteRegistry, TestFixtures } from '@travetto/test';