@skmtc/core 0.0.234 → 0.0.235

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.
@@ -22,6 +22,11 @@ type ToObjectV3Args = {
22
22
  skipped: Record<string, unknown>;
23
23
  context: CoreContext;
24
24
  };
25
+ type AddPropertyArgs = {
26
+ name: string;
27
+ schema: OasSchema | OasRef<'schema'> | CustomValue;
28
+ required?: boolean;
29
+ };
25
30
  export declare class OasObject extends OasBase {
26
31
  #private;
27
32
  oasType: 'schema';
@@ -34,6 +39,8 @@ export declare class OasObject extends OasBase {
34
39
  get required(): string[] | undefined;
35
40
  get additionalProperties(): boolean | OasSchema | OasRef<'schema'> | undefined;
36
41
  get nullable(): boolean | undefined;
42
+ addProperty({ name, schema, required }: AddPropertyArgs): void;
43
+ removeProperty(name: string): void;
37
44
  isRef(): this is OasRef<'schema'>;
38
45
  resolve(): OasObject;
39
46
  resolveOnce(): OasObject;
@@ -1 +1 @@
1
- {"version":3,"file":"Object.d.ts","sourceRoot":"","sources":["../../../src/oas/object/Object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,CAAA;IAC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CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,qBAAa,SAAU,SAAQ,OAAO;;IACpC,OAAO,EAAE,QAAQ,CAAW;IAC5B,IAAI,EAAE,QAAQ,CAAW;gBAGb,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,cAAc;IAM/D,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,GAAG,SAAS;IASjE,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,UAAU,IACV,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,GAC1D,SAAS,CAEZ;IAED,IAAI,QAAQ,IAAI,MAAM,EAAE,GAAG,SAAS,CAEnC;IAED,IAAI,oBAAoB,IACpB,OAAO,GACP,SAAS,GACT,MAAM,CAAC,QAAQ,CAAC,GAChB,SAAS,CAEZ;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;IAED,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,eAAe;IAevD,cAAc,CAAC,IAAI,EAAE,MAAM;IAQ3B,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;CAGzB"}
@@ -56,6 +56,24 @@ export class OasObject extends OasBase {
56
56
  get nullable() {
57
57
  return __classPrivateFieldGet(this, _OasObject_fields, "f").nullable;
58
58
  }
59
+ addProperty({ name, schema, required }) {
60
+ if (__classPrivateFieldGet(this, _OasObject_fields, "f").properties === undefined) {
61
+ __classPrivateFieldGet(this, _OasObject_fields, "f").properties = {};
62
+ }
63
+ __classPrivateFieldGet(this, _OasObject_fields, "f").properties[name] = schema;
64
+ if (required) {
65
+ if (__classPrivateFieldGet(this, _OasObject_fields, "f").required === undefined) {
66
+ __classPrivateFieldGet(this, _OasObject_fields, "f").required = [];
67
+ }
68
+ __classPrivateFieldGet(this, _OasObject_fields, "f").required.push(name);
69
+ }
70
+ }
71
+ removeProperty(name) {
72
+ __classPrivateFieldGet(this, _OasObject_fields, "f").required = __classPrivateFieldGet(this, _OasObject_fields, "f").required?.filter(n => n !== name);
73
+ if (__classPrivateFieldGet(this, _OasObject_fields, "f").properties?.[name] !== undefined) {
74
+ delete __classPrivateFieldGet(this, _OasObject_fields, "f").properties[name];
75
+ }
76
+ }
59
77
  isRef() {
60
78
  return false;
61
79
  }
@@ -1,23 +1,20 @@
1
1
  import type { CoreContext } from '../context/CoreContext.js';
2
- import type { ContentSettings } from '../dsl/ContentSettings.js';
3
2
  import { Definition } from '../dsl/Definition.js';
4
- import type { OasObject } from '../oas/object/Object.js';
5
- import type { TypeSystemArgs, TypeSystemValue } from '../types/TypeSystem.js';
3
+ import type { TypeSystemValue } from '../types/TypeSystem.js';
6
4
  import { FunctionParameter } from './FunctionParameter.js';
7
5
  type ConstructorArgs = {
8
6
  context: CoreContext;
9
- name?: string;
10
- objectSchema: OasObject;
11
- settings: ContentSettings;
7
+ argName?: string;
8
+ typeName: string;
9
+ typeValue: TypeSystemValue;
12
10
  pathTemplate: string;
13
- toValue: (args: TypeSystemArgs) => TypeSystemValue;
14
11
  };
15
12
  export declare class PathParams {
16
13
  context: CoreContext;
17
14
  typeDefinition: Definition<TypeSystemValue>;
18
15
  parameter: FunctionParameter;
19
16
  path: string;
20
- constructor({ context, name, objectSchema, settings, pathTemplate, toValue }: ConstructorArgs);
17
+ constructor({ context, argName, typeName, typeValue, pathTemplate }: ConstructorArgs);
21
18
  }
22
19
  export {};
23
20
  //# sourceMappingURL=PathParams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/PathParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,W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ChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,eAAe,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,UAAU;IACrB,OAAO,EAAE,WAAW,CAAA;IACpB,cAAc,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAC3C,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;gBAEA,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACb,EAAE,eAAe;CAwBnB"}
@@ -1,10 +1,9 @@
1
1
  import { Definition } from '../dsl/Definition.js';
2
2
  import { Identifier } from '../dsl/Identifier.js';
3
- import { capitalize } from '../helpers/strings.js';
4
3
  import { FunctionParameter } from './FunctionParameter.js';
5
4
  import { toPathTemplate } from './toPathTemplate.js';
6
5
  export class PathParams {
7
- constructor({ context, name, objectSchema, settings, pathTemplate, toValue }) {
6
+ constructor({ context, argName, typeName, typeValue, pathTemplate }) {
8
7
  Object.defineProperty(this, "context", {
9
8
  enumerable: true,
10
9
  configurable: true,
@@ -32,18 +31,13 @@ export class PathParams {
32
31
  this.context = context;
33
32
  this.typeDefinition = new Definition({
34
33
  context,
35
- identifier: Identifier.createType(capitalize(`${settings.name}Params`)),
36
- value: toValue({
37
- context,
38
- schema: objectSchema,
39
- destinationPath: settings.exportPath,
40
- required: true
41
- })
34
+ identifier: Identifier.createType(typeName),
35
+ value: typeValue
42
36
  });
43
37
  this.parameter = new FunctionParameter({
44
- name,
38
+ name: argName,
45
39
  typeDefinition: this.typeDefinition,
46
- destructure: !name,
40
+ destructure: !argName,
47
41
  required: true
48
42
  });
49
43
  const queryArg = this.parameter.properties.type === 'regular'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.234",
3
+ "version": "0.0.235",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -22,6 +22,11 @@ type ToObjectV3Args = {
22
22
  skipped: Record<string, unknown>;
23
23
  context: CoreContext;
24
24
  };
25
+ type AddPropertyArgs = {
26
+ name: string;
27
+ schema: OasSchema | OasRef<'schema'> | CustomValue;
28
+ required?: boolean;
29
+ };
25
30
  export declare class OasObject extends OasBase {
26
31
  #private;
27
32
  oasType: 'schema';
@@ -34,6 +39,8 @@ export declare class OasObject extends OasBase {
34
39
  get required(): string[] | undefined;
35
40
  get additionalProperties(): boolean | OasSchema | OasRef<'schema'> | undefined;
36
41
  get nullable(): boolean | undefined;
42
+ addProperty({ name, schema, required }: AddPropertyArgs): void;
43
+ removeProperty(name: string): void;
37
44
  isRef(): this is OasRef<'schema'>;
38
45
  resolve(): OasObject;
39
46
  resolveOnce(): OasObject;
@@ -1 +1 @@
1
- {"version":3,"file":"Object.d.ts","sourceRoot":"","sources":["../../../src/oas/object/Object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,CAAA;IACvE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ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AE,QAAQ,CAAW;gBAGb,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,cAAc;IAM/D,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,GAAG,SAAS;IASjE,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,UAAU,IACV,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,GAC1D,SAAS,CAEZ;IAED,IAAI,QAAQ,IAAI,MAAM,EAAE,GAAG,SAAS,CAEnC;IAED,IAAI,oBAAoB,IACpB,OAAO,GACP,SAAS,GACT,MAAM,CAAC,QAAQ,CAAC,GAChB,SAAS,CAEZ;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;IAED,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,eAAe;IAevD,cAAc,CAAC,IAAI,EAAE,MAAM;IAQ3B,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;CAGzB"}
@@ -59,6 +59,24 @@ class OasObject extends OasBase_js_1.OasBase {
59
59
  get nullable() {
60
60
  return __classPrivateFieldGet(this, _OasObject_fields, "f").nullable;
61
61
  }
62
+ addProperty({ name, schema, required }) {
63
+ if (__classPrivateFieldGet(this, _OasObject_fields, "f").properties === undefined) {
64
+ __classPrivateFieldGet(this, _OasObject_fields, "f").properties = {};
65
+ }
66
+ __classPrivateFieldGet(this, _OasObject_fields, "f").properties[name] = schema;
67
+ if (required) {
68
+ if (__classPrivateFieldGet(this, _OasObject_fields, "f").required === undefined) {
69
+ __classPrivateFieldGet(this, _OasObject_fields, "f").required = [];
70
+ }
71
+ __classPrivateFieldGet(this, _OasObject_fields, "f").required.push(name);
72
+ }
73
+ }
74
+ removeProperty(name) {
75
+ __classPrivateFieldGet(this, _OasObject_fields, "f").required = __classPrivateFieldGet(this, _OasObject_fields, "f").required?.filter(n => n !== name);
76
+ if (__classPrivateFieldGet(this, _OasObject_fields, "f").properties?.[name] !== undefined) {
77
+ delete __classPrivateFieldGet(this, _OasObject_fields, "f").properties[name];
78
+ }
79
+ }
62
80
  isRef() {
63
81
  return false;
64
82
  }
@@ -1,23 +1,20 @@
1
1
  import type { CoreContext } from '../context/CoreContext.js';
2
- import type { ContentSettings } from '../dsl/ContentSettings.js';
3
2
  import { Definition } from '../dsl/Definition.js';
4
- import type { OasObject } from '../oas/object/Object.js';
5
- import type { TypeSystemArgs, TypeSystemValue } from '../types/TypeSystem.js';
3
+ import type { TypeSystemValue } from '../types/TypeSystem.js';
6
4
  import { FunctionParameter } from './FunctionParameter.js';
7
5
  type ConstructorArgs = {
8
6
  context: CoreContext;
9
- name?: string;
10
- objectSchema: OasObject;
11
- settings: ContentSettings;
7
+ argName?: string;
8
+ typeName: string;
9
+ typeValue: TypeSystemValue;
12
10
  pathTemplate: string;
13
- toValue: (args: TypeSystemArgs) => TypeSystemValue;
14
11
  };
15
12
  export declare class PathParams {
16
13
  context: CoreContext;
17
14
  typeDefinition: Definition<TypeSystemValue>;
18
15
  parameter: FunctionParameter;
19
16
  path: string;
20
- constructor({ context, name, objectSchema, settings, pathTemplate, toValue }: ConstructorArgs);
17
+ constructor({ context, argName, typeName, typeValue, pathTemplate }: ConstructorArgs);
21
18
  }
22
19
  export {};
23
20
  //# sourceMappingURL=PathParams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PathParams.d.ts","sourceRoot":"","sources":["../../src/typescript/PathParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE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,qBAAa,UAAU;IACrB,OAAO,EAAE,WAAW,CAAA;IACpB,cAAc,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAC3C,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;gBAEA,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACb,EAAE,eAAe;CAwBnB"}
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PathParams = void 0;
4
4
  const Definition_js_1 = require("../dsl/Definition.js");
5
5
  const Identifier_js_1 = require("../dsl/Identifier.js");
6
- const strings_js_1 = require("../helpers/strings.js");
7
6
  const FunctionParameter_js_1 = require("./FunctionParameter.js");
8
7
  const toPathTemplate_js_1 = require("./toPathTemplate.js");
9
8
  class PathParams {
10
- constructor({ context, name, objectSchema, settings, pathTemplate, toValue }) {
9
+ constructor({ context, argName, typeName, typeValue, pathTemplate }) {
11
10
  Object.defineProperty(this, "context", {
12
11
  enumerable: true,
13
12
  configurable: true,
@@ -35,18 +34,13 @@ class PathParams {
35
34
  this.context = context;
36
35
  this.typeDefinition = new Definition_js_1.Definition({
37
36
  context,
38
- identifier: Identifier_js_1.Identifier.createType((0, strings_js_1.capitalize)(`${settings.name}Params`)),
39
- value: toValue({
40
- context,
41
- schema: objectSchema,
42
- destinationPath: settings.exportPath,
43
- required: true
44
- })
37
+ identifier: Identifier_js_1.Identifier.createType(typeName),
38
+ value: typeValue
45
39
  });
46
40
  this.parameter = new FunctionParameter_js_1.FunctionParameter({
47
- name,
41
+ name: argName,
48
42
  typeDefinition: this.typeDefinition,
49
- destructure: !name,
43
+ destructure: !argName,
50
44
  required: true
51
45
  });
52
46
  const queryArg = this.parameter.properties.type === 'regular'