@lark-apaas/fullstack-nestjs-core 1.1.34-alpha.66 → 1.1.34-alpha.68
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/dist/index.cjs +96 -233
- package/dist/index.d.cts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +58 -194
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -34423,13 +34423,12 @@ __export(index_exports, {
|
|
|
34423
34423
|
UserContextMiddleware: () => UserContextMiddleware,
|
|
34424
34424
|
ViewContextMiddleware: () => ViewContextMiddleware,
|
|
34425
34425
|
configureApp: () => configureApp,
|
|
34426
|
-
createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware
|
|
34427
|
-
registerOpenApiSpecEndpoint: () => registerOpenApiSpecEndpoint
|
|
34426
|
+
createLegacyPathRedirectMiddleware: () => createLegacyPathRedirectMiddleware
|
|
34428
34427
|
});
|
|
34429
34428
|
module.exports = __toCommonJS(index_exports);
|
|
34430
34429
|
|
|
34431
34430
|
// src/modules/platform/module.ts
|
|
34432
|
-
var
|
|
34431
|
+
var import_common16 = require("@nestjs/common");
|
|
34433
34432
|
var import_core2 = require("@nestjs/core");
|
|
34434
34433
|
var import_nestjs_common6 = require("@lark-apaas/nestjs-common");
|
|
34435
34434
|
var import_config2 = require("@nestjs/config");
|
|
@@ -34628,31 +34627,32 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34628
34627
|
constructor(client) {
|
|
34629
34628
|
this.client = client;
|
|
34630
34629
|
}
|
|
34631
|
-
async
|
|
34630
|
+
async getAppPublished(appId) {
|
|
34632
34631
|
if (!appId) {
|
|
34633
|
-
this.logger.warn(`appId is empty, skip get app
|
|
34632
|
+
this.logger.warn(`appId is empty, skip get app published`);
|
|
34634
34633
|
return null;
|
|
34635
34634
|
}
|
|
34636
34635
|
try {
|
|
34637
34636
|
const resp = await this.client.get(`/b/${appId}/get_published_v2`);
|
|
34638
34637
|
if (resp.status !== 200) {
|
|
34639
|
-
throw new Error(`Failed to get app
|
|
34638
|
+
throw new Error(`Failed to get app published, status: ${resp.status}`);
|
|
34640
34639
|
}
|
|
34641
34640
|
const data = await resp.json();
|
|
34642
34641
|
if (data.status_code !== "0") {
|
|
34643
|
-
throw new Error(`Failed to get app
|
|
34642
|
+
throw new Error(`Failed to get app published, status_code: ${data.status_code}`);
|
|
34644
34643
|
}
|
|
34645
|
-
return data.data
|
|
34644
|
+
return data.data ?? null;
|
|
34646
34645
|
} catch (err) {
|
|
34647
|
-
this.logger.error(err, "Failed to get app
|
|
34646
|
+
this.logger.error(err, "Failed to get app published");
|
|
34648
34647
|
return null;
|
|
34649
34648
|
}
|
|
34650
34649
|
}
|
|
34651
34650
|
async use(req, res, next) {
|
|
34652
34651
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
34653
34652
|
const csrfToken = req.csrfToken;
|
|
34654
|
-
const appInfo = await this.getAppInfo(appId);
|
|
34655
34653
|
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
34654
|
+
const appPublishedData = await this.getAppPublished(appId);
|
|
34655
|
+
const appInfo = appPublishedData?.app_info ?? null;
|
|
34656
34656
|
req.__platform_data__ = {
|
|
34657
34657
|
csrfToken: csrfToken ?? "",
|
|
34658
34658
|
userId: userId ?? "",
|
|
@@ -34663,7 +34663,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34663
34663
|
loginUrl: loginUrl ?? "",
|
|
34664
34664
|
userType: userType ?? "",
|
|
34665
34665
|
tenantId,
|
|
34666
|
-
environment
|
|
34666
|
+
environment,
|
|
34667
|
+
showBadge: appInfo?.show_badge !== false,
|
|
34668
|
+
appPublished: appPublishedData ?? null
|
|
34667
34669
|
};
|
|
34668
34670
|
res.locals = {
|
|
34669
34671
|
...res.locals ?? {},
|
|
@@ -34774,24 +34776,18 @@ function createApiNotFoundResponse(req) {
|
|
|
34774
34776
|
};
|
|
34775
34777
|
}
|
|
34776
34778
|
__name(createApiNotFoundResponse, "createApiNotFoundResponse");
|
|
34777
|
-
function
|
|
34779
|
+
function getApiPathPrefix() {
|
|
34778
34780
|
const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
|
|
34779
34781
|
if (!globalPrefix) {
|
|
34780
|
-
return
|
|
34781
|
-
"/api/",
|
|
34782
|
-
"/openapi/"
|
|
34783
|
-
];
|
|
34782
|
+
return "/api/";
|
|
34784
34783
|
}
|
|
34785
34784
|
const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
|
|
34786
|
-
return
|
|
34787
|
-
`${normalizedPrefix}/api/`,
|
|
34788
|
-
`${normalizedPrefix}/openapi/`
|
|
34789
|
-
];
|
|
34785
|
+
return `${normalizedPrefix}/api/`;
|
|
34790
34786
|
}
|
|
34791
|
-
__name(
|
|
34787
|
+
__name(getApiPathPrefix, "getApiPathPrefix");
|
|
34792
34788
|
function apiResponseInterceptor(req, res, next) {
|
|
34793
|
-
const
|
|
34794
|
-
if (!
|
|
34789
|
+
const apiPrefix = getApiPathPrefix();
|
|
34790
|
+
if (!req.baseUrl.startsWith(apiPrefix)) {
|
|
34795
34791
|
return next();
|
|
34796
34792
|
}
|
|
34797
34793
|
res.render = function() {
|
|
@@ -35021,141 +35017,17 @@ FrameworkDebugMiddleware = _ts_decorate7([
|
|
|
35021
35017
|
])
|
|
35022
35018
|
], FrameworkDebugMiddleware);
|
|
35023
35019
|
|
|
35024
|
-
// src/middlewares/openapi-spec/index.ts
|
|
35025
|
-
var import_swagger = require("@nestjs/swagger");
|
|
35026
|
-
var import_common8 = require("@nestjs/common");
|
|
35027
|
-
function _ts_decorate8(decorators, target, key, desc) {
|
|
35028
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35029
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35030
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35031
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35032
|
-
}
|
|
35033
|
-
__name(_ts_decorate8, "_ts_decorate");
|
|
35034
|
-
var _app = null;
|
|
35035
|
-
var _cachedSpec = null;
|
|
35036
|
-
function registerOpenApiSpecEndpoint(app) {
|
|
35037
|
-
const globalPrefix = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
35038
|
-
_app = app;
|
|
35039
|
-
console.log(`[OpenAPI] Registered GET ${globalPrefix}/api/__framework__/openapi-spec`);
|
|
35040
|
-
}
|
|
35041
|
-
__name(registerOpenApiSpecEndpoint, "registerOpenApiSpecEndpoint");
|
|
35042
|
-
var OpenApiSpecMiddleware = class {
|
|
35043
|
-
static {
|
|
35044
|
-
__name(this, "OpenApiSpecMiddleware");
|
|
35045
|
-
}
|
|
35046
|
-
use(_req, res, next) {
|
|
35047
|
-
if (!_app) {
|
|
35048
|
-
next();
|
|
35049
|
-
return;
|
|
35050
|
-
}
|
|
35051
|
-
try {
|
|
35052
|
-
if (!_cachedSpec) {
|
|
35053
|
-
const globalPrefix = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
35054
|
-
const config = new import_swagger.DocumentBuilder().setTitle("OpenAPI Spec").setVersion("1.0").build();
|
|
35055
|
-
const spec = import_swagger.SwaggerModule.createDocument(_app, config);
|
|
35056
|
-
_cachedSpec = buildFilteredSpec(spec, globalPrefix);
|
|
35057
|
-
}
|
|
35058
|
-
res.json(_cachedSpec);
|
|
35059
|
-
} catch (err) {
|
|
35060
|
-
console.error("[openapi-spec] Failed to generate spec:", err);
|
|
35061
|
-
res.json({
|
|
35062
|
-
openapi: "3.0.0",
|
|
35063
|
-
paths: {},
|
|
35064
|
-
components: {
|
|
35065
|
-
schemas: {}
|
|
35066
|
-
}
|
|
35067
|
-
});
|
|
35068
|
-
}
|
|
35069
|
-
}
|
|
35070
|
-
};
|
|
35071
|
-
OpenApiSpecMiddleware = _ts_decorate8([
|
|
35072
|
-
(0, import_common8.Injectable)()
|
|
35073
|
-
], OpenApiSpecMiddleware);
|
|
35074
|
-
function buildFilteredSpec(spec, globalPrefix) {
|
|
35075
|
-
const schemas = spec.components?.schemas ?? {};
|
|
35076
|
-
const paths = spec.paths ?? {};
|
|
35077
|
-
const filteredPaths = {};
|
|
35078
|
-
for (const [pathKey, methods] of Object.entries(paths)) {
|
|
35079
|
-
const cleanPath = stripPrefix(pathKey, globalPrefix);
|
|
35080
|
-
if (!cleanPath.startsWith("/openapi")) continue;
|
|
35081
|
-
filteredPaths[cleanPath] = {};
|
|
35082
|
-
for (const [method, operation] of Object.entries(methods)) {
|
|
35083
|
-
if ([
|
|
35084
|
-
"parameters",
|
|
35085
|
-
"summary",
|
|
35086
|
-
"description",
|
|
35087
|
-
"servers"
|
|
35088
|
-
].includes(method)) continue;
|
|
35089
|
-
filteredPaths[cleanPath][method] = resolveRefsDeep(structuredClone(operation), schemas);
|
|
35090
|
-
}
|
|
35091
|
-
}
|
|
35092
|
-
return {
|
|
35093
|
-
openapi: spec.openapi,
|
|
35094
|
-
paths: filteredPaths,
|
|
35095
|
-
components: {
|
|
35096
|
-
schemas: resolveAllSchemaRefs(structuredClone(schemas))
|
|
35097
|
-
}
|
|
35098
|
-
};
|
|
35099
|
-
}
|
|
35100
|
-
__name(buildFilteredSpec, "buildFilteredSpec");
|
|
35101
|
-
function stripPrefix(path2, prefix) {
|
|
35102
|
-
if (prefix && path2.startsWith(prefix)) {
|
|
35103
|
-
return path2.slice(prefix.length);
|
|
35104
|
-
}
|
|
35105
|
-
return path2;
|
|
35106
|
-
}
|
|
35107
|
-
__name(stripPrefix, "stripPrefix");
|
|
35108
|
-
var MAX_REF_DEPTH = 5;
|
|
35109
|
-
function resolveRefsDeep(obj, schemas, depth = 0) {
|
|
35110
|
-
if (depth > MAX_REF_DEPTH || obj === null || obj === void 0) return obj;
|
|
35111
|
-
if (typeof obj !== "object") return obj;
|
|
35112
|
-
if (Array.isArray(obj)) {
|
|
35113
|
-
return obj.map((item) => resolveRefsDeep(item, schemas, depth));
|
|
35114
|
-
}
|
|
35115
|
-
const record = obj;
|
|
35116
|
-
if (typeof record["$ref"] === "string") {
|
|
35117
|
-
const resolved = resolveRef(record["$ref"], schemas);
|
|
35118
|
-
if (resolved !== void 0) {
|
|
35119
|
-
return resolveRefsDeep(structuredClone(resolved), schemas, depth + 1);
|
|
35120
|
-
}
|
|
35121
|
-
return record;
|
|
35122
|
-
}
|
|
35123
|
-
const result = {};
|
|
35124
|
-
for (const [key, value] of Object.entries(record)) {
|
|
35125
|
-
result[key] = resolveRefsDeep(value, schemas, depth);
|
|
35126
|
-
}
|
|
35127
|
-
return result;
|
|
35128
|
-
}
|
|
35129
|
-
__name(resolveRefsDeep, "resolveRefsDeep");
|
|
35130
|
-
function resolveRef(ref, schemas) {
|
|
35131
|
-
const prefix = "#/components/schemas/";
|
|
35132
|
-
if (ref.startsWith(prefix)) {
|
|
35133
|
-
const name = ref.slice(prefix.length);
|
|
35134
|
-
return schemas[name];
|
|
35135
|
-
}
|
|
35136
|
-
return void 0;
|
|
35137
|
-
}
|
|
35138
|
-
__name(resolveRef, "resolveRef");
|
|
35139
|
-
function resolveAllSchemaRefs(schemas) {
|
|
35140
|
-
const result = {};
|
|
35141
|
-
for (const [name, schema] of Object.entries(schemas)) {
|
|
35142
|
-
result[name] = resolveRefsDeep(schema, schemas);
|
|
35143
|
-
}
|
|
35144
|
-
return result;
|
|
35145
|
-
}
|
|
35146
|
-
__name(resolveAllSchemaRefs, "resolveAllSchemaRefs");
|
|
35147
|
-
|
|
35148
35020
|
// src/services/platform-http-client.service.ts
|
|
35149
|
-
var
|
|
35021
|
+
var import_common8 = require("@nestjs/common");
|
|
35150
35022
|
var import_http_client = require("@lark-apaas/http-client");
|
|
35151
35023
|
var import_nestjs_common3 = require("@lark-apaas/nestjs-common");
|
|
35152
|
-
function
|
|
35024
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
35153
35025
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35154
35026
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35155
35027
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35156
35028
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35157
35029
|
}
|
|
35158
|
-
__name(
|
|
35030
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
35159
35031
|
function _ts_metadata5(k, v) {
|
|
35160
35032
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35161
35033
|
}
|
|
@@ -35194,7 +35066,7 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35194
35066
|
requestContext;
|
|
35195
35067
|
client;
|
|
35196
35068
|
protectedClient;
|
|
35197
|
-
logger = new
|
|
35069
|
+
logger = new import_common8.Logger(_PlatformHttpClientService.name);
|
|
35198
35070
|
constructor(requestContext) {
|
|
35199
35071
|
this.requestContext = requestContext;
|
|
35200
35072
|
const baseConfig = {
|
|
@@ -35350,8 +35222,8 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35350
35222
|
});
|
|
35351
35223
|
}
|
|
35352
35224
|
};
|
|
35353
|
-
PlatformHttpClientService =
|
|
35354
|
-
(0,
|
|
35225
|
+
PlatformHttpClientService = _ts_decorate8([
|
|
35226
|
+
(0, import_common8.Injectable)(),
|
|
35355
35227
|
_ts_metadata5("design:type", Function),
|
|
35356
35228
|
_ts_metadata5("design:paramtypes", [
|
|
35357
35229
|
typeof import_nestjs_common3.RequestContextService === "undefined" ? Object : import_nestjs_common3.RequestContextService
|
|
@@ -35362,16 +35234,16 @@ PlatformHttpClientService = _ts_decorate9([
|
|
|
35362
35234
|
var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
|
|
35363
35235
|
|
|
35364
35236
|
// src/services/file.service.ts
|
|
35365
|
-
var
|
|
35237
|
+
var import_common9 = require("@nestjs/common");
|
|
35366
35238
|
var import_nestjs_common4 = require("@lark-apaas/nestjs-common");
|
|
35367
35239
|
var import_file_service = require("@lark-apaas/file-service");
|
|
35368
|
-
function
|
|
35240
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
35369
35241
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35370
35242
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35371
35243
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35372
35244
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35373
35245
|
}
|
|
35374
|
-
__name(
|
|
35246
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
35375
35247
|
function _ts_metadata6(k, v) {
|
|
35376
35248
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35377
35249
|
}
|
|
@@ -35396,7 +35268,7 @@ var FileService = class {
|
|
|
35396
35268
|
this.httpClient = httpClient;
|
|
35397
35269
|
this.observable = observable;
|
|
35398
35270
|
this.fileServiceCore = new import_file_service.FileService(this.httpClient);
|
|
35399
|
-
this.nestLogger = new
|
|
35271
|
+
this.nestLogger = new import_common9.Logger("file");
|
|
35400
35272
|
}
|
|
35401
35273
|
/**
|
|
35402
35274
|
* 返回一个绑定了指定 bucket 的代理对象
|
|
@@ -35736,10 +35608,10 @@ var FileService = class {
|
|
|
35736
35608
|
}
|
|
35737
35609
|
}
|
|
35738
35610
|
};
|
|
35739
|
-
FileService =
|
|
35740
|
-
(0,
|
|
35741
|
-
_ts_param2(1, (0,
|
|
35742
|
-
_ts_param2(2, (0,
|
|
35611
|
+
FileService = _ts_decorate9([
|
|
35612
|
+
(0, import_common9.Injectable)(),
|
|
35613
|
+
_ts_param2(1, (0, import_common9.Inject)(import_nestjs_common4.PLATFORM_HTTP_CLIENT)),
|
|
35614
|
+
_ts_param2(2, (0, import_common9.Inject)(import_nestjs_common4.OBSERVABLE_SERVICE)),
|
|
35743
35615
|
_ts_metadata6("design:type", Function),
|
|
35744
35616
|
_ts_metadata6("design:paramtypes", [
|
|
35745
35617
|
typeof import_nestjs_common4.RequestContextService === "undefined" ? Object : import_nestjs_common4.RequestContextService,
|
|
@@ -35752,21 +35624,21 @@ FileService = _ts_decorate10([
|
|
|
35752
35624
|
var import_nestjs_authzpaas = require("@lark-apaas/nestjs-authzpaas");
|
|
35753
35625
|
|
|
35754
35626
|
// src/modules/static/static.module.ts
|
|
35755
|
-
var
|
|
35627
|
+
var import_common11 = require("@nestjs/common");
|
|
35756
35628
|
|
|
35757
35629
|
// src/modules/static/static.controller.ts
|
|
35758
|
-
var
|
|
35759
|
-
var
|
|
35630
|
+
var import_common10 = require("@nestjs/common");
|
|
35631
|
+
var import_swagger = require("@nestjs/swagger");
|
|
35760
35632
|
var fs = __toESM(require("fs"), 1);
|
|
35761
35633
|
var path = __toESM(require("path"), 1);
|
|
35762
35634
|
var crypto2 = __toESM(require("crypto"), 1);
|
|
35763
|
-
function
|
|
35635
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
35764
35636
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35765
35637
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35766
35638
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35767
35639
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35768
35640
|
}
|
|
35769
|
-
__name(
|
|
35641
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
35770
35642
|
function _ts_metadata7(k, v) {
|
|
35771
35643
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35772
35644
|
}
|
|
@@ -35834,7 +35706,7 @@ var StaticController = class _StaticController {
|
|
|
35834
35706
|
static {
|
|
35835
35707
|
__name(this, "StaticController");
|
|
35836
35708
|
}
|
|
35837
|
-
logger = new
|
|
35709
|
+
logger = new import_common10.Logger(_StaticController.name);
|
|
35838
35710
|
staticDir;
|
|
35839
35711
|
constructor() {
|
|
35840
35712
|
this.staticDir = path.resolve(process.cwd(), "shared/static");
|
|
@@ -35855,7 +35727,7 @@ var StaticController = class _StaticController {
|
|
|
35855
35727
|
try {
|
|
35856
35728
|
const relativePath = params["0"] || params["*"] || "";
|
|
35857
35729
|
if (!relativePath) {
|
|
35858
|
-
res.status(
|
|
35730
|
+
res.status(import_common10.HttpStatus.BAD_REQUEST).json({
|
|
35859
35731
|
error: "Bad Request",
|
|
35860
35732
|
message: "File path is required"
|
|
35861
35733
|
});
|
|
@@ -35865,14 +35737,14 @@ var StaticController = class _StaticController {
|
|
|
35865
35737
|
const normalizedPath = path.normalize(filePath);
|
|
35866
35738
|
if (!normalizedPath.startsWith(this.staticDir)) {
|
|
35867
35739
|
this.logger.warn(`Path traversal attempt detected: ${relativePath}`);
|
|
35868
|
-
res.status(
|
|
35740
|
+
res.status(import_common10.HttpStatus.FORBIDDEN).json({
|
|
35869
35741
|
error: "Forbidden",
|
|
35870
35742
|
message: "Access denied"
|
|
35871
35743
|
});
|
|
35872
35744
|
return;
|
|
35873
35745
|
}
|
|
35874
35746
|
if (!fs.existsSync(normalizedPath)) {
|
|
35875
|
-
res.status(
|
|
35747
|
+
res.status(import_common10.HttpStatus.NOT_FOUND).json({
|
|
35876
35748
|
error: "Not Found",
|
|
35877
35749
|
message: "File not found"
|
|
35878
35750
|
});
|
|
@@ -35880,7 +35752,7 @@ var StaticController = class _StaticController {
|
|
|
35880
35752
|
}
|
|
35881
35753
|
const stat = fs.statSync(normalizedPath);
|
|
35882
35754
|
if (stat.isDirectory()) {
|
|
35883
|
-
res.status(
|
|
35755
|
+
res.status(import_common10.HttpStatus.FORBIDDEN).json({
|
|
35884
35756
|
error: "Forbidden",
|
|
35885
35757
|
message: "Directory listing not allowed"
|
|
35886
35758
|
});
|
|
@@ -35890,7 +35762,7 @@ var StaticController = class _StaticController {
|
|
|
35890
35762
|
const etag = generateETag(stat);
|
|
35891
35763
|
const ifNoneMatch = req.headers["if-none-match"];
|
|
35892
35764
|
if (ifNoneMatch === etag) {
|
|
35893
|
-
res.status(
|
|
35765
|
+
res.status(import_common10.HttpStatus.NOT_MODIFIED).end();
|
|
35894
35766
|
return;
|
|
35895
35767
|
}
|
|
35896
35768
|
res.setHeader("Content-Type", mimeType);
|
|
@@ -35901,7 +35773,7 @@ var StaticController = class _StaticController {
|
|
|
35901
35773
|
stream.on("error", (error) => {
|
|
35902
35774
|
this.logger.error(`Error streaming file: ${relativePath}`, error);
|
|
35903
35775
|
if (!res.headersSent) {
|
|
35904
|
-
res.status(
|
|
35776
|
+
res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
35905
35777
|
error: "Internal Server Error",
|
|
35906
35778
|
message: "Failed to read file"
|
|
35907
35779
|
});
|
|
@@ -35911,7 +35783,7 @@ var StaticController = class _StaticController {
|
|
|
35911
35783
|
} catch (error) {
|
|
35912
35784
|
this.logger.error("Error serving static file", error);
|
|
35913
35785
|
if (!res.headersSent) {
|
|
35914
|
-
res.status(
|
|
35786
|
+
res.status(import_common10.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
35915
35787
|
error: "Internal Server Error",
|
|
35916
35788
|
message: "An unexpected error occurred"
|
|
35917
35789
|
});
|
|
@@ -35919,11 +35791,11 @@ var StaticController = class _StaticController {
|
|
|
35919
35791
|
}
|
|
35920
35792
|
}
|
|
35921
35793
|
};
|
|
35922
|
-
|
|
35923
|
-
(0,
|
|
35924
|
-
_ts_param3(0, (0,
|
|
35925
|
-
_ts_param3(1, (0,
|
|
35926
|
-
_ts_param3(2, (0,
|
|
35794
|
+
_ts_decorate10([
|
|
35795
|
+
(0, import_common10.Get)("*"),
|
|
35796
|
+
_ts_param3(0, (0, import_common10.Param)()),
|
|
35797
|
+
_ts_param3(1, (0, import_common10.Req)()),
|
|
35798
|
+
_ts_param3(2, (0, import_common10.Res)()),
|
|
35927
35799
|
_ts_metadata7("design:type", Function),
|
|
35928
35800
|
_ts_metadata7("design:paramtypes", [
|
|
35929
35801
|
typeof Record === "undefined" ? Object : Record,
|
|
@@ -35932,28 +35804,28 @@ _ts_decorate11([
|
|
|
35932
35804
|
]),
|
|
35933
35805
|
_ts_metadata7("design:returntype", void 0)
|
|
35934
35806
|
], StaticController.prototype, "serveFile", null);
|
|
35935
|
-
StaticController =
|
|
35936
|
-
(0,
|
|
35937
|
-
(0,
|
|
35807
|
+
StaticController = _ts_decorate10([
|
|
35808
|
+
(0, import_swagger.ApiExcludeController)(),
|
|
35809
|
+
(0, import_common10.Controller)("static"),
|
|
35938
35810
|
_ts_metadata7("design:type", Function),
|
|
35939
35811
|
_ts_metadata7("design:paramtypes", [])
|
|
35940
35812
|
], StaticController);
|
|
35941
35813
|
|
|
35942
35814
|
// src/modules/static/static.module.ts
|
|
35943
|
-
function
|
|
35815
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
35944
35816
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35945
35817
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35946
35818
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35947
35819
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35948
35820
|
}
|
|
35949
|
-
__name(
|
|
35821
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
35950
35822
|
var StaticModule = class {
|
|
35951
35823
|
static {
|
|
35952
35824
|
__name(this, "StaticModule");
|
|
35953
35825
|
}
|
|
35954
35826
|
};
|
|
35955
|
-
StaticModule =
|
|
35956
|
-
(0,
|
|
35827
|
+
StaticModule = _ts_decorate11([
|
|
35828
|
+
(0, import_common11.Module)({
|
|
35957
35829
|
controllers: [
|
|
35958
35830
|
StaticController
|
|
35959
35831
|
]
|
|
@@ -35961,14 +35833,14 @@ StaticModule = _ts_decorate12([
|
|
|
35961
35833
|
], StaticModule);
|
|
35962
35834
|
|
|
35963
35835
|
// src/modules/html-hot-update/html-hot-update.module.ts
|
|
35964
|
-
var
|
|
35836
|
+
var import_common14 = require("@nestjs/common");
|
|
35965
35837
|
|
|
35966
35838
|
// src/modules/html-hot-update/html-hot-update.controller.ts
|
|
35967
|
-
var
|
|
35968
|
-
var
|
|
35839
|
+
var import_common13 = require("@nestjs/common");
|
|
35840
|
+
var import_swagger2 = require("@nestjs/swagger");
|
|
35969
35841
|
|
|
35970
35842
|
// src/modules/html-hot-update/html-hot-update.service.ts
|
|
35971
|
-
var
|
|
35843
|
+
var import_common12 = require("@nestjs/common");
|
|
35972
35844
|
var import_node_fs = require("fs");
|
|
35973
35845
|
var import_node_fs2 = require("fs");
|
|
35974
35846
|
var import_node_crypto = require("crypto");
|
|
@@ -36001,13 +35873,13 @@ function setActiveHtmlVersion(version) {
|
|
|
36001
35873
|
__name(setActiveHtmlVersion, "setActiveHtmlVersion");
|
|
36002
35874
|
|
|
36003
35875
|
// src/modules/html-hot-update/html-hot-update.service.ts
|
|
36004
|
-
function
|
|
35876
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
36005
35877
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36006
35878
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36007
35879
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36008
35880
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36009
35881
|
}
|
|
36010
|
-
__name(
|
|
35882
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
36011
35883
|
function _ts_metadata8(k, v) {
|
|
36012
35884
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
36013
35885
|
}
|
|
@@ -36050,7 +35922,7 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36050
35922
|
__name(this, "HtmlHotUpdateService");
|
|
36051
35923
|
}
|
|
36052
35924
|
httpClient;
|
|
36053
|
-
logger = new
|
|
35925
|
+
logger = new import_common12.Logger(_HtmlHotUpdateService.name);
|
|
36054
35926
|
fileLock = new Mutex();
|
|
36055
35927
|
hotUpdateDir = getHotUpdateHtmlDir();
|
|
36056
35928
|
hotUpdateVersionsDir = getHotUpdateVersionsDir();
|
|
@@ -36252,9 +36124,9 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36252
36124
|
return "";
|
|
36253
36125
|
}
|
|
36254
36126
|
};
|
|
36255
|
-
HtmlHotUpdateService =
|
|
36256
|
-
(0,
|
|
36257
|
-
_ts_param4(0, (0,
|
|
36127
|
+
HtmlHotUpdateService = _ts_decorate12([
|
|
36128
|
+
(0, import_common12.Injectable)(),
|
|
36129
|
+
_ts_param4(0, (0, import_common12.Inject)(import_nestjs_common5.PLATFORM_HTTP_CLIENT)),
|
|
36258
36130
|
_ts_metadata8("design:type", Function),
|
|
36259
36131
|
_ts_metadata8("design:paramtypes", [
|
|
36260
36132
|
typeof PlatformHttpClient === "undefined" ? Object : PlatformHttpClient
|
|
@@ -36262,13 +36134,13 @@ HtmlHotUpdateService = _ts_decorate13([
|
|
|
36262
36134
|
], HtmlHotUpdateService);
|
|
36263
36135
|
|
|
36264
36136
|
// src/modules/html-hot-update/html-hot-update.controller.ts
|
|
36265
|
-
function
|
|
36137
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
36266
36138
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36267
36139
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36268
36140
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36269
36141
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36270
36142
|
}
|
|
36271
|
-
__name(
|
|
36143
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
36272
36144
|
function _ts_metadata9(k, v) {
|
|
36273
36145
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
36274
36146
|
}
|
|
@@ -36291,7 +36163,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36291
36163
|
__name(this, "HtmlHotUpdateController");
|
|
36292
36164
|
}
|
|
36293
36165
|
htmlHotUpdateService;
|
|
36294
|
-
logger = new
|
|
36166
|
+
logger = new import_common13.Logger(_HtmlHotUpdateController.name);
|
|
36295
36167
|
constructor(htmlHotUpdateService) {
|
|
36296
36168
|
this.htmlHotUpdateService = htmlHotUpdateService;
|
|
36297
36169
|
}
|
|
@@ -36333,19 +36205,19 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36333
36205
|
}
|
|
36334
36206
|
}
|
|
36335
36207
|
};
|
|
36336
|
-
|
|
36337
|
-
(0,
|
|
36338
|
-
(0,
|
|
36339
|
-
_ts_param5(0, (0,
|
|
36208
|
+
_ts_decorate13([
|
|
36209
|
+
(0, import_common13.Post)("update_html_files"),
|
|
36210
|
+
(0, import_common13.HttpCode)(import_common13.HttpStatus.OK),
|
|
36211
|
+
_ts_param5(0, (0, import_common13.Body)()),
|
|
36340
36212
|
_ts_metadata9("design:type", Function),
|
|
36341
36213
|
_ts_metadata9("design:paramtypes", [
|
|
36342
36214
|
typeof UpdateHtmlFilesDto === "undefined" ? Object : UpdateHtmlFilesDto
|
|
36343
36215
|
]),
|
|
36344
36216
|
_ts_metadata9("design:returntype", Promise)
|
|
36345
36217
|
], HtmlHotUpdateController.prototype, "updateHtmlFiles", null);
|
|
36346
|
-
HtmlHotUpdateController =
|
|
36347
|
-
(0,
|
|
36348
|
-
(0,
|
|
36218
|
+
HtmlHotUpdateController = _ts_decorate13([
|
|
36219
|
+
(0, import_swagger2.ApiExcludeController)(),
|
|
36220
|
+
(0, import_common13.Controller)("__innerapi__"),
|
|
36349
36221
|
_ts_metadata9("design:type", Function),
|
|
36350
36222
|
_ts_metadata9("design:paramtypes", [
|
|
36351
36223
|
typeof HtmlHotUpdateService === "undefined" ? Object : HtmlHotUpdateService
|
|
@@ -36353,20 +36225,20 @@ HtmlHotUpdateController = _ts_decorate14([
|
|
|
36353
36225
|
], HtmlHotUpdateController);
|
|
36354
36226
|
|
|
36355
36227
|
// src/modules/html-hot-update/html-hot-update.module.ts
|
|
36356
|
-
function
|
|
36228
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
36357
36229
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36358
36230
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36359
36231
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36360
36232
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36361
36233
|
}
|
|
36362
|
-
__name(
|
|
36234
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
36363
36235
|
var HtmlHotUpdateModule = class {
|
|
36364
36236
|
static {
|
|
36365
36237
|
__name(this, "HtmlHotUpdateModule");
|
|
36366
36238
|
}
|
|
36367
36239
|
};
|
|
36368
|
-
HtmlHotUpdateModule =
|
|
36369
|
-
(0,
|
|
36240
|
+
HtmlHotUpdateModule = _ts_decorate14([
|
|
36241
|
+
(0, import_common14.Module)({
|
|
36370
36242
|
controllers: [
|
|
36371
36243
|
HtmlHotUpdateController
|
|
36372
36244
|
],
|
|
@@ -36380,16 +36252,16 @@ HtmlHotUpdateModule = _ts_decorate15([
|
|
|
36380
36252
|
], HtmlHotUpdateModule);
|
|
36381
36253
|
|
|
36382
36254
|
// src/middlewares/html-hot-update-view/index.ts
|
|
36383
|
-
var
|
|
36255
|
+
var import_common15 = require("@nestjs/common");
|
|
36384
36256
|
var import_node_fs3 = require("fs");
|
|
36385
36257
|
var import_node_path3 = require("path");
|
|
36386
|
-
function
|
|
36258
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
36387
36259
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36388
36260
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36389
36261
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36390
36262
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36391
36263
|
}
|
|
36392
|
-
__name(
|
|
36264
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
36393
36265
|
var HtmlHotUpdateViewMiddleware = class {
|
|
36394
36266
|
static {
|
|
36395
36267
|
__name(this, "HtmlHotUpdateViewMiddleware");
|
|
@@ -36416,18 +36288,18 @@ var HtmlHotUpdateViewMiddleware = class {
|
|
|
36416
36288
|
next();
|
|
36417
36289
|
}
|
|
36418
36290
|
};
|
|
36419
|
-
HtmlHotUpdateViewMiddleware =
|
|
36420
|
-
(0,
|
|
36291
|
+
HtmlHotUpdateViewMiddleware = _ts_decorate15([
|
|
36292
|
+
(0, import_common15.Injectable)()
|
|
36421
36293
|
], HtmlHotUpdateViewMiddleware);
|
|
36422
36294
|
|
|
36423
36295
|
// src/modules/platform/module.ts
|
|
36424
|
-
function
|
|
36296
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
36425
36297
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36426
36298
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36427
36299
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36428
36300
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36429
36301
|
}
|
|
36430
|
-
__name(
|
|
36302
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
36431
36303
|
var PLATFORM_MODULE_OPTIONS = /* @__PURE__ */ Symbol("PLATFORM_MODULE_OPTIONS");
|
|
36432
36304
|
var PlatformModule = class _PlatformModule {
|
|
36433
36305
|
static {
|
|
@@ -36515,7 +36387,7 @@ var PlatformModule = class _PlatformModule {
|
|
|
36515
36387
|
},
|
|
36516
36388
|
{
|
|
36517
36389
|
provide: import_core2.APP_PIPE,
|
|
36518
|
-
useValue: new
|
|
36390
|
+
useValue: new import_common16.ValidationPipe({
|
|
36519
36391
|
transform: true,
|
|
36520
36392
|
transformOptions: {
|
|
36521
36393
|
enableImplicitConversion: true
|
|
@@ -36568,21 +36440,16 @@ var PlatformModule = class _PlatformModule {
|
|
|
36568
36440
|
*/
|
|
36569
36441
|
configure(consumer) {
|
|
36570
36442
|
const options = _PlatformModule.moduleOptions;
|
|
36571
|
-
consumer.apply(apiResponseInterceptor).forRoutes("/api/*"
|
|
36443
|
+
consumer.apply(apiResponseInterceptor).forRoutes("/api/*");
|
|
36572
36444
|
if (process.env.NODE_ENV === "development") {
|
|
36573
36445
|
consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
|
|
36574
36446
|
}
|
|
36575
|
-
if (process.env.NODE_ENV !== "production") {
|
|
36576
|
-
consumer.apply(OpenApiSpecMiddleware).forRoutes("/api/__framework__/openapi-spec");
|
|
36577
|
-
}
|
|
36578
36447
|
consumer.apply(UserContextMiddleware, RequestContextMiddleware, import_nestjs_logger2.LoggerContextMiddleware, import_nestjs_observable.ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
|
|
36579
36448
|
import_nestjs_datapaas.SqlExecutionContextMiddleware
|
|
36580
36449
|
]).forRoutes("/*");
|
|
36581
|
-
consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/
|
|
36450
|
+
consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
|
|
36582
36451
|
if (options.enableCsrf !== false) {
|
|
36583
|
-
const csrfRoutes = options.csrfRoutes ||
|
|
36584
|
-
"/api/*"
|
|
36585
|
-
];
|
|
36452
|
+
const csrfRoutes = options.csrfRoutes || "/api/*";
|
|
36586
36453
|
if (Array.isArray(csrfRoutes)) {
|
|
36587
36454
|
csrfRoutes.forEach((route) => {
|
|
36588
36455
|
consumer.apply(CsrfMiddleware).forRoutes(route);
|
|
@@ -36593,9 +36460,9 @@ var PlatformModule = class _PlatformModule {
|
|
|
36593
36460
|
}
|
|
36594
36461
|
}
|
|
36595
36462
|
};
|
|
36596
|
-
PlatformModule =
|
|
36597
|
-
(0,
|
|
36598
|
-
(0,
|
|
36463
|
+
PlatformModule = _ts_decorate16([
|
|
36464
|
+
(0, import_common16.Global)(),
|
|
36465
|
+
(0, import_common16.Module)({})
|
|
36599
36466
|
], PlatformModule);
|
|
36600
36467
|
|
|
36601
36468
|
// src/setup.ts
|
|
@@ -36671,9 +36538,6 @@ async function configureApp(app, perms = defaultPerms) {
|
|
|
36671
36538
|
console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
|
|
36672
36539
|
}
|
|
36673
36540
|
}
|
|
36674
|
-
if (process.env.NODE_ENV !== "production") {
|
|
36675
|
-
registerOpenApiSpecEndpoint(app);
|
|
36676
|
-
}
|
|
36677
36541
|
console.log("App Started Successfully.");
|
|
36678
36542
|
}
|
|
36679
36543
|
__name(configureApp, "configureApp");
|
|
@@ -36710,7 +36574,6 @@ var import_nestjs_authzpaas2 = require("@lark-apaas/nestjs-authzpaas");
|
|
|
36710
36574
|
ViewContextMiddleware,
|
|
36711
36575
|
configureApp,
|
|
36712
36576
|
createLegacyPathRedirectMiddleware,
|
|
36713
|
-
registerOpenApiSpecEndpoint,
|
|
36714
36577
|
...require("@lark-apaas/nestjs-authnpaas"),
|
|
36715
36578
|
...require("@lark-apaas/nestjs-capability"),
|
|
36716
36579
|
...require("@lark-apaas/nestjs-datapaas"),
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NestModule, DynamicModule, MiddlewareConsumer, OnModuleInit, NestMiddleware
|
|
1
|
+
import { NestModule, DynamicModule, MiddlewareConsumer, OnModuleInit, NestMiddleware } from '@nestjs/common';
|
|
2
2
|
import { HttpClientConfig, PlatformPluginOptions, HttpClient } from '@lark-apaas/http-client';
|
|
3
3
|
import { AuthZPaasModuleOptions } from '@lark-apaas/nestjs-authzpaas';
|
|
4
4
|
export { AddMembersParams, AuthZPaasModule, AuthorizationSDK, Can, CanRole, ChatSimpleDTO, CommonParam, CreateRoleParams, CreateRoleResponse, DepartmentDTO, DepartmentEntity, DepartmentSimpleDTO, FilterParams, ForceRoleDTO, I18nText, IPermissionResolver, ListMembersParams, ListMembersResponse, ListRolesParams, MemberMutationData, MemberType, PERMISSION_RESOLVER_TOKEN, PermissionPoint, PermissionRequirement, PresetGroupDTO, RemoveMembersParams, RoleMemberDTO, SearchChatEntity, SearchParams, SearchResponse, SearchResult, SearchUserEntity, UpdateRoleParams, UserSimpleDTO } from '@lark-apaas/nestjs-authzpaas';
|
|
@@ -201,7 +201,7 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
201
201
|
private readonly client;
|
|
202
202
|
private readonly logger;
|
|
203
203
|
constructor(client: PlatformHttpClient);
|
|
204
|
-
private
|
|
204
|
+
private getAppPublished;
|
|
205
205
|
use(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -221,12 +221,6 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
221
221
|
*/
|
|
222
222
|
declare function createLegacyPathRedirectMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
|
|
223
223
|
|
|
224
|
-
/**
|
|
225
|
-
* 保存 app 引用,供 OpenApiSpecMiddleware 懒加载生成 spec。
|
|
226
|
-
* 在 configureApp() 中调用(非生产环境)。
|
|
227
|
-
*/
|
|
228
|
-
declare function registerOpenApiSpecEndpoint(app: INestApplication): void;
|
|
229
|
-
|
|
230
224
|
/**
|
|
231
225
|
* API 404 响应格式
|
|
232
226
|
*/
|
|
@@ -407,4 +401,4 @@ declare class PlatformHttpClientService {
|
|
|
407
401
|
private registerInterceptorsForClient;
|
|
408
402
|
}
|
|
409
403
|
|
|
410
|
-
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, FileService, HtmlHotUpdateModule, HtmlHotUpdateService, type PlatformHttpClientOptions, PlatformHttpClientService, PlatformModule, type PlatformModuleOptions, StaticModule, UserContextMiddleware, ViewContextMiddleware, configureApp, createLegacyPathRedirectMiddleware
|
|
404
|
+
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, FileService, HtmlHotUpdateModule, HtmlHotUpdateService, type PlatformHttpClientOptions, PlatformHttpClientService, PlatformModule, type PlatformModuleOptions, StaticModule, UserContextMiddleware, ViewContextMiddleware, configureApp, createLegacyPathRedirectMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NestModule, DynamicModule, MiddlewareConsumer, OnModuleInit, NestMiddleware
|
|
1
|
+
import { NestModule, DynamicModule, MiddlewareConsumer, OnModuleInit, NestMiddleware } from '@nestjs/common';
|
|
2
2
|
import { HttpClientConfig, PlatformPluginOptions, HttpClient } from '@lark-apaas/http-client';
|
|
3
3
|
import { AuthZPaasModuleOptions } from '@lark-apaas/nestjs-authzpaas';
|
|
4
4
|
export { AddMembersParams, AuthZPaasModule, AuthorizationSDK, Can, CanRole, ChatSimpleDTO, CommonParam, CreateRoleParams, CreateRoleResponse, DepartmentDTO, DepartmentEntity, DepartmentSimpleDTO, FilterParams, ForceRoleDTO, I18nText, IPermissionResolver, ListMembersParams, ListMembersResponse, ListRolesParams, MemberMutationData, MemberType, PERMISSION_RESOLVER_TOKEN, PermissionPoint, PermissionRequirement, PresetGroupDTO, RemoveMembersParams, RoleMemberDTO, SearchChatEntity, SearchParams, SearchResponse, SearchResult, SearchUserEntity, UpdateRoleParams, UserSimpleDTO } from '@lark-apaas/nestjs-authzpaas';
|
|
@@ -201,7 +201,7 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
201
201
|
private readonly client;
|
|
202
202
|
private readonly logger;
|
|
203
203
|
constructor(client: PlatformHttpClient);
|
|
204
|
-
private
|
|
204
|
+
private getAppPublished;
|
|
205
205
|
use(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -221,12 +221,6 @@ declare class ViewContextMiddleware implements NestMiddleware {
|
|
|
221
221
|
*/
|
|
222
222
|
declare function createLegacyPathRedirectMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
|
|
223
223
|
|
|
224
|
-
/**
|
|
225
|
-
* 保存 app 引用,供 OpenApiSpecMiddleware 懒加载生成 spec。
|
|
226
|
-
* 在 configureApp() 中调用(非生产环境)。
|
|
227
|
-
*/
|
|
228
|
-
declare function registerOpenApiSpecEndpoint(app: INestApplication): void;
|
|
229
|
-
|
|
230
224
|
/**
|
|
231
225
|
* API 404 响应格式
|
|
232
226
|
*/
|
|
@@ -407,4 +401,4 @@ declare class PlatformHttpClientService {
|
|
|
407
401
|
private registerInterceptorsForClient;
|
|
408
402
|
}
|
|
409
403
|
|
|
410
|
-
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, FileService, HtmlHotUpdateModule, HtmlHotUpdateService, type PlatformHttpClientOptions, PlatformHttpClientService, PlatformModule, type PlatformModuleOptions, StaticModule, UserContextMiddleware, ViewContextMiddleware, configureApp, createLegacyPathRedirectMiddleware
|
|
404
|
+
export { type ApiNotFoundResponse, CsrfMiddleware, CsrfTokenMiddleware, FileService, HtmlHotUpdateModule, HtmlHotUpdateService, type PlatformHttpClientOptions, PlatformHttpClientService, PlatformModule, type PlatformModuleOptions, StaticModule, UserContextMiddleware, ViewContextMiddleware, configureApp, createLegacyPathRedirectMiddleware };
|
package/dist/index.js
CHANGED
|
@@ -34600,31 +34600,32 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34600
34600
|
constructor(client) {
|
|
34601
34601
|
this.client = client;
|
|
34602
34602
|
}
|
|
34603
|
-
async
|
|
34603
|
+
async getAppPublished(appId) {
|
|
34604
34604
|
if (!appId) {
|
|
34605
|
-
this.logger.warn(`appId is empty, skip get app
|
|
34605
|
+
this.logger.warn(`appId is empty, skip get app published`);
|
|
34606
34606
|
return null;
|
|
34607
34607
|
}
|
|
34608
34608
|
try {
|
|
34609
34609
|
const resp = await this.client.get(`/b/${appId}/get_published_v2`);
|
|
34610
34610
|
if (resp.status !== 200) {
|
|
34611
|
-
throw new Error(`Failed to get app
|
|
34611
|
+
throw new Error(`Failed to get app published, status: ${resp.status}`);
|
|
34612
34612
|
}
|
|
34613
34613
|
const data = await resp.json();
|
|
34614
34614
|
if (data.status_code !== "0") {
|
|
34615
|
-
throw new Error(`Failed to get app
|
|
34615
|
+
throw new Error(`Failed to get app published, status_code: ${data.status_code}`);
|
|
34616
34616
|
}
|
|
34617
|
-
return data.data
|
|
34617
|
+
return data.data ?? null;
|
|
34618
34618
|
} catch (err) {
|
|
34619
|
-
this.logger.error(err, "Failed to get app
|
|
34619
|
+
this.logger.error(err, "Failed to get app published");
|
|
34620
34620
|
return null;
|
|
34621
34621
|
}
|
|
34622
34622
|
}
|
|
34623
34623
|
async use(req, res, next) {
|
|
34624
34624
|
const { userId, tenantId, appId, loginUrl, userType } = req.userContext;
|
|
34625
34625
|
const csrfToken = req.csrfToken;
|
|
34626
|
-
const appInfo = await this.getAppInfo(appId);
|
|
34627
34626
|
const environment = mapToWindowEnvironment(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
34627
|
+
const appPublishedData = await this.getAppPublished(appId);
|
|
34628
|
+
const appInfo = appPublishedData?.app_info ?? null;
|
|
34628
34629
|
req.__platform_data__ = {
|
|
34629
34630
|
csrfToken: csrfToken ?? "",
|
|
34630
34631
|
userId: userId ?? "",
|
|
@@ -34635,7 +34636,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
34635
34636
|
loginUrl: loginUrl ?? "",
|
|
34636
34637
|
userType: userType ?? "",
|
|
34637
34638
|
tenantId,
|
|
34638
|
-
environment
|
|
34639
|
+
environment,
|
|
34640
|
+
showBadge: appInfo?.show_badge !== false,
|
|
34641
|
+
appPublished: appPublishedData ?? null
|
|
34639
34642
|
};
|
|
34640
34643
|
res.locals = {
|
|
34641
34644
|
...res.locals ?? {},
|
|
@@ -34746,24 +34749,18 @@ function createApiNotFoundResponse(req) {
|
|
|
34746
34749
|
};
|
|
34747
34750
|
}
|
|
34748
34751
|
__name(createApiNotFoundResponse, "createApiNotFoundResponse");
|
|
34749
|
-
function
|
|
34752
|
+
function getApiPathPrefix() {
|
|
34750
34753
|
const globalPrefix = process.env.CLIENT_BASE_PATH ?? "";
|
|
34751
34754
|
if (!globalPrefix) {
|
|
34752
|
-
return
|
|
34753
|
-
"/api/",
|
|
34754
|
-
"/openapi/"
|
|
34755
|
-
];
|
|
34755
|
+
return "/api/";
|
|
34756
34756
|
}
|
|
34757
34757
|
const normalizedPrefix = globalPrefix.replace(/\/+$/, "");
|
|
34758
|
-
return
|
|
34759
|
-
`${normalizedPrefix}/api/`,
|
|
34760
|
-
`${normalizedPrefix}/openapi/`
|
|
34761
|
-
];
|
|
34758
|
+
return `${normalizedPrefix}/api/`;
|
|
34762
34759
|
}
|
|
34763
|
-
__name(
|
|
34760
|
+
__name(getApiPathPrefix, "getApiPathPrefix");
|
|
34764
34761
|
function apiResponseInterceptor(req, res, next) {
|
|
34765
|
-
const
|
|
34766
|
-
if (!
|
|
34762
|
+
const apiPrefix = getApiPathPrefix();
|
|
34763
|
+
if (!req.baseUrl.startsWith(apiPrefix)) {
|
|
34767
34764
|
return next();
|
|
34768
34765
|
}
|
|
34769
34766
|
res.render = function() {
|
|
@@ -34993,141 +34990,17 @@ FrameworkDebugMiddleware = _ts_decorate7([
|
|
|
34993
34990
|
])
|
|
34994
34991
|
], FrameworkDebugMiddleware);
|
|
34995
34992
|
|
|
34996
|
-
// src/middlewares/openapi-spec/index.ts
|
|
34997
|
-
import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger";
|
|
34998
|
-
import { Injectable as Injectable8 } from "@nestjs/common";
|
|
34999
|
-
function _ts_decorate8(decorators, target, key, desc) {
|
|
35000
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35001
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35002
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35003
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35004
|
-
}
|
|
35005
|
-
__name(_ts_decorate8, "_ts_decorate");
|
|
35006
|
-
var _app = null;
|
|
35007
|
-
var _cachedSpec = null;
|
|
35008
|
-
function registerOpenApiSpecEndpoint(app) {
|
|
35009
|
-
const globalPrefix = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
35010
|
-
_app = app;
|
|
35011
|
-
console.log(`[OpenAPI] Registered GET ${globalPrefix}/api/__framework__/openapi-spec`);
|
|
35012
|
-
}
|
|
35013
|
-
__name(registerOpenApiSpecEndpoint, "registerOpenApiSpecEndpoint");
|
|
35014
|
-
var OpenApiSpecMiddleware = class {
|
|
35015
|
-
static {
|
|
35016
|
-
__name(this, "OpenApiSpecMiddleware");
|
|
35017
|
-
}
|
|
35018
|
-
use(_req, res, next) {
|
|
35019
|
-
if (!_app) {
|
|
35020
|
-
next();
|
|
35021
|
-
return;
|
|
35022
|
-
}
|
|
35023
|
-
try {
|
|
35024
|
-
if (!_cachedSpec) {
|
|
35025
|
-
const globalPrefix = (process.env.CLIENT_BASE_PATH ?? "").replace(/\/+$/, "");
|
|
35026
|
-
const config = new DocumentBuilder().setTitle("OpenAPI Spec").setVersion("1.0").build();
|
|
35027
|
-
const spec = SwaggerModule.createDocument(_app, config);
|
|
35028
|
-
_cachedSpec = buildFilteredSpec(spec, globalPrefix);
|
|
35029
|
-
}
|
|
35030
|
-
res.json(_cachedSpec);
|
|
35031
|
-
} catch (err) {
|
|
35032
|
-
console.error("[openapi-spec] Failed to generate spec:", err);
|
|
35033
|
-
res.json({
|
|
35034
|
-
openapi: "3.0.0",
|
|
35035
|
-
paths: {},
|
|
35036
|
-
components: {
|
|
35037
|
-
schemas: {}
|
|
35038
|
-
}
|
|
35039
|
-
});
|
|
35040
|
-
}
|
|
35041
|
-
}
|
|
35042
|
-
};
|
|
35043
|
-
OpenApiSpecMiddleware = _ts_decorate8([
|
|
35044
|
-
Injectable8()
|
|
35045
|
-
], OpenApiSpecMiddleware);
|
|
35046
|
-
function buildFilteredSpec(spec, globalPrefix) {
|
|
35047
|
-
const schemas = spec.components?.schemas ?? {};
|
|
35048
|
-
const paths = spec.paths ?? {};
|
|
35049
|
-
const filteredPaths = {};
|
|
35050
|
-
for (const [pathKey, methods] of Object.entries(paths)) {
|
|
35051
|
-
const cleanPath = stripPrefix(pathKey, globalPrefix);
|
|
35052
|
-
if (!cleanPath.startsWith("/openapi")) continue;
|
|
35053
|
-
filteredPaths[cleanPath] = {};
|
|
35054
|
-
for (const [method, operation] of Object.entries(methods)) {
|
|
35055
|
-
if ([
|
|
35056
|
-
"parameters",
|
|
35057
|
-
"summary",
|
|
35058
|
-
"description",
|
|
35059
|
-
"servers"
|
|
35060
|
-
].includes(method)) continue;
|
|
35061
|
-
filteredPaths[cleanPath][method] = resolveRefsDeep(structuredClone(operation), schemas);
|
|
35062
|
-
}
|
|
35063
|
-
}
|
|
35064
|
-
return {
|
|
35065
|
-
openapi: spec.openapi,
|
|
35066
|
-
paths: filteredPaths,
|
|
35067
|
-
components: {
|
|
35068
|
-
schemas: resolveAllSchemaRefs(structuredClone(schemas))
|
|
35069
|
-
}
|
|
35070
|
-
};
|
|
35071
|
-
}
|
|
35072
|
-
__name(buildFilteredSpec, "buildFilteredSpec");
|
|
35073
|
-
function stripPrefix(path2, prefix) {
|
|
35074
|
-
if (prefix && path2.startsWith(prefix)) {
|
|
35075
|
-
return path2.slice(prefix.length);
|
|
35076
|
-
}
|
|
35077
|
-
return path2;
|
|
35078
|
-
}
|
|
35079
|
-
__name(stripPrefix, "stripPrefix");
|
|
35080
|
-
var MAX_REF_DEPTH = 5;
|
|
35081
|
-
function resolveRefsDeep(obj, schemas, depth = 0) {
|
|
35082
|
-
if (depth > MAX_REF_DEPTH || obj === null || obj === void 0) return obj;
|
|
35083
|
-
if (typeof obj !== "object") return obj;
|
|
35084
|
-
if (Array.isArray(obj)) {
|
|
35085
|
-
return obj.map((item) => resolveRefsDeep(item, schemas, depth));
|
|
35086
|
-
}
|
|
35087
|
-
const record = obj;
|
|
35088
|
-
if (typeof record["$ref"] === "string") {
|
|
35089
|
-
const resolved = resolveRef(record["$ref"], schemas);
|
|
35090
|
-
if (resolved !== void 0) {
|
|
35091
|
-
return resolveRefsDeep(structuredClone(resolved), schemas, depth + 1);
|
|
35092
|
-
}
|
|
35093
|
-
return record;
|
|
35094
|
-
}
|
|
35095
|
-
const result = {};
|
|
35096
|
-
for (const [key, value] of Object.entries(record)) {
|
|
35097
|
-
result[key] = resolveRefsDeep(value, schemas, depth);
|
|
35098
|
-
}
|
|
35099
|
-
return result;
|
|
35100
|
-
}
|
|
35101
|
-
__name(resolveRefsDeep, "resolveRefsDeep");
|
|
35102
|
-
function resolveRef(ref, schemas) {
|
|
35103
|
-
const prefix = "#/components/schemas/";
|
|
35104
|
-
if (ref.startsWith(prefix)) {
|
|
35105
|
-
const name = ref.slice(prefix.length);
|
|
35106
|
-
return schemas[name];
|
|
35107
|
-
}
|
|
35108
|
-
return void 0;
|
|
35109
|
-
}
|
|
35110
|
-
__name(resolveRef, "resolveRef");
|
|
35111
|
-
function resolveAllSchemaRefs(schemas) {
|
|
35112
|
-
const result = {};
|
|
35113
|
-
for (const [name, schema] of Object.entries(schemas)) {
|
|
35114
|
-
result[name] = resolveRefsDeep(schema, schemas);
|
|
35115
|
-
}
|
|
35116
|
-
return result;
|
|
35117
|
-
}
|
|
35118
|
-
__name(resolveAllSchemaRefs, "resolveAllSchemaRefs");
|
|
35119
|
-
|
|
35120
34993
|
// src/services/platform-http-client.service.ts
|
|
35121
|
-
import { Injectable as
|
|
34994
|
+
import { Injectable as Injectable8, Logger as Logger2 } from "@nestjs/common";
|
|
35122
34995
|
import { HttpClient } from "@lark-apaas/http-client";
|
|
35123
34996
|
import { RequestContextService as RequestContextService2 } from "@lark-apaas/nestjs-common";
|
|
35124
|
-
function
|
|
34997
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
35125
34998
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35126
34999
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35127
35000
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35128
35001
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35129
35002
|
}
|
|
35130
|
-
__name(
|
|
35003
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
35131
35004
|
function _ts_metadata5(k, v) {
|
|
35132
35005
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35133
35006
|
}
|
|
@@ -35322,8 +35195,8 @@ var PlatformHttpClientService = class _PlatformHttpClientService {
|
|
|
35322
35195
|
});
|
|
35323
35196
|
}
|
|
35324
35197
|
};
|
|
35325
|
-
PlatformHttpClientService =
|
|
35326
|
-
|
|
35198
|
+
PlatformHttpClientService = _ts_decorate8([
|
|
35199
|
+
Injectable8(),
|
|
35327
35200
|
_ts_metadata5("design:type", Function),
|
|
35328
35201
|
_ts_metadata5("design:paramtypes", [
|
|
35329
35202
|
typeof RequestContextService2 === "undefined" ? Object : RequestContextService2
|
|
@@ -35334,16 +35207,16 @@ PlatformHttpClientService = _ts_decorate9([
|
|
|
35334
35207
|
var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
|
|
35335
35208
|
|
|
35336
35209
|
// src/services/file.service.ts
|
|
35337
|
-
import { Injectable as
|
|
35210
|
+
import { Injectable as Injectable9, Inject as Inject2, Logger as Logger3 } from "@nestjs/common";
|
|
35338
35211
|
import { ObservableService, RequestContextService as RequestContextService3, PLATFORM_HTTP_CLIENT as PLATFORM_HTTP_CLIENT2, OBSERVABLE_SERVICE } from "@lark-apaas/nestjs-common";
|
|
35339
35212
|
import { FileService as FileServiceCore, FileDownloadBuilder } from "@lark-apaas/file-service";
|
|
35340
|
-
function
|
|
35213
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
35341
35214
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35342
35215
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35343
35216
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35344
35217
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35345
35218
|
}
|
|
35346
|
-
__name(
|
|
35219
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
35347
35220
|
function _ts_metadata6(k, v) {
|
|
35348
35221
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35349
35222
|
}
|
|
@@ -35708,8 +35581,8 @@ var FileService = class {
|
|
|
35708
35581
|
}
|
|
35709
35582
|
}
|
|
35710
35583
|
};
|
|
35711
|
-
FileService =
|
|
35712
|
-
|
|
35584
|
+
FileService = _ts_decorate9([
|
|
35585
|
+
Injectable9(),
|
|
35713
35586
|
_ts_param2(1, Inject2(PLATFORM_HTTP_CLIENT2)),
|
|
35714
35587
|
_ts_param2(2, Inject2(OBSERVABLE_SERVICE)),
|
|
35715
35588
|
_ts_metadata6("design:type", Function),
|
|
@@ -35732,13 +35605,13 @@ import { ApiExcludeController } from "@nestjs/swagger";
|
|
|
35732
35605
|
import * as fs from "fs";
|
|
35733
35606
|
import * as path from "path";
|
|
35734
35607
|
import * as crypto2 from "crypto";
|
|
35735
|
-
function
|
|
35608
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
35736
35609
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35737
35610
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35738
35611
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35739
35612
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35740
35613
|
}
|
|
35741
|
-
__name(
|
|
35614
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
35742
35615
|
function _ts_metadata7(k, v) {
|
|
35743
35616
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35744
35617
|
}
|
|
@@ -35891,7 +35764,7 @@ var StaticController = class _StaticController {
|
|
|
35891
35764
|
}
|
|
35892
35765
|
}
|
|
35893
35766
|
};
|
|
35894
|
-
|
|
35767
|
+
_ts_decorate10([
|
|
35895
35768
|
Get("*"),
|
|
35896
35769
|
_ts_param3(0, Param()),
|
|
35897
35770
|
_ts_param3(1, Req()),
|
|
@@ -35904,7 +35777,7 @@ _ts_decorate11([
|
|
|
35904
35777
|
]),
|
|
35905
35778
|
_ts_metadata7("design:returntype", void 0)
|
|
35906
35779
|
], StaticController.prototype, "serveFile", null);
|
|
35907
|
-
StaticController =
|
|
35780
|
+
StaticController = _ts_decorate10([
|
|
35908
35781
|
ApiExcludeController(),
|
|
35909
35782
|
Controller("static"),
|
|
35910
35783
|
_ts_metadata7("design:type", Function),
|
|
@@ -35912,19 +35785,19 @@ StaticController = _ts_decorate11([
|
|
|
35912
35785
|
], StaticController);
|
|
35913
35786
|
|
|
35914
35787
|
// src/modules/static/static.module.ts
|
|
35915
|
-
function
|
|
35788
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
35916
35789
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35917
35790
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35918
35791
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35919
35792
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35920
35793
|
}
|
|
35921
|
-
__name(
|
|
35794
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
35922
35795
|
var StaticModule = class {
|
|
35923
35796
|
static {
|
|
35924
35797
|
__name(this, "StaticModule");
|
|
35925
35798
|
}
|
|
35926
35799
|
};
|
|
35927
|
-
StaticModule =
|
|
35800
|
+
StaticModule = _ts_decorate11([
|
|
35928
35801
|
Module({
|
|
35929
35802
|
controllers: [
|
|
35930
35803
|
StaticController
|
|
@@ -35940,7 +35813,7 @@ import { Controller as Controller2, Post, Body, HttpCode, HttpStatus as HttpStat
|
|
|
35940
35813
|
import { ApiExcludeController as ApiExcludeController2 } from "@nestjs/swagger";
|
|
35941
35814
|
|
|
35942
35815
|
// src/modules/html-hot-update/html-hot-update.service.ts
|
|
35943
|
-
import { Injectable as
|
|
35816
|
+
import { Injectable as Injectable10, Logger as Logger5, Inject as Inject3 } from "@nestjs/common";
|
|
35944
35817
|
import { promises as fs2 } from "fs";
|
|
35945
35818
|
import { existsSync as existsSync2 } from "fs";
|
|
35946
35819
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -35973,13 +35846,13 @@ function setActiveHtmlVersion(version) {
|
|
|
35973
35846
|
__name(setActiveHtmlVersion, "setActiveHtmlVersion");
|
|
35974
35847
|
|
|
35975
35848
|
// src/modules/html-hot-update/html-hot-update.service.ts
|
|
35976
|
-
function
|
|
35849
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
35977
35850
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
35978
35851
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
35979
35852
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35980
35853
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35981
35854
|
}
|
|
35982
|
-
__name(
|
|
35855
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
35983
35856
|
function _ts_metadata8(k, v) {
|
|
35984
35857
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35985
35858
|
}
|
|
@@ -36224,8 +36097,8 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36224
36097
|
return "";
|
|
36225
36098
|
}
|
|
36226
36099
|
};
|
|
36227
|
-
HtmlHotUpdateService =
|
|
36228
|
-
|
|
36100
|
+
HtmlHotUpdateService = _ts_decorate12([
|
|
36101
|
+
Injectable10(),
|
|
36229
36102
|
_ts_param4(0, Inject3(PLATFORM_HTTP_CLIENT3)),
|
|
36230
36103
|
_ts_metadata8("design:type", Function),
|
|
36231
36104
|
_ts_metadata8("design:paramtypes", [
|
|
@@ -36234,13 +36107,13 @@ HtmlHotUpdateService = _ts_decorate13([
|
|
|
36234
36107
|
], HtmlHotUpdateService);
|
|
36235
36108
|
|
|
36236
36109
|
// src/modules/html-hot-update/html-hot-update.controller.ts
|
|
36237
|
-
function
|
|
36110
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
36238
36111
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36239
36112
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36240
36113
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36241
36114
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36242
36115
|
}
|
|
36243
|
-
__name(
|
|
36116
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
36244
36117
|
function _ts_metadata9(k, v) {
|
|
36245
36118
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
36246
36119
|
}
|
|
@@ -36305,7 +36178,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36305
36178
|
}
|
|
36306
36179
|
}
|
|
36307
36180
|
};
|
|
36308
|
-
|
|
36181
|
+
_ts_decorate13([
|
|
36309
36182
|
Post("update_html_files"),
|
|
36310
36183
|
HttpCode(HttpStatus2.OK),
|
|
36311
36184
|
_ts_param5(0, Body()),
|
|
@@ -36315,7 +36188,7 @@ _ts_decorate14([
|
|
|
36315
36188
|
]),
|
|
36316
36189
|
_ts_metadata9("design:returntype", Promise)
|
|
36317
36190
|
], HtmlHotUpdateController.prototype, "updateHtmlFiles", null);
|
|
36318
|
-
HtmlHotUpdateController =
|
|
36191
|
+
HtmlHotUpdateController = _ts_decorate13([
|
|
36319
36192
|
ApiExcludeController2(),
|
|
36320
36193
|
Controller2("__innerapi__"),
|
|
36321
36194
|
_ts_metadata9("design:type", Function),
|
|
@@ -36325,19 +36198,19 @@ HtmlHotUpdateController = _ts_decorate14([
|
|
|
36325
36198
|
], HtmlHotUpdateController);
|
|
36326
36199
|
|
|
36327
36200
|
// src/modules/html-hot-update/html-hot-update.module.ts
|
|
36328
|
-
function
|
|
36201
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
36329
36202
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36330
36203
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36331
36204
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36332
36205
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36333
36206
|
}
|
|
36334
|
-
__name(
|
|
36207
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
36335
36208
|
var HtmlHotUpdateModule = class {
|
|
36336
36209
|
static {
|
|
36337
36210
|
__name(this, "HtmlHotUpdateModule");
|
|
36338
36211
|
}
|
|
36339
36212
|
};
|
|
36340
|
-
HtmlHotUpdateModule =
|
|
36213
|
+
HtmlHotUpdateModule = _ts_decorate14([
|
|
36341
36214
|
Module2({
|
|
36342
36215
|
controllers: [
|
|
36343
36216
|
HtmlHotUpdateController
|
|
@@ -36352,16 +36225,16 @@ HtmlHotUpdateModule = _ts_decorate15([
|
|
|
36352
36225
|
], HtmlHotUpdateModule);
|
|
36353
36226
|
|
|
36354
36227
|
// src/middlewares/html-hot-update-view/index.ts
|
|
36355
|
-
import { Injectable as
|
|
36228
|
+
import { Injectable as Injectable11 } from "@nestjs/common";
|
|
36356
36229
|
import { existsSync as existsSync3 } from "fs";
|
|
36357
36230
|
import { join as join4 } from "path";
|
|
36358
|
-
function
|
|
36231
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
36359
36232
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36360
36233
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36361
36234
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36362
36235
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36363
36236
|
}
|
|
36364
|
-
__name(
|
|
36237
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
36365
36238
|
var HtmlHotUpdateViewMiddleware = class {
|
|
36366
36239
|
static {
|
|
36367
36240
|
__name(this, "HtmlHotUpdateViewMiddleware");
|
|
@@ -36388,18 +36261,18 @@ var HtmlHotUpdateViewMiddleware = class {
|
|
|
36388
36261
|
next();
|
|
36389
36262
|
}
|
|
36390
36263
|
};
|
|
36391
|
-
HtmlHotUpdateViewMiddleware =
|
|
36392
|
-
|
|
36264
|
+
HtmlHotUpdateViewMiddleware = _ts_decorate15([
|
|
36265
|
+
Injectable11()
|
|
36393
36266
|
], HtmlHotUpdateViewMiddleware);
|
|
36394
36267
|
|
|
36395
36268
|
// src/modules/platform/module.ts
|
|
36396
|
-
function
|
|
36269
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
36397
36270
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36398
36271
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
36399
36272
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
36400
36273
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36401
36274
|
}
|
|
36402
|
-
__name(
|
|
36275
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
36403
36276
|
var PLATFORM_MODULE_OPTIONS = /* @__PURE__ */ Symbol("PLATFORM_MODULE_OPTIONS");
|
|
36404
36277
|
var PlatformModule = class _PlatformModule {
|
|
36405
36278
|
static {
|
|
@@ -36540,21 +36413,16 @@ var PlatformModule = class _PlatformModule {
|
|
|
36540
36413
|
*/
|
|
36541
36414
|
configure(consumer) {
|
|
36542
36415
|
const options = _PlatformModule.moduleOptions;
|
|
36543
|
-
consumer.apply(apiResponseInterceptor).forRoutes("/api/*"
|
|
36416
|
+
consumer.apply(apiResponseInterceptor).forRoutes("/api/*");
|
|
36544
36417
|
if (process.env.NODE_ENV === "development") {
|
|
36545
36418
|
consumer.apply(FrameworkDebugMiddleware).forRoutes("/api/__framework__/debug");
|
|
36546
36419
|
}
|
|
36547
|
-
if (process.env.NODE_ENV !== "production") {
|
|
36548
|
-
consumer.apply(OpenApiSpecMiddleware).forRoutes("/api/__framework__/openapi-spec");
|
|
36549
|
-
}
|
|
36550
36420
|
consumer.apply(UserContextMiddleware, RequestContextMiddleware, LoggerContextMiddleware, ObservableTraceMiddleware, ...DISABLE_DATAPASS ? [] : [
|
|
36551
36421
|
SqlExecutionContextMiddleware
|
|
36552
36422
|
]).forRoutes("/*");
|
|
36553
|
-
consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/
|
|
36423
|
+
consumer.apply(CsrfTokenMiddleware, ViewContextMiddleware, HtmlHotUpdateViewMiddleware).exclude("/api/(.*)", "/static/(.*)").forRoutes("*");
|
|
36554
36424
|
if (options.enableCsrf !== false) {
|
|
36555
|
-
const csrfRoutes = options.csrfRoutes ||
|
|
36556
|
-
"/api/*"
|
|
36557
|
-
];
|
|
36425
|
+
const csrfRoutes = options.csrfRoutes || "/api/*";
|
|
36558
36426
|
if (Array.isArray(csrfRoutes)) {
|
|
36559
36427
|
csrfRoutes.forEach((route) => {
|
|
36560
36428
|
consumer.apply(CsrfMiddleware).forRoutes(route);
|
|
@@ -36565,7 +36433,7 @@ var PlatformModule = class _PlatformModule {
|
|
|
36565
36433
|
}
|
|
36566
36434
|
}
|
|
36567
36435
|
};
|
|
36568
|
-
PlatformModule =
|
|
36436
|
+
PlatformModule = _ts_decorate16([
|
|
36569
36437
|
Global(),
|
|
36570
36438
|
Module3({})
|
|
36571
36439
|
], PlatformModule);
|
|
@@ -36643,9 +36511,6 @@ async function configureApp(app, perms = defaultPerms) {
|
|
|
36643
36511
|
console.error("[OpenAPI] OpenAPI \u751F\u6210\u5931\u8D25:", err);
|
|
36644
36512
|
}
|
|
36645
36513
|
}
|
|
36646
|
-
if (process.env.NODE_ENV !== "production") {
|
|
36647
|
-
registerOpenApiSpecEndpoint(app);
|
|
36648
|
-
}
|
|
36649
36514
|
console.log("App Started Successfully.");
|
|
36650
36515
|
}
|
|
36651
36516
|
__name(configureApp, "configureApp");
|
|
@@ -36680,8 +36545,7 @@ export {
|
|
|
36680
36545
|
UserContextMiddleware,
|
|
36681
36546
|
ViewContextMiddleware,
|
|
36682
36547
|
configureApp,
|
|
36683
|
-
createLegacyPathRedirectMiddleware
|
|
36684
|
-
registerOpenApiSpecEndpoint
|
|
36548
|
+
createLegacyPathRedirectMiddleware
|
|
36685
36549
|
};
|
|
36686
36550
|
/*! Bundled license information:
|
|
36687
36551
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-nestjs-core",
|
|
3
|
-
"version": "1.1.34-alpha.
|
|
3
|
+
"version": "1.1.34-alpha.68",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@lark-apaas/http-client": "^0.1.2",
|
|
44
44
|
"@lark-apaas/nestjs-authnpaas": "^1.0.3",
|
|
45
45
|
"@lark-apaas/nestjs-authzpaas": "^0.1.8",
|
|
46
|
-
"@lark-apaas/nestjs-capability": "
|
|
46
|
+
"@lark-apaas/nestjs-capability": "0.1.5-alpha.56",
|
|
47
47
|
"@lark-apaas/nestjs-common": "^0.1.8",
|
|
48
|
-
"@lark-apaas/nestjs-datapaas": "^1.0.
|
|
48
|
+
"@lark-apaas/nestjs-datapaas": "^1.0.19",
|
|
49
49
|
"@lark-apaas/nestjs-logger": "^1.0.16",
|
|
50
50
|
"@lark-apaas/nestjs-observable": "^0.0.11",
|
|
51
51
|
"@lark-apaas/nestjs-openapi-devtools": "^1.0.10",
|