openxiangda-nest 2.0.0-alpha.39 → 2.0.0-alpha.40

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
@@ -4,6 +4,21 @@ NestJS integration for platform-gateway requests. The global transport guard ver
4
4
 
5
5
  Ordinary CRUD remains in the platform Data API. Use NestJS only for real business actions, and keep the platform as the authoritative identity and authorization owner.
6
6
 
7
+ Start application backends with the canonical bootstrap so gateway signatures
8
+ are verified against the exact incoming request bytes:
9
+
10
+ ```ts
11
+ import 'reflect-metadata';
12
+ import { bootstrapOpenXiangdaApplication } from 'openxiangda-nest';
13
+ import { AppModule } from './app.module.js';
14
+
15
+ await bootstrapOpenXiangdaApplication(AppModule);
16
+ ```
17
+
18
+ Do not create a separate `NestFactory` or `FastifyAdapter` in application code.
19
+ The standard bootstrap owns raw-body capture, proxy trust, shutdown hooks, and
20
+ the runtime listen contract.
21
+
7
22
  `OpenXiangdaStandardOperations` provides the default transaction patterns for
8
23
  meeting interval overlap, course capacity/duplicate selection, and visitor
9
24
  duplicate reservation checks. Each pattern queries through the verified request
@@ -0,0 +1,15 @@
1
+ import type { Type } from '@nestjs/common';
2
+ import { type NestFastifyApplication } from '@nestjs/platform-fastify';
3
+ export interface OpenXiangdaApplicationBootstrapOptions {
4
+ port?: number;
5
+ host?: string;
6
+ trustProxy?: boolean;
7
+ }
8
+ /**
9
+ * Starts the canonical OpenXiangda 2.0 NestJS runtime.
10
+ *
11
+ * Raw body capture is part of the gateway assertion contract, so applications
12
+ * must not reproduce the NestFactory/Fastify setup themselves.
13
+ */
14
+ export declare function bootstrapOpenXiangdaApplication(rootModule: Type<unknown>, options?: OpenXiangdaApplicationBootstrapOptions): Promise<NestFastifyApplication>;
15
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,sCAAsC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,EACzB,OAAO,GAAE,sCAA2C,GACnD,OAAO,CAAC,sBAAsB,CAAC,CAcjC"}
@@ -0,0 +1,19 @@
1
+ import { NestFactory } from '@nestjs/core';
2
+ import { FastifyAdapter, } from '@nestjs/platform-fastify';
3
+ /**
4
+ * Starts the canonical OpenXiangda 2.0 NestJS runtime.
5
+ *
6
+ * Raw body capture is part of the gateway assertion contract, so applications
7
+ * must not reproduce the NestFactory/Fastify setup themselves.
8
+ */
9
+ export async function bootstrapOpenXiangdaApplication(rootModule, options = {}) {
10
+ const app = await NestFactory.create(rootModule, new FastifyAdapter({ trustProxy: options.trustProxy ?? true }), { rawBody: true });
11
+ app.enableShutdownHooks();
12
+ const production = process.env.NODE_ENV === 'production';
13
+ const port = options.port ??
14
+ Number(process.env.OPENXIANGDA_APP_PORT || process.env.PORT || 3000);
15
+ const host = options.host ?? (production ? '0.0.0.0' : '127.0.0.1');
16
+ await app.listen(port, host);
17
+ return app;
18
+ }
19
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAQlC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,UAAyB,EACzB,UAAkD,EAAE;IAEpD,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,MAAM,CAClC,UAAU,EACV,IAAI,cAAc,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC,EAC9D,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;IACF,GAAG,CAAC,mBAAmB,EAAE,CAAC;IAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;IACzD,MAAM,IAAI,GACR,OAAO,CAAC,IAAI;QACZ,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './authz.js';
2
+ export * from './bootstrap.js';
2
3
  export * from './assignee-provider.js';
3
4
  export * from './application-credentials.js';
4
5
  export * from './data-api.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './authz.js';
2
+ export * from './bootstrap.js';
2
3
  export * from './assignee-provider.js';
3
4
  export * from './application-credentials.js';
4
5
  export * from './data-api.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda-nest",
3
- "version": "2.0.0-alpha.39",
3
+ "version": "2.0.0-alpha.40",
4
4
  "description": "Official NestJS application backend SDK for OpenXiangda 2.0.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,12 +22,14 @@
22
22
  "peerDependencies": {
23
23
  "@nestjs/common": ">=11 <12",
24
24
  "@nestjs/core": ">=11 <12",
25
+ "@nestjs/platform-fastify": ">=11 <12",
25
26
  "reflect-metadata": ">=0.2 <1",
26
27
  "rxjs": ">=7 <8"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@nestjs/common": "11.1.29",
30
31
  "@nestjs/core": "11.1.29",
32
+ "@nestjs/platform-fastify": "11.1.29",
31
33
  "reflect-metadata": "0.2.2",
32
34
  "rxjs": "7.8.2"
33
35
  },