私信 访问主页
weixin_39634022 2020-12-30 06:50 首页 开源项目 RC.2 breakingHi,I test the new rc2 sdk builder, but i have some bugs :(
First of all, i launch the build:sdk command, everything is ok, but when i launch the typescript compiler, i have these errors :
Error:(20, 1) TS2308: Module ./AccessToken has already exported a member named AccessToken . Consider explicitly re-exporting to resolve the ambiguity.
this is the content of my sdk/models/index.ts :
/* tslint:disable */export * from ./AccessToken export * from ./Seminaire export * from ./User export * from ./UserEvent export * from ./UserSeminaire export * from ./Session export * from ./Feed export * from ./Like export * from ./Comment export * from ./UserSession export * from ./Intervenant export * from ./Image export * from ./Organisateur export * from ./Notation export * from ./ACL export * from ./RoleMapping export * from ./Role export * from ./Email export * from ./BaseModels
the error come from the last line because a conflict exist with /AccessToken.
Content of sdk/models/AccessToken.ts :
/* tslint:disable */import { User} from ../index export interface AccessTokenInterface { id?:string; * time to live in seconds (2 weeks by default) ttl?:number; created?:any; userId?:string; user?:User;export class AccessToken implements AccessTokenInterface { id:string; * time to live in seconds (2 weeks by default) ttl:number; created:any; userId:string; user:User; constructor(instance?:AccessToken) { Object.assign(this, instance);
Content of sdk/models/BaseModels.ts :
/* tslint:disable */export interface LoopBackFilterInterface { fields?: any; include?: any; limit?: any; order?: any; skip?: any; offset?: any; where?: any;export class LoopBackFilter implements LoopBackFilterInterface { fields: any; include: any; limit: any; order: any; skip: any; offset: any; where: any;export interface TokenInterface { id?: any; user?: any; userId?: any; ttl?: any; created?: any;export class AccessToken implements TokenInterface { id: any; user: any; userId: any; ttl: any; created: any;
This is the 1st error, if i rename AccessToken to Token inside BaseModels.ts, my console.log display this error after the application launching :
zone.js:323 Error: (SystemJS) TypeError: Class extends value undefined is not a function or null at Object.eval (http://localhost:3000/sdk/services/custom/AccessToken.js:27:58) at eval (http://localhost:3000/sdk/services/custom/AccessToken.js:948:4) at eval (http://localhost:3000/sdk/services/custom/AccessToken.js:949:3) at Object.eval (http://localhost:3000/sdk/services/custom/index.js:6:10) Evaluating http://localhost:3000/sdk/services/custom/AccessToken.js Evaluating http://localhost:3000/sdk/services/custom/index.js Evaluating http://localhost:3000/sdk/services/index.js Evaluating http://localhost:3000/sdk/index.js Evaluating http://localhost:3000/sdk/services/core/logger.service.js Evaluating http://localhost:3000/sdk/services/core/index.js Evaluating http://localhost:3000/sdk/services/custom/Organisateur.js Evaluating http://localhost:3000/services/auth.service.js Evaluating http://localhost:3000/app/ui/navbar.component.js Evaluating http://localhost:3000/app/app.component.js Evaluating http://localhost:3000/app/main.js Error loading http://localhost:3000/app/main.js
I don t understand what is the problem... please do you have this bug ? and can you resolve it please ?
Many thanks for your help,best regardsBM
该提问来源于开源项目 mean-expert-official/loopback-sdk-builder
点赞 写回答 收藏 复制链接分享 删除 再等等 结题 再想想 12条回答私信 访问主页
weixin_39634022 2月前Hi Jonathan,thanks you for your proposition, i’m in holidays for about a week, i’ll contact you after my vacation for your kindy proposition.Best regardsBM
Le 25 juil. 2016 à 18:24, Jonathan Casarrubias notifications.com a écrit :
Wow this is far beyond something I have seen before, lets do this.. could you create a repo that I can see, I don t really need the backend, just a front end app with the generated SDK, I can verify how it was generated and where the issue is, otherwise this can take for weeks and I would not be able to launch a stable release until this is fixed.
CheersJon
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub https://github.com/jonathan-casarrubias/loopback-sdk-builder/issues/46#issuecomment-235004902, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlFoBJLlwv6PHE6S2D89WSA9oEPGbKsks5qZOM-gaJpZM4JR2Nb. 评论 复制链接分享私信 访问主页
weixin_39793638 2月前Wow this is far beyond something I have seen before, lets do this.. could you create a repo that I can see, I don t really need the backend, just a front end app with the generated SDK, I can verify how it was generated and where the issue is, otherwise this can take for weeks and I would not be able to launch a stable release until this is fixed.
CheersJon
点赞 评论 复制链接分享私信 访问主页
weixin_39634022 2月前in fact i switched to beta19 and all is working :/
点赞 评论 复制链接分享私信 访问主页
weixin_39634022 2月前Hi,i tested the most simple systemjs.config and generated the sdk inside the app/shared directory, but the error is still here :
zone.js:323 Error: (SystemJS) TypeError: Class extends value undefined is not a function or null at Object.eval (http://localhost:3000/app/shared/services/custom/Seminaire.js:27:54) at eval (http://localhost:3000/app/shared/services/custom/Seminaire.js:1720:4) at eval (http://localhost:3000/app/shared/services/custom/Seminaire.js:1721:3) at Object.eval (http://localhost:3000/app/shared/services/custom/index.js:6:10) Evaluating http://localhost:3000/app/shared/services/custom/Seminaire.js Evaluating http://localhost:3000/app/shared/services/custom/index.js Evaluating http://localhost:3000/app/shared/services/index.js Evaluating http://localhost:3000/app/shared/index.js Evaluating http://localhost:3000/app/shared/services/core/logger.service.js Evaluating http://localhost:3000/app/shared/services/core/index.js Evaluating http://localhost:3000/app/shared/services/custom/Organisateur.js Evaluating http://localhost:3000/app/ui/navbar.component.js Evaluating http://localhost:3000/app/app.component.js Evaluating http://localhost:3000/app/main.js Error loading http://localhost:3000/app/main.js
I tested with Google Chrome. With Firefox, the error is :
index_1.BaseLoopBackApi is not a constructor
inside the Seminaire.js
really really strange.
I modified the Seminaire.js like this :
const core_1 require( /core const http_1 require( /http const index_1 require( ../core/index const index_2 require( ../../models/index const lb_config_1 require( ../../lb.config require( rxjs/add/observable/throw require( rxjs/add/operator/map require( rxjs/add/operator/catch require( rxjs/add/operator/share console.log(index_1);
and the result in the console for console.log(index_1) is :
Object {}
i tried with console.log(index_2) but the result is the same : an empty object. But console.log(lb_config_1) and console.log(core_1) give me a correct result.
In the services/index.js i tried this :
function __export(m) { console.log(m); for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] m[p];/* tslint:disable */__export(require( ./core/index __export(require( ./custom/index
the output object m in the console is empty :
Object {}
I can t find the bug :(
点赞 评论 复制链接分享私信 访问主页
weixin_39793638 2月前Alright, I still think there is something wrong in the system-config.js.
If worth for something, this is the vanilla system.js configuration when using the angular-cli with only the SDK installed.
js/*********************************************************************************************** * User Configuration. **********************************************************************************************//** Map relative paths to URLs. */const map: any {/** User packages configuration. */const packages: any {/////////////////////////////////////////////////////////////////////////////////////////////////*********************************************************************************************** * Everything underneath this line is managed by the CLI. **********************************************************************************************/const barrels: string[] [ // Angular specific barrels. /core , /common , /compiler , /http , /router , /platform-browser , /platform-browser-dynamic , // Thirdparty barrels. rxjs , // App specific barrels. app , app/shared , /** -barrel */const cliSystemConfigPackages: any {};barrels.forEach((barrelName: string) { cliSystemConfigPackages[barrelName] { main: index /** Type declaration for ambient System. */declare var System: any;// Apply the CLI SystemJS configuration.System.config({ map: { : vendor/ , rxjs : vendor/rxjs , main : main.js packages: cliSystemConfigPackages// Apply the user s configuration.System.config({ map, packages });
I place the sdk inside app/shared according the angular 2 styleguide 04-06 https://angular.io/styleguide#!#04-06 but if you want to keep placing it in app/sdk instead of app/shared, then just change that line in the system-config.
Cheers!!!Jon
点赞 评论 复制链接分享私信 访问主页
weixin_39634022 2月前Nope, no more success.in my systemjs, the path to the generated SDK with the builder is sdk , shared is for my internal ui component.
i ll try with angular-cli for test.ThanksregardsBM
点赞 评论 复制链接分享私信 访问主页
weixin_39793638 2月前can you try this
js(function (global) { // map tells the System loader where to look for things var map { app : app , // dist , rxjs : node_modules/rxjs , angular2-in-memory-web-api : node_modules/angular2-in-memory-web-api , : node_modules/ , ng2-bootstrap : node_modules/ng2-bootstrap , moment : node_modules/moment/moment.js , angular2-jwt : node_modules/angular2-jwt , ng2-dragula : node_modules/ng2-dragula , dragula : node_modules/dragula , angular2-cookie : node_modules/angular2-cookie , angular2-moment : node_modules/angular2-moment , angular2-notifications : node_modules/angular2-notifications , symbol-observable : node_modules/symbol-observable // packages tells the System loader how to load when no filename and/or no extension var packages { app : {main: main.js , defaultExtension: js }, app/shared : { main: index }, moment : { defaultExtension: js angular2-moment : { main: index.js , defaultExtension: js rxjs : {defaultExtension: js }, ng2-bootstrap : {main: ng2-bootstrap.js , defaultExtension: js }, sdk : {main: index.js , defaultExtension: js }, angular2-jwt : {defaultExtension: js }, angular2-in-memory-web-api : {defaultExtension: js }, ng2-dragula : { defaultExtension: js angular2-notifications : {main: components.js , defaultExtension: js }, dragula : { main: dist/dragula , defaultExtension: js angular2-cookie : {main: core.js , defaultExtension: js }, symbol-observable : { defaultExtension : js , main: index.js } var packageNames [ /common , /compiler , /core , /http , /forms , /platform-browser , /platform-browser-dynamic , /router , /testing , /upgrade // add package entries for angular packages in the form /common : { main: index.js , defaultExtension: js } packageNames.forEach(function (pkgName) { packages[pkgName] {main: index.js , defaultExtension: js var config { map: map, packages: packages // filterSystemConfig - index.html s chance to modify config before we register it. if (global.filterSystemConfig) { global.filterSystemConfig(config); System.config(config);})(this);点赞 评论 复制链接分享
私信 访问主页
weixin_39634022 2月前Hi Jonathan,thanks you for your answer, i use the systems.config.js like the quickstart of Angular2, this is my systemjs.config.js :
(function (global) { // map tells the System loader where to look for things var map { app : app , // dist , rxjs : node_modules/rxjs , angular2-in-memory-web-api : node_modules/angular2-in-memory-web-api , : node_modules/ , services : services , shared : shared , models : models , sdk : sdk , ng2-bootstrap : node_modules/ng2-bootstrap , moment : node_modules/moment/moment.js , angular2-jwt : node_modules/angular2-jwt , ng2-dragula : node_modules/ng2-dragula , dragula : node_modules/dragula , angular2-cookie : node_modules/angular2-cookie , angular2-moment : node_modules/angular2-moment , angular2-notifications : node_modules/angular2-notifications , symbol-observable : node_modules/symbol-observable // packages tells the System loader how to load when no filename and/or no extension var packages { app : {main: main.js , defaultExtension: js }, moment : { defaultExtension: js angular2-moment : { main: index.js , defaultExtension: js rxjs : {defaultExtension: js }, ng2-bootstrap : {main: ng2-bootstrap.js , defaultExtension: js }, sdk : {main: index.js , defaultExtension: js }, angular2-jwt : {defaultExtension: js }, angular2-in-memory-web-api : {defaultExtension: js }, services : { defaultExtension: js models : { defaultExtension: js ng2-dragula : { defaultExtension: js angular2-notifications : {main: components.js , defaultExtension: js }, dragula : { main: dist/dragula , defaultExtension: js angular2-cookie : {main: core.js , defaultExtension: js }, symbol-observable : { defaultExtension : js , main: index.js } var packageNames [ /common , /compiler , /core , /http , /forms , /platform-browser , /platform-browser-dynamic , /router , /testing , /upgrade // add package entries for angular packages in the form /common : { main: index.js , defaultExtension: js } packageNames.forEach(function (pkgName) { packages[pkgName] {main: index.js , defaultExtension: js var config { map: map, packages: packages // filterSystemConfig - index.html s chance to modify config before we register it. if (global.filterSystemConfig) { global.filterSystemConfig(config); System.config(config);})(this);
Do you think my systemjs file is wrong ?
Thanks you,best regards
点赞 评论 复制链接分享私信 访问主页
weixin_39793638 2月前are you using angular-cli?
The very first issue regarding private models remains and I need to fix it, there is another issue already related to this, I hope to deliver the fix ASAP.
But the second issue you have, is different.
Im using system.js (angular-cli) and the only configuration I need it to make it work is to add in system-config.ts the following:
jsconst barrels: string[] [ // Angular specific barrels. /core , /common , /compiler , /forms , /http , /router , /platform-browser , /platform-browser-dynamic , // Thirdparty barrels. rxjs , // App specific barrels. app , app/shared , ..... /** -barrel */
As you can see I only add app/shared then in shared/index.ts I export the sdk as follows:
jsexport * from ./sdk/index // index word is important
I have detected an issue when not using the index, It should automatically take the index file if you don t explicitly define it, but looks like when there are many nested modules, that functionality does not always work
So please make sure you don t export the sdk using only
jsexport * from ./sdk
I had that issue in the past and I m trying to add the index word in every export and import statement.
I hope this helps you fix the linking modules issue.
CheersJon
点赞 评论 复制链接分享私信 访问主页
weixin_39634022 2月前Some progress :if i remove this line in main.ts :
import {API_PROVIDERS} from ../sdk
and replace by :
import {LoopBackAuth} from ../sdk/services/core/auth.service import {JSONSearchParams} from ../sdk/services/core/search.params
AND if in the generated /sdk/services/custom/Seminaire.ts i replace this :
import {LoopBackAuth, ErrorHandler, JSONSearchParams,BaseLoopBackApi} from ../core/index
by this :
import {LoopBackAuth, ErrorHandler, JSONSearchParams} from ../core/index import {BaseLoopBackApi} from ../core/base.service
all is working.I suspect some magic search path bug inside the generated JS /sdk/services/custom/Seminaire.js :
System.register([ /core , /http , ../core/index , ../core/base.service , ../../models/index , ../../lb.config , rxjs/add/observable/throw , rxjs/add/operator/map , rxjs/add/operator/catch , rxjs/add/operator/share ], function(exports_1, context_1) {
if i let the ../core/index alone, the app crash, if i add ../core/base.service in the System.register(), the app running.It s look like System.register doesn t import all the files...
I know how to resolve it (import manually one by one the core service custom models), but i don t know why !?!?
点赞 评论 复制链接分享私信 访问主页
weixin_39634022 2月前Hi Jonathan, Many thanks for your answer, i ve put the AccessToken in private, and rebuild the Angular2 SDK with the last version of the builder (rc3.2) but i ve still have a bug in the console :(
zone.js:323 Error: (SystemJS) TypeError: Class extends value undefined is not a function or null at Object.eval (http://localhost:3000/sdk/services/custom/Seminaire.js:27:54) at eval (http://localhost:3000/sdk/services/custom/Seminaire.js:1528:4) at eval (http://localhost:3000/sdk/services/custom/Seminaire.js:1529:3) at Object.eval (http://localhost:3000/sdk/services/custom/index.js:6:10) Evaluating http://localhost:3000/sdk/services/custom/Seminaire.js Evaluating http://localhost:3000/sdk/services/custom/index.js Evaluating http://localhost:3000/sdk/services/index.js Evaluating http://localhost:3000/sdk/index.js Evaluating http://localhost:3000/sdk/services/core/logger.service.js Evaluating http://localhost:3000/sdk/services/core/index.js Evaluating http://localhost:3000/sdk/services/custom/Organisateur.js Evaluating http://localhost:3000/services/auth.service.js Evaluating http://localhost:3000/app/ui/navbar.component.js Evaluating http://localhost:3000/app/app.component.js Evaluating http://localhost:3000/app/main.js Error loading http://localhost:3000/app/main.js
this is my tsconfig.json :
compilerOptions : { target : es6 , module : commonjs , moduleResolution : node , sourceMap : true, emitDecoratorMetadata : true, experimentalDecorators : true, removeComments : false, noImplicitAny : false exclude : [ node_modules , typings , typings/browser.d.ts
this is the description of the seminaire model :
name : Seminaire , plural : Seminaires , base : PersistedModel , idInjection : true, options : { validateUpsert : true properties : { id : { type : string , required : true title : { type : string , required : true details : { type : string startDateTime : { type : string , required : true endDateTime : { type : string , required : true locationLong : { type : string locationLat : { type : string pathPicture : { type : string address : { type : object public : { type : boolean , required : true category : { type : string validations : [], relations : { users : { type : hasMany , model : UserEvent , foreignKey : seminaireId , through : UserSeminaire , keyThrough : userId intervenants : { type : hasMany , model : Intervenant sessions : { type : hasMany , model : Session , foreignKey : seminaireId feeds : { type : hasMany , model : Feed , foreignKey : seminaireId organisateur : { type : belongsTo , model : Organisateur acls : [ accessType : * , principalType : ROLE , principalId : $everyone , permission : DENY accessType : * , principalType : ROLE , principalId : $authenticated , permission : ALLOW methods : {}
I disabled the Seminaire model, but the same error come for the other models (users, etc.)I use the latest Angular2 engine (rc.4)
I ll try on a empty project for testing but it s really strange :(
点赞 评论 复制链接分享私信 访问主页
weixin_39793638 2月前I see where the issue is
By default loopback sets the AccessToken model as private in server/model-config.json, I have been working all this time with the assumption that it will remain private.
And that is the reason I created a declaration in BaseModels, I think what I need to do here is to validate if the AccessToken is public -like you are doing- I will not add it in base models.
Thanks for reporting
Cheers!!
点赞 评论 复制链接分享 提交 再想想 采纳 为你推荐 外部链接crypto / rc4.a失败 it技术互联网问答IT行业问题计算机技术编程语言问答 1个回答/ bin / sh拒绝获得在生产环境中启动Go服务器的权限 泊坞窗,撰写 linuxdockerpermissions 2个回答Zend Framework 2 Behat php 2个回答表格未在yii2中提交 yii2formsphp 1个回答Restler 3.0 RC5 HtmlFormat使用mkdir php 1个回答PHP Web驱动程序方法将文件上传到运行Selenium2 RC的远程机器? seleniumphp 1个回答Selenium RC WaitForPageToLoad挂起 seleniumphp 4个回答PHP Composer不会使用php 5.6安装Drush:phpunit / phpunit 4.8.x需要ext-dom domdrupalphp 1个回答安装oracle11g grid 执行root.sh时一直卡在Adding Clusterware entries to inittab oracle 2个回答npm run build 时出错 node.js 2个回答RCP中报com.ibm.icu错误 it技术互联网问答IT行业问题计算机技术编程语言问答 0个回答ie8 rc1,window.open以后,session 丢失 企业应用 0个回答mac安装VirtualBox报错Kernel driver not installed (rc=-1908)怎么解决? virtualboxkernel虚拟机mac 6个回答 SELECT 语句中的 IF ——根据列值选择输出值 sqldatabasemysql 0个回答读写i2c设备寄存器返回-11 c 2个回答hbase shell 无法启动 页面能正常访问 hbaseshellhadoop 2个回答MFC 程序无法打开.rc 文件 mfc 3个回答在windows程序设计第十一章中 把自定义.dlg 文件加入到.rc资源中 vs2013window程序设计 0个回答VS2013中 把后缀文件为dlg 插入到RC资源脚本中 visual studio 1个回答关于把后缀dlg文件 插入RC资源脚本里 windowsvisual studio 1个回答 点击登录 提问题 欢迎建议意见 . 如何写高质量提问和回答? 采纳榜7天 被采纳次数 ProfSnail 25 幻灰龙 19 qq_34124780 154 coagenth 115 规则边缘 116 GoCityPass新加坡曼谷通票 117 cpp_learner 98 Jack_Yang(数据分析及可视化) 99 我不喜欢这个世界 810 天际的海浪 6 加急问题 500 500 基于tensorflow的模型做预测时,cpu占用率过高,如何降低程序的cpu占用率? 100 unity 设置Animation的culling type 导致游戏崩溃 100 java实现下面两个算法 100 ECDSA加密算法中,签名和验证都是需要时间的,那其时间复杂度怎么用椭圆曲线参数如阶或模p来表示呢? 75 数据库只有myd文件没有frm,myi文件,怎么打开呢 51 利用Adams联合matlab仿真求运动学反解问题 50 labview使用datasocket与c/c#程序的通信 50 python引用xlwings出问题,这个报错什么意思 ,怎么解决,谢谢大佬 50 如何用C语言实现凯撒密码对文本文件(.txt)的读取穷举暴力破解? 50 已知地图GPS坐标点A和坐标点B,获取A点往B点直线走一定距离的坐标点经纬度?本文链接: http://jonrc.immuno-online.com/view-770380.html