@nestia/sdk 12.0.0-dev.20260520.1 → 12.0.0-dev.20260521.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ORGANIZATION/PROJECT-api",
3
- "version": "12.0.0-dev.20260520.1",
3
+ "version": "12.0.0-dev.20260521.1",
4
4
  "description": "SDK library generated by Nestia",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -1,2 +1,12 @@
1
1
  import { IOperationMetadata } from "../structures/IOperationMetadata";
2
- export declare function OperationMetadata(metadata: IOperationMetadata): MethodDecorator;
2
+ /**
3
+ * Carries the compile-time operation metadata the SDK / Swagger / e2e
4
+ * generators read through `Reflect.getMetadata("nestia/OperationMetadata")`.
5
+ *
6
+ * The `@nestia/sdk` native transform injects this decorator as a synthesized
7
+ * AST node, so its argument is a single JSON string literal rather than an
8
+ * object literal — keeping the constructed node tree minimal. The string is
9
+ * parsed once here at module-evaluation time. A pre-parsed `IOperationMetadata`
10
+ * object is still accepted for hand-written or test usage.
11
+ */
12
+ export declare function OperationMetadata(metadata: IOperationMetadata | string): MethodDecorator;
@@ -1,9 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OperationMetadata = OperationMetadata;
4
+ /**
5
+ * Carries the compile-time operation metadata the SDK / Swagger / e2e
6
+ * generators read through `Reflect.getMetadata("nestia/OperationMetadata")`.
7
+ *
8
+ * The `@nestia/sdk` native transform injects this decorator as a synthesized
9
+ * AST node, so its argument is a single JSON string literal rather than an
10
+ * object literal — keeping the constructed node tree minimal. The string is
11
+ * parsed once here at module-evaluation time. A pre-parsed `IOperationMetadata`
12
+ * object is still accepted for hand-written or test usage.
13
+ */
4
14
  function OperationMetadata(metadata) {
15
+ const parsed = typeof metadata === "string"
16
+ ? JSON.parse(metadata)
17
+ : metadata;
5
18
  return function OperationMetadata(target, propertyKey, descriptor) {
6
- Reflect.defineMetadata("nestia/OperationMetadata", metadata, target, propertyKey);
19
+ Reflect.defineMetadata("nestia/OperationMetadata", parsed, target, propertyKey);
7
20
  return descriptor;
8
21
  };
9
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"OperationMetadata.js","sourceRoot":"","sources":["../../src/decorators/OperationMetadata.ts"],"names":[],"mappings":";;;AAEA,2BACE,QAA4B;IAE5B,OAAO,SAAS,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU;QAC/D,OAAO,CAAC,cAAc,CACpB,0BAA0B,EAC1B,QAAQ,EACR,MAAM,EACN,WAAW,CACZ,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"OperationMetadata.js","sourceRoot":"","sources":["../../src/decorators/OperationMetadata.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;GASG;AACH,2BACE,QAAqC;IAErC,MAAM,MAAM,GACV,OAAO,QAAQ,KAAK,QAAQ;QAC1B,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAwB;QAC9C,CAAC,CAAC,QAAQ,CAAC;IACf,OAAO,SAAS,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU;QAC/D,OAAO,CAAC,cAAc,CACpB,0BAA0B,EAC1B,MAAM,EACN,MAAM,EACN,WAAW,CACZ,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,9 +1,16 @@
1
- interface ITtscPluginFactoryContext {
2
- projectRoot: string;
3
- }
4
1
  interface ITtscPlugin {
5
2
  name: string;
6
3
  source: string;
7
4
  }
8
- export declare function createTtscPlugin(context: ITtscPluginFactoryContext): ITtscPlugin;
5
+ /**
6
+ * `@nestia/sdk` ttsc plugin descriptor.
7
+ *
8
+ * Points ttsc at this package's own Go source (`native/sdk`, package `sdk`).
9
+ * Because that package is not `package main`, ttsc classifies it as a linked
10
+ * transform and statically links it into the `@nestia/core` host binary as a
11
+ * contributor — but only for projects that actually depend on `@nestia/sdk`.
12
+ * A project depending on `@nestia/core` alone never links, compiles, or ships
13
+ * any of this SDK transform code.
14
+ */
15
+ export declare function createTtscPlugin(): ITtscPlugin;
9
16
  export default createTtscPlugin;
package/lib/transform.js CHANGED
@@ -8,26 +8,26 @@ const node_path_1 = __importDefault(require("node:path"));
8
8
  const node_url_1 = require("node:url");
9
9
  const filename = currentFilename();
10
10
  const dirname = node_path_1.default.dirname(filename);
11
- function createTtscPlugin(context) {
12
- var _a;
13
- const root = (_a = resolvePackageRoot("@nestia/core/package.json", context.projectRoot)) !== null && _a !== void 0 ? _a : inferCorePackageRoot();
11
+ /**
12
+ * `@nestia/sdk` ttsc plugin descriptor.
13
+ *
14
+ * Points ttsc at this package's own Go source (`native/sdk`, package `sdk`).
15
+ * Because that package is not `package main`, ttsc classifies it as a linked
16
+ * transform and statically links it into the `@nestia/core` host binary as a
17
+ * contributor — but only for projects that actually depend on `@nestia/sdk`.
18
+ * A project depending on `@nestia/core` alone never links, compiles, or ships
19
+ * any of this SDK transform code.
20
+ */
21
+ function createTtscPlugin() {
22
+ // `<root>/lib/transform.js` (published) or `<root>/src/transform.ts` (dev)
23
+ // → `<root>` → the `native/sdk` linked-transform source package.
24
+ const root = node_path_1.default.resolve(dirname, "..");
14
25
  return {
15
26
  name: "@nestia/sdk",
16
- source: node_path_1.default.resolve(root, "native", "cmd", "ttsc-nestia"),
27
+ source: node_path_1.default.resolve(root, "native", "sdk"),
17
28
  };
18
29
  }
19
30
  exports.default = createTtscPlugin;
20
- function resolvePackageRoot(packageJson, projectRoot) {
21
- try {
22
- return node_path_1.default.dirname(require.resolve(packageJson, { paths: [projectRoot] }));
23
- }
24
- catch (_a) {
25
- return null;
26
- }
27
- }
28
- function inferCorePackageRoot() {
29
- return node_path_1.default.resolve(dirname, "..", "..", "core");
30
- }
31
31
  function currentFilename() {
32
32
  var _a;
33
33
  var _b, _c;
@@ -1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KAAK,SAAS;QACxB,UAAU,CAAC,MAAM,KAAK,CAAC;QAEvB,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAEvC,MAAM,IAAI,GAAuB,MAAA,IAAI,KAAK,EAAE,CAAC,KAAK,0CAC9C,KAAK,CAAC,IAAI,EACX,IAAI,CACH,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QACnC,KAAK,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QACnC,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CACvC,CAAC;IACJ,MAAM,OAAO,GAAwC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAC9D,4CAA4C,CAC7C,CAAC;IACF,MAAM,QAAQ,GAAW,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,OAAO,iBAAiB,aAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,mCAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,mCAAI,QAAQ,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,IAAA,wBAAa,EAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC;AACf,CAAC"}
package/native/go.mod ADDED
@@ -0,0 +1,52 @@
1
+ module github.com/samchon/nestia/packages/sdk/native
2
+
3
+ go 1.26
4
+
5
+ require (
6
+ github.com/microsoft/typescript-go/shim/ast v0.0.0
7
+ github.com/microsoft/typescript-go/shim/checker v0.0.0
8
+ github.com/microsoft/typescript-go/shim/scanner v0.0.0
9
+ github.com/samchon/nestia/packages/core/native v0.0.0
10
+ github.com/samchon/ttsc/packages/ttsc v0.0.0
11
+ github.com/samchon/typia/packages/typia/native v0.0.0-20260510181336-5a7ad21c4d6f
12
+ )
13
+
14
+ require (
15
+ github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 // indirect
16
+ github.com/klauspost/cpuid/v2 v2.2.10 // indirect
17
+ github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157 // indirect
18
+ github.com/microsoft/typescript-go/shim/bundled v0.0.0 // indirect
19
+ github.com/microsoft/typescript-go/shim/compiler v0.0.0 // indirect
20
+ github.com/microsoft/typescript-go/shim/core v0.0.0 // indirect
21
+ github.com/microsoft/typescript-go/shim/diagnosticwriter v0.0.0 // indirect
22
+ github.com/microsoft/typescript-go/shim/parser v0.0.0 // indirect
23
+ github.com/microsoft/typescript-go/shim/printer v0.0.0 // indirect
24
+ github.com/microsoft/typescript-go/shim/tsoptions v0.0.0 // indirect
25
+ github.com/microsoft/typescript-go/shim/tspath v0.0.0 // indirect
26
+ github.com/microsoft/typescript-go/shim/vfs v0.0.0 // indirect
27
+ github.com/microsoft/typescript-go/shim/vfs/cachedvfs v0.0.0 // indirect
28
+ github.com/microsoft/typescript-go/shim/vfs/osvfs v0.0.0 // indirect
29
+ github.com/zeebo/xxh3 v1.1.0 // indirect
30
+ golang.org/x/sync v0.20.0 // indirect
31
+ golang.org/x/sys v0.43.0 // indirect
32
+ golang.org/x/text v0.36.0 // indirect
33
+ )
34
+
35
+ replace (
36
+ github.com/microsoft/typescript-go/shim/ast => github.com/samchon/ttsc/packages/ttsc/shim/ast v0.0.0-20260519112110-ec1cdf69c509
37
+ github.com/microsoft/typescript-go/shim/bundled => github.com/samchon/ttsc/packages/ttsc/shim/bundled v0.0.0-20260519112110-ec1cdf69c509
38
+ github.com/microsoft/typescript-go/shim/checker => github.com/samchon/ttsc/packages/ttsc/shim/checker v0.0.0-20260519112110-ec1cdf69c509
39
+ github.com/microsoft/typescript-go/shim/compiler => github.com/samchon/ttsc/packages/ttsc/shim/compiler v0.0.0-20260519112110-ec1cdf69c509
40
+ github.com/microsoft/typescript-go/shim/core => github.com/samchon/ttsc/packages/ttsc/shim/core v0.0.0-20260519112110-ec1cdf69c509
41
+ github.com/microsoft/typescript-go/shim/diagnosticwriter => github.com/samchon/ttsc/packages/ttsc/shim/diagnosticwriter v0.0.0-20260519112110-ec1cdf69c509
42
+ github.com/microsoft/typescript-go/shim/parser => github.com/samchon/ttsc/packages/ttsc/shim/parser v0.0.0-20260519112110-ec1cdf69c509
43
+ github.com/microsoft/typescript-go/shim/printer => github.com/samchon/ttsc/packages/ttsc/shim/printer v0.0.0-20260519112110-ec1cdf69c509
44
+ github.com/microsoft/typescript-go/shim/scanner => github.com/samchon/ttsc/packages/ttsc/shim/scanner v0.0.0-20260519112110-ec1cdf69c509
45
+ github.com/microsoft/typescript-go/shim/tsoptions => github.com/samchon/ttsc/packages/ttsc/shim/tsoptions v0.0.0-20260519112110-ec1cdf69c509
46
+ github.com/microsoft/typescript-go/shim/tspath => github.com/samchon/ttsc/packages/ttsc/shim/tspath v0.0.0-20260519112110-ec1cdf69c509
47
+ github.com/microsoft/typescript-go/shim/vfs => github.com/samchon/ttsc/packages/ttsc/shim/vfs v0.0.0-20260519112110-ec1cdf69c509
48
+ github.com/microsoft/typescript-go/shim/vfs/cachedvfs => github.com/samchon/ttsc/packages/ttsc/shim/vfs/cachedvfs v0.0.0-20260519112110-ec1cdf69c509
49
+ github.com/microsoft/typescript-go/shim/vfs/osvfs => github.com/samchon/ttsc/packages/ttsc/shim/vfs/osvfs v0.0.0-20260519112110-ec1cdf69c509
50
+ github.com/samchon/nestia/packages/core/native => ../../core/native
51
+ github.com/samchon/ttsc/packages/ttsc v0.0.0 => github.com/samchon/ttsc/packages/ttsc v0.0.0-20260519112110-ec1cdf69c509
52
+ )
package/native/go.sum ADDED
@@ -0,0 +1,54 @@
1
+ github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 h1:vymEbVwYFP/L05h5TKQxvkXoKxNvTpjxYKdF1Nlwuao=
2
+ github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
3
+ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
4
+ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
5
+ github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
6
+ github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
7
+ github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157 h1:llOMPhKDiQ+UEJiAaQuuWaJOTg5V7tNNTEf9JPWoYSY=
8
+ github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157/go.mod h1:m8YA0PMC7ti0GW0RI05D6fEcjQeu98XVS+FWF+VDW2k=
9
+ github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
10
+ github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
11
+ github.com/samchon/ttsc/packages/ttsc v0.0.0-20260519112110-ec1cdf69c509 h1:9XOcQrnIVJ9ZSS2COtZhVgRyMgNojuWV1x/775QXdYk=
12
+ github.com/samchon/ttsc/packages/ttsc v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:V3pedIezHwCYObKxD174holEgc0yyMcGx+4eCI+dgRw=
13
+ github.com/samchon/ttsc/packages/ttsc/shim/ast v0.0.0-20260519112110-ec1cdf69c509 h1:dPku/IntYFpiKuKpsM78WwwxyIdl1QeCRm5hYah7998=
14
+ github.com/samchon/ttsc/packages/ttsc/shim/ast v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:BCVAEArtMC+X1laJmDwxlsRROIQIYvHeT7Dl0gNjT0A=
15
+ github.com/samchon/ttsc/packages/ttsc/shim/bundled v0.0.0-20260519112110-ec1cdf69c509 h1:xo5hPei0KG1R0duQhs3R8ty3NeB/+uNKo8PfcRej/bI=
16
+ github.com/samchon/ttsc/packages/ttsc/shim/bundled v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:0tz+Y8szXmEpXWHWVrLrv11ga1z6tQJQErkUyIWJ9RQ=
17
+ github.com/samchon/ttsc/packages/ttsc/shim/checker v0.0.0-20260519112110-ec1cdf69c509 h1:NsY7Sx27yCLEiHAMQW/FZ9K08AeyfqCFfARbv3YW58Y=
18
+ github.com/samchon/ttsc/packages/ttsc/shim/checker v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:4xfafgG/qosSp8f0tCf83assFoUKRdGHhvPD1EI9LKg=
19
+ github.com/samchon/ttsc/packages/ttsc/shim/compiler v0.0.0-20260519112110-ec1cdf69c509 h1:P0842cLEeKSbUEcr02bojbFeejJNymsoybBvSQImpGc=
20
+ github.com/samchon/ttsc/packages/ttsc/shim/compiler v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:e9awlg1eXjc1Hzx9waw6UEV/2qYJbgo8zFPwQ0mpzig=
21
+ github.com/samchon/ttsc/packages/ttsc/shim/core v0.0.0-20260519112110-ec1cdf69c509 h1:CVP3DmC77r5Dei7YziDmwlb7h+h4Z7tUAi3sdHY3PQ0=
22
+ github.com/samchon/ttsc/packages/ttsc/shim/core v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:DUewcVNEdXyDveQholE4GAsiqqA3C2+SJYqia3nCf00=
23
+ github.com/samchon/ttsc/packages/ttsc/shim/diagnosticwriter v0.0.0-20260519112110-ec1cdf69c509 h1:pSweRJg4DabeOefKJks+adGJ6lvDfCS0GtaKEzUdOl8=
24
+ github.com/samchon/ttsc/packages/ttsc/shim/diagnosticwriter v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:v86GtrD7qALo6Xkgz1MDomPMSV2D9NdniQWB5t8eY6k=
25
+ github.com/samchon/ttsc/packages/ttsc/shim/parser v0.0.0-20260519112110-ec1cdf69c509 h1:+rhP0a1sNPduYsK1EbL88XFvfAEH3xwNPz04Bz50QGk=
26
+ github.com/samchon/ttsc/packages/ttsc/shim/parser v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:inUjC/bNlCkO0zIzHZRXlHR/WgLcK0vi2KLc7tpQ1ek=
27
+ github.com/samchon/ttsc/packages/ttsc/shim/printer v0.0.0-20260519112110-ec1cdf69c509 h1:jIEZj4iuDiSFGYQIcBfPTOEOKsw1OiFt1Mii4sDpwu0=
28
+ github.com/samchon/ttsc/packages/ttsc/shim/printer v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:ESjhY+UiPRspef4JcXcUPNgt4ySQQrlVIUCLKaKeyEQ=
29
+ github.com/samchon/ttsc/packages/ttsc/shim/scanner v0.0.0-20260519112110-ec1cdf69c509 h1:ojNRfmIQ6iRGixkd0UN5b9X4BIji7B2tvaC+U9DzezE=
30
+ github.com/samchon/ttsc/packages/ttsc/shim/scanner v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:abIC7C28cUA5IQKmLJulsl2qOvmimhkMNOfjJhRm5jM=
31
+ github.com/samchon/ttsc/packages/ttsc/shim/tsoptions v0.0.0-20260519112110-ec1cdf69c509 h1:A82Zh/CGlOrit4/tmWqiibutfI/ymj2q2U29rShOkLU=
32
+ github.com/samchon/ttsc/packages/ttsc/shim/tsoptions v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:EQwrCr3nY0U1SZBNyp6cQSogAiXsjFxTuT8NlMit1lc=
33
+ github.com/samchon/ttsc/packages/ttsc/shim/tspath v0.0.0-20260519112110-ec1cdf69c509 h1:0GpravTbiWFkotq0V5mCYf719slkFEiqdOJ//00NuGI=
34
+ github.com/samchon/ttsc/packages/ttsc/shim/tspath v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:hsE2c1bZquSNlDLIkT3SfLH3MrDmMk1BLzWI/KomT1A=
35
+ github.com/samchon/ttsc/packages/ttsc/shim/vfs v0.0.0-20260519112110-ec1cdf69c509 h1:H7ZPgQ8g8uAQrrzKnnYrpxNgUFV245r5ZiLcT5BCxRc=
36
+ github.com/samchon/ttsc/packages/ttsc/shim/vfs v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:HoQcoC0FEG3iMI6zvjg8r6j/ves+RVH6SRn48VSi5H0=
37
+ github.com/samchon/ttsc/packages/ttsc/shim/vfs/cachedvfs v0.0.0-20260519112110-ec1cdf69c509 h1:LpTjuXHHUWskujIXRrbYsuxVWTXHxGG732EheCOVBZ0=
38
+ github.com/samchon/ttsc/packages/ttsc/shim/vfs/cachedvfs v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:XS3LhXkn5xadyRe3tW+9+suW/7gh7dPdL43Q+s/lUDo=
39
+ github.com/samchon/ttsc/packages/ttsc/shim/vfs/osvfs v0.0.0-20260519112110-ec1cdf69c509 h1:ESHedCnmU7U9bhHD3o5DxWgE5QCOye4FW/TDw6MhXw8=
40
+ github.com/samchon/ttsc/packages/ttsc/shim/vfs/osvfs v0.0.0-20260519112110-ec1cdf69c509/go.mod h1:otX+qw8aZLNCoBmCwMAn53Nw0RQTPzSoId3DxmE67So=
41
+ github.com/samchon/typia/packages/typia/native v0.0.0-20260510181336-5a7ad21c4d6f h1:0y1cQPDK53apdqBmhaoYY1ceQ6JDAgmKwTdb/V9Rf9E=
42
+ github.com/samchon/typia/packages/typia/native v0.0.0-20260510181336-5a7ad21c4d6f/go.mod h1:SJDrfiCEK5dtObhJeAl0iqelqmmFm/JIjfJ6z0kID60=
43
+ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
44
+ github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
45
+ github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
46
+ github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
47
+ golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
48
+ golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
49
+ golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
50
+ golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
51
+ golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
52
+ golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
53
+ gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
54
+ gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
@@ -0,0 +1,130 @@
1
+ package sdk
2
+
3
+ import (
4
+ "fmt"
5
+ "strings"
6
+
7
+ shimast "github.com/microsoft/typescript-go/shim/ast"
8
+ "github.com/samchon/ttsc/packages/ttsc/driver"
9
+ )
10
+
11
+ // sdkMetadataNamespace is the import alias the injected decorator references.
12
+ const sdkMetadataNamespace = "__OperationMetadata"
13
+
14
+ // init registers the SDK metadata transform with the ttsc driver.
15
+ //
16
+ // ttsc classifies this package (name != "main") as a linked transform and
17
+ // statically links it into the `@nestia/core` host binary — but only for
18
+ // projects that depend on `@nestia/sdk`. A project depending on `@nestia/core`
19
+ // alone never links, compiles, or ships any of this code. When linked, this
20
+ // `init()` runs before the host's `main`; the driver then invokes
21
+ // `ApplyProgram` once per build, after the host's own typia + core passes.
22
+ func init() {
23
+ driver.RegisterPlugin(linkedPlugin{})
24
+ }
25
+
26
+ type linkedPlugin struct{}
27
+
28
+ // ApplyProgram injects the `@OperationMetadata("<json>")` decorator that the
29
+ // SDK / Swagger / e2e generators read at runtime, plus the namespace import it
30
+ // references.
31
+ //
32
+ // Insertion is done with synthesized AST nodes (NodeFlagsSynthesized): ttsc's
33
+ // emit prints those structurally, without slicing the original source text, so
34
+ // no source-text rewrite is needed. The metadata is carried as a single JSON
35
+ // string literal — the `OperationMetadata` decorator `JSON.parse`s it — which
36
+ // keeps the constructed AST to one literal node instead of a deep object tree.
37
+ func (linkedPlugin) ApplyProgram(prog *driver.Program, _ driver.PluginContext) error {
38
+ sites, diags := collectNestiaSDKSites(prog)
39
+ if len(diags) > 0 {
40
+ messages := make([]string, 0, len(diags))
41
+ for _, diag := range diags {
42
+ messages = append(messages, diag.String(""))
43
+ }
44
+ return fmt.Errorf("%s", strings.Join(messages, "\n"))
45
+ }
46
+ if len(sites) == 0 {
47
+ return nil
48
+ }
49
+ factory := shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
50
+ touched := map[*shimast.SourceFile]bool{}
51
+ for _, site := range sites {
52
+ if site.Method == nil || site.File == nil {
53
+ continue
54
+ }
55
+ injectOperationMetadataDecorator(factory, site.Method, site.Metadata)
56
+ touched[site.File] = true
57
+ }
58
+ for file := range touched {
59
+ injectOperationMetadataImport(factory, file)
60
+ }
61
+ return nil
62
+ }
63
+
64
+ func synthesized(node *shimast.Node) *shimast.Node {
65
+ if node != nil {
66
+ node.Flags |= shimast.NodeFlagsSynthesized
67
+ }
68
+ return node
69
+ }
70
+
71
+ // injectOperationMetadataDecorator prepends a synthesized
72
+ // `@__OperationMetadata.OperationMetadata("<json>")` decorator to a controller
73
+ // method. Every site is a method that already carries `@nestia/core`
74
+ // decorators, so its modifier list is non-nil and can be mutated in place.
75
+ func injectOperationMetadataDecorator(
76
+ factory *shimast.NodeFactory,
77
+ method *shimast.Node,
78
+ metadataJSON string,
79
+ ) {
80
+ modifiers := method.Modifiers()
81
+ if modifiers == nil {
82
+ return
83
+ }
84
+ namespaceID := synthesized(factory.NewIdentifier(sdkMetadataNamespace))
85
+ memberID := synthesized(factory.NewIdentifier("OperationMetadata"))
86
+ access := synthesized(factory.NewPropertyAccessExpression(
87
+ namespaceID,
88
+ nil,
89
+ memberID,
90
+ shimast.NodeFlagsNone,
91
+ ))
92
+ namespaceID.Parent = access
93
+ memberID.Parent = access
94
+ argument := synthesized(factory.NewStringLiteral(metadataJSON, shimast.TokenFlagsNone))
95
+ call := synthesized(factory.NewCallExpression(
96
+ access,
97
+ nil,
98
+ nil,
99
+ factory.NewNodeList([]*shimast.Node{argument}),
100
+ shimast.NodeFlagsNone,
101
+ ))
102
+ access.Parent = call
103
+ argument.Parent = call
104
+ decorator := synthesized(factory.NewDecorator(call))
105
+ call.Parent = decorator
106
+ decorator.Parent = method
107
+ modifiers.Nodes = append([]*shimast.Node{decorator}, modifiers.Nodes...)
108
+ }
109
+
110
+ // injectOperationMetadataImport prepends a synthesized
111
+ // `import * as __OperationMetadata from "@nestia/sdk"` to a touched file.
112
+ func injectOperationMetadataImport(
113
+ factory *shimast.NodeFactory,
114
+ file *shimast.SourceFile,
115
+ ) {
116
+ if file == nil || file.Statements == nil {
117
+ return
118
+ }
119
+ namespaceID := synthesized(factory.NewIdentifier(sdkMetadataNamespace))
120
+ namespace := synthesized(factory.NewNamespaceImport(namespaceID))
121
+ namespaceID.Parent = namespace
122
+ clause := synthesized(factory.NewImportClause(shimast.KindUnknown, nil, namespace))
123
+ namespace.Parent = clause
124
+ specifier := synthesized(factory.NewStringLiteral("@nestia/sdk", shimast.TokenFlagsNone))
125
+ declaration := synthesized(factory.NewImportDeclaration(nil, clause, specifier, nil))
126
+ clause.Parent = declaration
127
+ specifier.Parent = declaration
128
+ declaration.Parent = file.AsNode()
129
+ file.Statements.Nodes = append([]*shimast.Node{declaration}, file.Statements.Nodes...)
130
+ }
@@ -0,0 +1,17 @@
1
+ // Package sdk implements the `@nestia/sdk` ttsc transform plugin: it injects
2
+ // the `@OperationMetadata({...})` decorator the SDK / Swagger / e2e generators
3
+ // read at runtime. It is a separate plugin from `@nestia/core` so that a
4
+ // project depending only on `@nestia/core` never compiles this code — see
5
+ // `packages/core/native/transform` for the shared transform infrastructure
6
+ // this package imports.
7
+ package sdk
8
+
9
+ import (
10
+ "io"
11
+ "os"
12
+ )
13
+
14
+ var (
15
+ stdout io.Writer = os.Stdout
16
+ stderr io.Writer = os.Stderr
17
+ )