@travetto/config 5.0.13 → 5.0.15

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ArcSine Technologies
3
+ Copyright (c) 2020 ArcSine Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -200,12 +200,12 @@ You can see that the `DBConfig` allows for the `port` to be overridden by the `D
200
200
  $ trv main doc/dbconfig-run.ts
201
201
 
202
202
  {
203
- message: 'Failed to construct @travetto/config:doc/dbconfigDBConfig as validation errors have occurred',
203
+ message: 'Failed to construct @travetto/config:doc/dbconfig#DBConfig as validation errors have occurred',
204
204
  category: 'data',
205
205
  type: 'ValidationResultError',
206
206
  at: '2029-03-14T04:00:00.618Z',
207
207
  details: {
208
- class: '@travetto/config:doc/dbconfigDBConfig',
208
+ class: '@travetto/config:doc/dbconfig#DBConfig',
209
209
  import: '@travetto/config/doc/dbconfig.ts',
210
210
  errors: [
211
211
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/config",
3
- "version": "5.0.13",
3
+ "version": "5.0.15",
4
4
  "description": "Configuration support",
5
5
  "keywords": [
6
6
  "yaml",
@@ -26,9 +26,9 @@
26
26
  "directory": "module/config"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/di": "^5.0.13",
30
- "@travetto/schema": "^5.0.13",
31
- "yaml": "^2.6.0"
29
+ "@travetto/di": "^5.0.15",
30
+ "@travetto/schema": "^5.0.15",
31
+ "yaml": "^2.6.1"
32
32
  },
33
33
  "travetto": {
34
34
  "displayName": "Configuration"
package/src/service.ts CHANGED
@@ -113,8 +113,9 @@ export class ConfigurationService {
113
113
  * Bind and validate configuration into class instance
114
114
  */
115
115
  async bindTo<T>(cls: Class<T>, item: T, namespace: string, validate = true): Promise<T> {
116
+ const classId = cls.Ⲑid;
116
117
  if (!SchemaRegistry.has(cls)) {
117
- throw new AppError(`${cls.Ⲑid} is not a valid schema class, config is not supported`);
118
+ throw new AppError(`${classId} is not a valid schema class, config is not supported`);
118
119
  }
119
120
  const out = BindUtil.bindSchemaToObject(cls, item, this.#get(namespace));
120
121
  if (validate) {
@@ -123,10 +124,10 @@ export class ConfigurationService {
123
124
  } catch (err) {
124
125
  if (err instanceof ValidationResultError) {
125
126
  const ogMessage = err.message;
126
- err.message = `Failed to construct ${cls.Ⲑid} as validation errors have occurred`;
127
+ err.message = `Failed to construct ${classId} as validation errors have occurred`;
127
128
  err.stack = err.stack?.replace(ogMessage, err.message);
128
129
  const imp = Runtime.getImport(cls);
129
- Object.defineProperty(err, 'details', { value: { class: cls.Ⲑid, import: imp, ...(err.details ?? {}) } });
130
+ Object.defineProperty(err, 'details', { value: { class: classId, import: imp, ...(err.details ?? {}) } });
130
131
  }
131
132
  throw err;
132
133
  }