@skmtc/core 0.0.357 → 0.0.359

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.
@@ -26,8 +26,8 @@ export class Definition extends ValueBase {
26
26
  this.description = description;
27
27
  }
28
28
  toString() {
29
- const identifier = this.identifier.tsType
30
- ? `${this.identifier.name}: ${this.identifier.tsType}`
29
+ const identifier = this.identifier.typeName
30
+ ? `${this.identifier.name}: ${this.identifier.typeName}`
31
31
  : this.identifier.name;
32
32
  // @TODO move syntax to typescript package to enable language agnostic use
33
33
  return withDescription(`export ${this.identifier.entityType} ${identifier} = ${this.value};`, {
@@ -1,19 +1,15 @@
1
1
  import { EntityType } from './EntityType.js';
2
- type CreateVariableArgs = string | {
3
- name: string;
4
- tsType?: string;
5
- };
6
2
  type ConstructorArgs = {
7
3
  name: string;
8
- tsType?: string;
4
+ typeName?: string;
9
5
  entityType: EntityType;
10
6
  };
11
7
  export declare class Identifier {
12
8
  name: string;
13
9
  entityType: EntityType;
14
- tsType?: string;
15
- constructor({ name, tsType, entityType }: ConstructorArgs);
16
- static createVariable(args: CreateVariableArgs): Identifier;
10
+ typeName?: string;
11
+ constructor({ name, typeName, entityType }: ConstructorArgs);
12
+ static createVariable(name: string, typeName?: string): Identifier;
17
13
  static createType(name: string): Identifier;
18
14
  toString(): string;
19
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Identifier.d.ts","sourceRoot":"","sources":["../../src/dsl/Identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,KAAK,kBAAkB,GACnB,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAEL,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEH,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,eAAe;IAMzD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,UAAU;IAiB3D,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAO3C,QAAQ,IAAI,MAAM;CAGnB"}
1
+ {"version":3,"file":"Identifier.d.ts","sourceRoot":"","sources":["../../src/dsl/Identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;gBAEL,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,eAAe;IAM3D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU;IAelE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAO3C,QAAQ,IAAI,MAAM;CAGnB"}
@@ -1,7 +1,6 @@
1
1
  import { EntityType } from './EntityType.js';
2
- import { P, match } from 'ts-pattern';
3
2
  export class Identifier {
4
- constructor({ name, tsType, entityType }) {
3
+ constructor({ name, typeName, entityType }) {
5
4
  Object.defineProperty(this, "name", {
6
5
  enumerable: true,
7
6
  configurable: true,
@@ -14,30 +13,27 @@ export class Identifier {
14
13
  writable: true,
15
14
  value: void 0
16
15
  });
17
- Object.defineProperty(this, "tsType", {
16
+ Object.defineProperty(this, "typeName", {
18
17
  enumerable: true,
19
18
  configurable: true,
20
19
  writable: true,
21
20
  value: void 0
22
21
  });
23
22
  this.name = name;
24
- this.tsType = tsType;
23
+ this.typeName = typeName;
25
24
  this.entityType = entityType;
26
25
  }
27
- static createVariable(args) {
28
- return match(args)
29
- .with(P.string, name => {
26
+ static createVariable(name, typeName) {
27
+ if (typeName) {
30
28
  return new Identifier({
31
29
  name,
30
+ typeName,
32
31
  entityType: new EntityType('variable')
33
32
  });
34
- })
35
- .otherwise(({ name, tsType }) => {
36
- return new Identifier({
37
- name,
38
- tsType,
39
- entityType: new EntityType('variable')
40
- });
33
+ }
34
+ return new Identifier({
35
+ name,
36
+ entityType: new EntityType('variable')
41
37
  });
42
38
  }
43
39
  static createType(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.357",
3
+ "version": "0.0.359",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -29,8 +29,8 @@ class Definition extends ValueBase_js_1.ValueBase {
29
29
  this.description = description;
30
30
  }
31
31
  toString() {
32
- const identifier = this.identifier.tsType
33
- ? `${this.identifier.name}: ${this.identifier.tsType}`
32
+ const identifier = this.identifier.typeName
33
+ ? `${this.identifier.name}: ${this.identifier.typeName}`
34
34
  : this.identifier.name;
35
35
  // @TODO move syntax to typescript package to enable language agnostic use
36
36
  return (0, withDescription_js_1.withDescription)(`export ${this.identifier.entityType} ${identifier} = ${this.value};`, {
@@ -1,19 +1,15 @@
1
1
  import { EntityType } from './EntityType.js';
2
- type CreateVariableArgs = string | {
3
- name: string;
4
- tsType?: string;
5
- };
6
2
  type ConstructorArgs = {
7
3
  name: string;
8
- tsType?: string;
4
+ typeName?: string;
9
5
  entityType: EntityType;
10
6
  };
11
7
  export declare class Identifier {
12
8
  name: string;
13
9
  entityType: EntityType;
14
- tsType?: string;
15
- constructor({ name, tsType, entityType }: ConstructorArgs);
16
- static createVariable(args: CreateVariableArgs): Identifier;
10
+ typeName?: string;
11
+ constructor({ name, typeName, entityType }: ConstructorArgs);
12
+ static createVariable(name: string, typeName?: string): Identifier;
17
13
  static createType(name: string): Identifier;
18
14
  toString(): string;
19
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Identifier.d.ts","sourceRoot":"","sources":["../../src/dsl/Identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,KAAK,kBAAkB,GACnB,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAEL,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEH,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,eAAe;IAMzD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,UAAU;IAiB3D,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAO3C,QAAQ,IAAI,MAAM;CAGnB"}
1
+ {"version":3,"file":"Identifier.d.ts","sourceRoot":"","sources":["../../src/dsl/Identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,qBAAa,UAAU;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;gBAEL,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,eAAe;IAM3D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU;IAelE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAO3C,QAAQ,IAAI,MAAM;CAGnB"}
@@ -2,9 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Identifier = void 0;
4
4
  const EntityType_js_1 = require("./EntityType.js");
5
- const ts_pattern_1 = require("ts-pattern");
6
5
  class Identifier {
7
- constructor({ name, tsType, entityType }) {
6
+ constructor({ name, typeName, entityType }) {
8
7
  Object.defineProperty(this, "name", {
9
8
  enumerable: true,
10
9
  configurable: true,
@@ -17,30 +16,27 @@ class Identifier {
17
16
  writable: true,
18
17
  value: void 0
19
18
  });
20
- Object.defineProperty(this, "tsType", {
19
+ Object.defineProperty(this, "typeName", {
21
20
  enumerable: true,
22
21
  configurable: true,
23
22
  writable: true,
24
23
  value: void 0
25
24
  });
26
25
  this.name = name;
27
- this.tsType = tsType;
26
+ this.typeName = typeName;
28
27
  this.entityType = entityType;
29
28
  }
30
- static createVariable(args) {
31
- return (0, ts_pattern_1.match)(args)
32
- .with(ts_pattern_1.P.string, name => {
29
+ static createVariable(name, typeName) {
30
+ if (typeName) {
33
31
  return new Identifier({
34
32
  name,
33
+ typeName,
35
34
  entityType: new EntityType_js_1.EntityType('variable')
36
35
  });
37
- })
38
- .otherwise(({ name, tsType }) => {
39
- return new Identifier({
40
- name,
41
- tsType,
42
- entityType: new EntityType_js_1.EntityType('variable')
43
- });
36
+ }
37
+ return new Identifier({
38
+ name,
39
+ entityType: new EntityType_js_1.EntityType('variable')
44
40
  });
45
41
  }
46
42
  static createType(name) {