@proteinjs/service 1.0.8 → 1.0.10

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/.eslintrc.js ADDED
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended', 'prettier'],
3
+ parser: '@typescript-eslint/parser',
4
+ plugins: ['@typescript-eslint', 'prettier'],
5
+ root: true,
6
+ ignorePatterns: ['**/dist/*', '**/node_modules/*'],
7
+
8
+ rules: {
9
+ 'prettier/prettier': ['warn'],
10
+ curly: ['warn'],
11
+ 'eol-last': ['warn', 'always'],
12
+ 'keyword-spacing': ['warn', { before: true }],
13
+ 'no-undef': 'off',
14
+ '@typescript-eslint/no-unused-vars': 'off',
15
+ '@typescript-eslint/no-var-requires': 'off',
16
+ '@typescript-eslint/no-explicit-any': 'off',
17
+ '@typescript-eslint/prefer-as-const': 'off',
18
+ '@typescript-eslint/ban-types': 'off',
19
+ },
20
+ };
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ dist/
3
+ .DS_Store
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "trailingComma": "es5",
3
+ "tabWidth": 2,
4
+ "semi": true,
5
+ "singleQuote": true,
6
+ "jsxSingleQuote": true,
7
+ "printWidth": 120
8
+ }
package/CHANGELOG.md CHANGED
@@ -3,14 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.0.5](https://github.com/proteinjs/service/compare/@proteinjs/service@1.0.4...@proteinjs/service@1.0.5) (2024-04-24)
6
+ ## [1.0.10](https://github.com/proteinjs/service/compare/@proteinjs/service@1.0.9...@proteinjs/service@1.0.10) (2024-05-10)
7
7
 
8
- **Note:** Version bump only for package @proteinjs/service
8
+
9
+ ### Bug Fixes
10
+
11
+ * add linting and lint all files ([a5e5e07](https://github.com/proteinjs/service/commit/a5e5e07806eeb958fcbe65f1ae2f33be97aae792))
9
12
 
10
13
 
11
14
 
12
15
 
13
16
 
17
+ ## [1.0.5](https://github.com/proteinjs/service/compare/@proteinjs/service@1.0.4...@proteinjs/service@1.0.5) (2024-04-24)
18
+
19
+ **Note:** Version bump only for package @proteinjs/service
20
+
14
21
  ## 1.0.1 (2024-04-19)
15
22
 
16
23
  **Note:** Version bump only for package @proteinjs/service
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Brent Bahry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -21,7 +21,7 @@ require("@proteinjs/server-api");
21
21
  require("@proteinjs/user-auth");
22
22
  require("@proteinjs/util");
23
23
  /** Generate Source Graph */
24
- var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/service/Service\",\"value\":{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/service/packages/service/src/Service.ts\",\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[{\"name\":\"serviceMetadata\",\"type\":{\"packageName\":\"@proteinjs/service\",\"name\":\"{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean,\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[],\\n /** \\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean,\\n },\\n /** Don't await the service's execution, return a response to the client immediately */\\n doNotAwait?: boolean,\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean,\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[],\\n /** \\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean,\\n },\\n /** Don't await the service's execution, return a response to the client immediately */\\n doNotAwait?: boolean,\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/service/ServiceRouter\",\"value\":{\"packageName\":\"@proteinjs/service\",\"name\":\"ServiceRouter\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/service/packages/service/src/ServiceRouter.ts\",\"qualifiedName\":\"@proteinjs/service/ServiceRouter\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"serviceExecutorMap\",\"type\":{\"packageName\":\"@proteinjs/service\",\"name\":\"{[path: string]: ServiceExecutor}|undefined\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/{[path: string]: ServiceExecutor}|undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"path\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"method\",\"type\":{\"packageName\":\"\",\"name\":\"'post'\",\"filePath\":null,\"qualifiedName\":\"/'post'\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getServiceExecutorMap\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"onRequest\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<any>\",\"filePath\":null,\"qualifiedName\":\"/Promise<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"request\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"response\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/server-api/Route\"}],\"edges\":[{\"v\":\"@proteinjs/service/Service\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/service/ServiceRouter\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"implements interface\"}]}";
24
+ var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/service/Service\",\"value\":{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":\"/home/runner/work/service/service/packages/service/src/Service.ts\",\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[{\"name\":\"serviceMetadata\",\"type\":{\"packageName\":\"@proteinjs/service\",\"name\":\"{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n /**\\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean;\\n };\\n /** Don't await the service's execution, return a response to the client immediately */\\n doNotAwait?: boolean;\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n /**\\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean;\\n };\\n /** Don't await the service's execution, return a response to the client immediately */\\n doNotAwait?: boolean;\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/service/ServiceRouter\",\"value\":{\"packageName\":\"@proteinjs/service\",\"name\":\"ServiceRouter\",\"filePath\":\"/home/runner/work/service/service/packages/service/src/ServiceRouter.ts\",\"qualifiedName\":\"@proteinjs/service/ServiceRouter\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"serviceExecutorMap\",\"type\":{\"packageName\":\"@proteinjs/service\",\"name\":\"{ [path: string]: ServiceExecutor } | undefined\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/{ [path: string]: ServiceExecutor } | undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"path\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"method\",\"type\":{\"packageName\":\"\",\"name\":\"'post'\",\"filePath\":null,\"qualifiedName\":\"/'post'\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getServiceExecutorMap\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"onRequest\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<any>\",\"filePath\":null,\"qualifiedName\":\"/Promise<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"request\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"response\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/server-api/Route\"}],\"edges\":[{\"v\":\"@proteinjs/service/Service\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/service/ServiceRouter\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"implements interface\"}]}";
25
25
  /** Generate Source Links */
26
26
  var ServiceRouter_1 = require("../src/ServiceRouter");
27
27
  var sourceLinks = {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,iCAA+B;AAC/B,iCAA+B;AAC/B,iCAA+B;AAC/B,gCAA8B;AAC9B,2BAAyB;AAGzB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,0mLAA0mL,CAAC;AAG/nL,4BAA4B;AAE5B,sDAAqD;AAErD,IAAM,WAAW,GAAG;IACnB,kCAAkC,EAAE,6BAAa;CACjD,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,iCAA+B;AAC/B,iCAA+B;AAC/B,iCAA+B;AAC/B,gCAA8B;AAC9B,2BAAyB;AAGzB,4BAA4B;AAE5B,IAAM,WAAW,GAAG,wiLAAwiL,CAAC;AAG7jL,4BAA4B;AAE5B,sDAAqD;AAErD,IAAM,WAAW,GAAG;IACnB,kCAAkC,EAAE,6BAAa;CACjD,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../src/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAA4B,MAAM,uBAAuB,CAAC;AAG3E,MAAM,WAAW,OAAQ,SAAQ,QAAQ;IACvC,eAAe,CAAC,EAAE;QAChB,IAAI,CAAC,EAAE;YACL,2HAA2H;YAC3H,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,kIAAkI;YAClI,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,8HAA8H;YAC9H,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;YACjB;;;;;eAKG;YACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;SAC1D,CAAC;QACF,uFAAuF;QACvF,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IACF,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,qDAAsD,MAAM,YAYtF,CAAA"}
1
+ {"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../src/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAA4B,MAAM,uBAAuB,CAAC;AAG3E,MAAM,WAAW,OAAQ,SAAQ,QAAQ;IACvC,eAAe,CAAC,EAAE;QAChB,IAAI,CAAC,EAAE;YACL,2HAA2H;YAC3H,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,kIAAkI;YAClI,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,8HAA8H;YAC9H,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;YACjB;;;;;eAKG;YACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;SAC1D,CAAC;QACF,uFAAuF;QACvF,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IACF,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;CACzD;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,qDAAsD,MAAM,YAYtF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Service.js","sourceRoot":"","sources":["../../src/Service.ts"],"names":[],"mappings":";;;AACA,oDAA2E;AAC3E,iDAAgD;AAyBhD;;;;;GAKG;AACI,IAAM,cAAc,GAAG,UAAoB,6BAAqC;IACrF,OAAO;QACL,IAAM,OAAO,GAAQ,EAAE,CAAC;QACxB,IAAM,gBAAgB,GAAG,6BAAgB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;QACzF,KAAmB,UAAwB,EAAxB,KAAA,gBAAgB,CAAC,OAAO,EAAxB,cAAwB,EAAxB,IAAwB,EAAE;YAAxC,IAAI,MAAM,SAAA;YACb,IAAM,WAAW,GAAG,mBAAY,gBAAgB,CAAC,aAAa,cAAI,MAAM,CAAC,IAAI,CAAE,CAAC;YAChF,IAAM,aAAa,GAAG,IAAI,6BAAa,CAAC,WAAW,CAAC,CAAC;YACrD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC/D;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAA;AACH,CAAC,CAAA;AAZY,QAAA,cAAc,kBAY1B"}
1
+ {"version":3,"file":"Service.js","sourceRoot":"","sources":["../../src/Service.ts"],"names":[],"mappings":";;;AACA,oDAA2E;AAC3E,iDAAgD;AAyBhD;;;;;GAKG;AACI,IAAM,cAAc,GAAG,UAAoB,6BAAqC;IACrF,OAAO;QACL,IAAM,OAAO,GAAQ,EAAE,CAAC;QACxB,IAAM,gBAAgB,GAAG,6BAAgB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;QACzF,KAAqB,UAAwB,EAAxB,KAAA,gBAAgB,CAAC,OAAO,EAAxB,cAAwB,EAAxB,IAAwB,EAAE;YAA1C,IAAM,MAAM,SAAA;YACf,IAAM,WAAW,GAAG,mBAAY,gBAAgB,CAAC,aAAa,cAAI,MAAM,CAAC,IAAI,CAAE,CAAC;YAChF,IAAM,aAAa,GAAG,IAAI,6BAAa,CAAC,WAAW,CAAC,CAAC;YACrD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAC/D;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,cAAc,kBAYzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceAuth.d.ts","sourceRoot":"","sources":["../../src/ServiceAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,qBAAa,WAAW;IACvB,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAG,OAAO;CAetF"}
1
+ {"version":3,"file":"ServiceAuth.d.ts","sourceRoot":"","sources":["../../src/ServiceAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,WAAW;IACtB,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAG,OAAO;CAmBvF"}
@@ -7,14 +7,18 @@ var ServiceAuth = /** @class */ (function () {
7
7
  }
8
8
  ServiceAuth.canRunService = function (service, method, deserializedArgs) {
9
9
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
- if ((_b = (_a = service.serviceMetadata) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.canAccess)
10
+ if ((_b = (_a = service.serviceMetadata) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.canAccess) {
11
11
  return service.serviceMetadata.auth.canAccess(method.name, deserializedArgs);
12
- if ((_d = (_c = service.serviceMetadata) === null || _c === void 0 ? void 0 : _c.auth) === null || _d === void 0 ? void 0 : _d.public)
12
+ }
13
+ if ((_d = (_c = service.serviceMetadata) === null || _c === void 0 ? void 0 : _c.auth) === null || _d === void 0 ? void 0 : _d.public) {
13
14
  return true;
14
- if ((_f = (_e = service.serviceMetadata) === null || _e === void 0 ? void 0 : _e.auth) === null || _f === void 0 ? void 0 : _f.allUsers)
15
+ }
16
+ if ((_f = (_e = service.serviceMetadata) === null || _e === void 0 ? void 0 : _e.auth) === null || _f === void 0 ? void 0 : _f.allUsers) {
15
17
  return user_auth_1.UserAuth.isLoggedIn();
16
- if (!((_h = (_g = service.serviceMetadata) === null || _g === void 0 ? void 0 : _g.auth) === null || _h === void 0 ? void 0 : _h.roles))
18
+ }
19
+ if (!((_h = (_g = service.serviceMetadata) === null || _g === void 0 ? void 0 : _g.auth) === null || _h === void 0 ? void 0 : _h.roles)) {
17
20
  return user_auth_1.UserAuth.hasRole('admin');
21
+ }
18
22
  return user_auth_1.UserAuth.hasRoles((_j = service.serviceMetadata.auth) === null || _j === void 0 ? void 0 : _j.roles);
19
23
  };
20
24
  return ServiceAuth;
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceAuth.js","sourceRoot":"","sources":["../../src/ServiceAuth.ts"],"names":[],"mappings":";;;AACA,kDAA+C;AAG/C;IAA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IAAI,CAAC;SACb;QAED,IAAI,MAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,IAAI,0CAAE,QAAQ,EAAE;YAC3C,OAAO,oBAAQ,CAAC,UAAU,EAAE,CAAC;SAC9B;QAED,IAAI,CAAC,CAAA,MAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,IAAI,0CAAE,KAAK,CAAA,EAAE;YACzC,OAAO,oBAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SAClC;QAED,OAAO,oBAAQ,CAAC,QAAQ,CAAC,MAAA,OAAO,CAAC,eAAe,CAAC,IAAI,0CAAE,KAAK,CAAC,CAAC;IAChE,CAAC;IACH,kBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,kCAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceClient.d.ts","sourceRoot":"","sources":["../../src/ServiceClient.ts"],"names":[],"mappings":"AAGA,qBAAa,aAAa;IAItB,OAAO,CAAC,WAAW;IAHrB,OAAO,CAAC,MAAM,CAAmD;gBAGvD,WAAW,EAAE,MAAM;IAGvB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;YAQ1B,KAAK;CAoBpB"}
1
+ {"version":3,"file":"ServiceClient.d.ts","sourceRoot":"","sources":["../../src/ServiceClient.ts"],"names":[],"mappings":"AAGA,qBAAa,aAAa;IAGZ,OAAO,CAAC,WAAW;IAF/B,OAAO,CAAC,MAAM,CAAmD;gBAE7C,WAAW,EAAE,MAAM;IAEjC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;YAQ1B,KAAK;CAsBpB"}
@@ -83,13 +83,15 @@ var ServiceClient = /** @class */ (function () {
83
83
  return [4 /*yield*/, fetch(request)];
84
84
  case 1:
85
85
  response = _a.sent();
86
- if (response.status != 200)
86
+ if (response.status != 200) {
87
87
  throw new Error("Failed to process service request: ".concat(absoluteUrl, ", error: ").concat(response.statusText));
88
+ }
88
89
  return [4 /*yield*/, response.json()];
89
90
  case 2:
90
91
  body = _a.sent();
91
- if (body.error)
92
+ if (body.error) {
92
93
  throw new Error(body.error);
94
+ }
93
95
  return [2 /*return*/, body.serializedReturn];
94
96
  }
95
97
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceClient.js","sourceRoot":"","sources":["../../src/ServiceClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAmD;AACnD,wCAAyC;AAEzC;IAGE,uBACU,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QAHrB,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAI9D,CAAC;IAEE,4BAAI,GAAV;QAAW,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;;;;;;wBACjB,cAAc,GAAG,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mCAA4B,IAAI,CAAC,WAAW,sBAAY,cAAc,CAAE,CAAC,CAAC;wBAClE,qBAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAAA;;wBAArE,gBAAgB,GAAG,SAAkD;wBAC3E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAA8B,IAAI,CAAC,WAAW,wBAAc,gBAAgB,CAAE,CAAC,CAAC;wBACjG,sBAAO,uBAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAC;;;;KACjD;IAEa,6BAAK,GAAnB,UAAoB,WAAmB,EAAE,cAAsB;;;;;;wBACvD,OAAO,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE;4BAC1C,MAAM,EAAE,MAAM;4BACd,IAAI,EAAE,cAAc;4BACpB,QAAQ,EAAE,QAAQ;4BA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AIjB,OAAO,EAAE,OAAO;IACvB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,MAAM,CAAS;IAChB,gBAAgB,EAAE,GAAG,CAAC;gBAEpB,OAAO,EAAE,OAAO,EACf,UAAU,EAAE,SAAS,EACrB,MAAM,EAAE,MAAM;IAKlB,OAAO,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAuB9C"}
1
+ {"version":3,"file":"ServiceExecutor.d.ts","sourceRoot":"","sources":["../../src/ServiceExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,qBAAa,eAAe;IAIjB,OAAO,EAAE,OAAO;IACvB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,MAAM,CAAS;IAChB,gBAAgB,EAAE,GAAG,CAAC;gBAEpB,OAAO,EAAE,OAAO,EACf,UAAU,EAAE,SAAS,EACrB,MAAM,EAAE,MAAM;IAKlB,OAAO,CAAC,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAwB9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceExecutor.js","sourceRoot":"","sources":["../../src/ServiceExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wCAAyC;AACzC,oDAAmD;AACnD,6CAA4C;AAE5C;IAGE,yBACS,OAAgB,EACf,UAAqB,EACrB,MAAc;QAFf,YAAO,GAAP,OAAO,CAAS;QACf,eAAU,GAAV,UAAU,CAAW;QACrB,WAAM,GAAN,MAAM,CAAQ;QAEtB,IAAI,CAAC,MAAM,GAAG,IAAI,aAAM,CAAC,UAAG,UAAU,CAAC,IAAI,cAAI,MAAM,CAAC,IAAI,CAAE,EAAE,SAAS,EAAE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AC1C,MAAM,eAAI,gBAAgB,EAAE;;4BAElB,qBAAM,MAAM,eAAI,gBAAgB,GAAC;;wBAA3C,OAAO,GAAG,SAAiC,CAAC;;;;;wBAG9C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAAsB,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC;wBAChF,MAAM,OAAK,CAAC;;wBAER,gBAAgB,GAAG,uBAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;wBACvD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAe,gBAAgB,CAAE,CAAC,CAAC;wBACpD,sBAAO,gBAAgB,EAAC;;;;KACzB;IACH,sBAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCY,0CAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceRouter.d.ts","sourceRoot":"","sources":["../../src/ServiceRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAM9C,qBAAa,aAAc,YAAW,KAAK;IACzC,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,kBAAkB,CAA8C;IACxE,IAAI,SAAe;IACnB,MAAM,EAAE,MAAM,CAAU;IAExB,OAAO,CAAC,qBAAqB;IAoBvB,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAiB3D"}
1
+ {"version":3,"file":"ServiceRouter.d.ts","sourceRoot":"","sources":["../../src/ServiceRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAM9C,qBAAa,aAAc,YAAW,KAAK;IACzC,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,IAAI,SAAe;IACnB,MAAM,EAAE,MAAM,CAAU;IAExB,OAAO,CAAC,qBAAqB;IAqBvB,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CAiB3D"}
@@ -53,8 +53,9 @@ var ServiceRouter = /** @class */ (function () {
53
53
  for (var _i = 0, serviceTypes_1 = serviceTypes; _i < serviceTypes_1.length; _i++) {
54
54
  var serviceType = serviceTypes_1[_i];
55
55
  this.logger.info("Loading service: ".concat(serviceType.qualifiedName));
56
- if (!(0, util_1.isInstanceOf)(serviceType, reflection_1.Interface))
56
+ if (!(0, util_1.isInstanceOf)(serviceType, reflection_1.Interface)) {
57
57
  continue;
58
+ }
58
59
  var service = reflection_1.SourceRepository.get().object(serviceType.qualifiedName);
59
60
  for (var _a = 0, _b = serviceType.methods; _a < _b.length; _a++) {
60
61
  var method = _b[_a];
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceRouter.js","sourceRoot":"","sources":["../../src/ServiceRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oDAAoE;AACpE,qDAAoD;AACpD,wCAAuD;AAEvD;IAAA;QACU,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAEnD,SAAI,GAAG,WAAW,CAAC;QACnB,WAAM,GAAW,MAAM,CAAC;IAuC1B,CAAC;IArCS,6CAAqB,GAA7B;QACE,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC5B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;YAC7B,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,6BAAgB,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC,CAAC;YACxG,KAAwB,UAAY,EAAZ,6BAAY,EAAZ,0BAAY,EAAZ,IAAY,EAAE;gBAAjC,IAAI,WAAW,qBAAA;gBAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAAoB,WAAW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,aAAa,cAAI,MAAM,CAAC,IAAI,CAAE,CAAC;oBAC3E,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,IAAI,iCAAe,CAAC,OAAO,EAAE,WAAwB,EAAE,MAAM,CAAC,CAAC;iBACvG;aACF;SACF;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAEK,iCAAS,GAAf,UAAgB,OAAY,EAAE,QAAa;;;;;;wBACnC,eAAe,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;wBACnE,IAAI,CAAC,eAAe,EAAE;4BACd,KAAK,GAAG,gDAAyC,OAAO,CAAC,IAAI,CAAE,CAAC;4BACtE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;4BACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;4BACzB,sBAAO;yBACR;;;;wBAG0B,qBAAM,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAA;;wBAA9D,gBAAgB,GAAG,SAA2C;wBACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,kBAAA,EAAE,CAAC,CAAC;;;;wBAEpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAK,CAAC,KAAK,CAAC,CAAC;wBAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAK,CAAC,OAAO,EAAE,CAAC,CAAC;;;;;;KAE3C;IACH,oBAAC;AAAD,CAAC,AA5CD,IA4CC;AA5CY,sCAAa"}
@@ -6,25 +6,22 @@ import '@proteinjs/server-api';
6
6
  import '@proteinjs/user-auth';
7
7
  import '@proteinjs/util';
8
8
 
9
-
10
9
  /** Generate Source Graph */
11
10
 
12
- const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/service/Service\",\"value\":{\"packageName\":\"@proteinjs/service\",\"name\":\"Service\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/service/packages/service/src/Service.ts\",\"qualifiedName\":\"@proteinjs/service/Service\",\"properties\":[{\"name\":\"serviceMetadata\",\"type\":{\"packageName\":\"@proteinjs/service\",\"name\":\"{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean,\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[],\\n /** \\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean,\\n },\\n /** Don't await the service's execution, return a response to the client immediately */\\n doNotAwait?: boolean,\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean,\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean,\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[],\\n /** \\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean,\\n },\\n /** Don't await the service's execution, return a response to the client immediately */\\n doNotAwait?: boolean,\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/service/ServiceRouter\",\"value\":{\"packageName\":\"@proteinjs/service\",\"name\":\"ServiceRouter\",\"filePath\":\"/Users/brentbahry/workspaces/n3xa/packages/proteinjs/packages/service/packages/service/src/ServiceRouter.ts\",\"qualifiedName\":\"@proteinjs/service/ServiceRouter\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"logger\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"serviceExecutorMap\",\"type\":{\"packageName\":\"@proteinjs/service\",\"name\":\"{[path: string]: ServiceExecutor}|undefined\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/service/{[path: string]: ServiceExecutor}|undefined\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"path\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"method\",\"type\":{\"packageName\":\"\",\"name\":\"'post'\",\"filePath\":null,\"qualifiedName\":\"/'post'\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getServiceExecutorMap\",\"returnType\":null,\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\",\"parameters\":[]},{\"name\":\"onRequest\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<any>\",\"filePath\":null,\"qualifiedName\":\"/Promise<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"request\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"response\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/server-api\",\"name\":\"Route\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/server-api/Route\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/server-api/Route\"}],\"edges\":[{\"v\":\"@proteinjs/service/Service\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"},{\"v\":\"@proteinjs/service/ServiceRouter\",\"w\":\"@proteinjs/server-api/Route\",\"value\":\"implements interface\"}]}";
13
-
11
+ const sourceGraph =
12
+ '{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/service/Service","value":{"packageName":"@proteinjs/service","name":"Service","filePath":"/home/runner/work/service/service/packages/service/src/Service.ts","qualifiedName":"@proteinjs/service/Service","properties":[{"name":"serviceMetadata","type":{"packageName":"@proteinjs/service","name":"{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the \'admin\' role. */\\n roles?: string[];\\n /**\\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean;\\n };\\n /** Don\'t await the service\'s execution, return a response to the client immediately */\\n doNotAwait?: boolean;\\n }","filePath":null,"qualifiedName":"@proteinjs/service/{\\n auth?: {\\n /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the \'admin\' role. */\\n roles?: string[];\\n /**\\n * Custom auth function. If provided, all other auth properties are ignored.\\n * @param methodName the name of the service method to be executed\\n * @param args the args[] that will be passed into the method\\n * @return true if the user can access the service method\\n */\\n canAccess?: (methodName: string, args: any[]) => boolean;\\n };\\n /** Don\'t await the service\'s execution, return a response to the client immediately */\\n doNotAwait?: boolean;\\n }","typeParameters":null,"directParents":null},"isOptional":true,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[],"typeParameters":[],"directParents":[{"packageName":"@proteinjs/reflection","name":"Loadable","filePath":null,"qualifiedName":"@proteinjs/reflection/Loadable","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"sourceType":3}},{"v":"@proteinjs/reflection/Loadable"},{"v":"@proteinjs/service/ServiceRouter","value":{"packageName":"@proteinjs/service","name":"ServiceRouter","filePath":"/home/runner/work/service/service/packages/service/src/ServiceRouter.ts","qualifiedName":"@proteinjs/service/ServiceRouter","isAbstract":false,"isStatic":false,"visibility":"public","properties":[{"name":"logger","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"serviceExecutorMap","type":{"packageName":"@proteinjs/service","name":"{ [path: string]: ServiceExecutor } | undefined","filePath":null,"qualifiedName":"@proteinjs/service/{ [path: string]: ServiceExecutor } | undefined","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private"},{"name":"path","type":null,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"},{"name":"method","type":{"packageName":"","name":"\'post\'","filePath":null,"qualifiedName":"/\'post\'","typeParameters":null,"directParents":null},"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public"}],"methods":[{"name":"getServiceExecutorMap","returnType":null,"isAsync":false,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"private","parameters":[]},{"name":"onRequest","returnType":{"packageName":"","name":"Promise<any>","filePath":null,"qualifiedName":"/Promise<any>","typeParameters":null,"directParents":null},"isAsync":true,"isOptional":false,"isAbstract":false,"isStatic":false,"visibility":"public","parameters":[{"name":"request","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null}},{"name":"response","type":{"packageName":"","name":"any","filePath":null,"qualifiedName":"/any","typeParameters":null,"directParents":null}}]}],"typeParameters":[],"directParentInterfaces":[{"packageName":"@proteinjs/server-api","name":"Route","filePath":null,"qualifiedName":"@proteinjs/server-api/Route","properties":[],"methods":[],"typeParameters":[],"directParents":[]}],"directParentClasses":[],"sourceType":2}},{"v":"@proteinjs/server-api/Route"}],"edges":[{"v":"@proteinjs/service/Service","w":"@proteinjs/reflection/Loadable","value":"extends interface"},{"v":"@proteinjs/service/ServiceRouter","w":"@proteinjs/server-api/Route","value":"implements interface"}]}';
14
13
 
15
14
  /** Generate Source Links */
16
15
 
17
16
  import { ServiceRouter } from '../src/ServiceRouter';
18
17
 
19
18
  const sourceLinks = {
20
- '@proteinjs/service/ServiceRouter': ServiceRouter,
19
+ '@proteinjs/service/ServiceRouter': ServiceRouter,
21
20
  };
22
21
 
23
-
24
22
  /** Load Source Graph and Links */
25
23
 
26
24
  import { SourceRepository } from '@proteinjs/reflection';
27
25
  SourceRepository.merge(sourceGraph, sourceLinks);
28
26
 
29
-
30
- export * from '../index';
27
+ export * from '../index';
package/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './src/Service'
1
+ export * from './src/Service';
package/jest.config.js CHANGED
@@ -1,18 +1,9 @@
1
1
  module.exports = {
2
- "roots": [
3
- "<rootDir>/test"
4
- ],
5
- "transform": {
6
- "^.+\\.tsx?$": "ts-jest"
7
- },
8
- "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
9
- "moduleFileExtensions": [
10
- "ts",
11
- "tsx",
12
- "js",
13
- "jsx",
14
- "json",
15
- "node"
16
- ],
17
- "testEnvironment": "node"
18
- }
2
+ roots: ['<rootDir>/test'],
3
+ transform: {
4
+ '^.+\\.tsx?$': 'ts-jest',
5
+ },
6
+ testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
7
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8
+ testEnvironment: 'node',
9
+ };
package/package.json CHANGED
@@ -1,40 +1,46 @@
1
1
  {
2
- "name": "@proteinjs/service",
3
- "version": "1.0.8",
4
- "description": "Service api",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/proteinjs/service.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/proteinjs/service/issues"
14
- },
15
- "homepage": "https://github.com/proteinjs/service#readme",
16
- "author": "Brent Bahry",
17
- "license": "MIT",
18
- "scripts": {
19
- "clean": "rm -rf dist/ generated/ node_modules/",
20
- "build": "reflection-build && tsc",
21
- "watch": "reflection-watch"
22
- },
23
- "dependencies": {
24
- "@proteinjs/reflection": "1.0.7",
25
- "@proteinjs/serializer": "1.0.6",
26
- "@proteinjs/server-api": "1.0.8",
27
- "@proteinjs/user-auth": "1.0.6",
28
- "@proteinjs/util": "1.1.0"
29
- },
30
- "devDependencies": {
31
- "@proteinjs/reflection-build": "1.0.13",
32
- "@types/jest": "29.5.5",
33
- "@types/node": "14.0.27",
34
- "jest": "29.7.0",
35
- "ts-jest": "29.1.1",
36
- "typescript": "5.2.2"
37
- },
38
- "main": "./dist/generated/index.js",
39
- "types": "./dist/generated/index.d.ts"
40
- }
2
+ "name": "@proteinjs/service",
3
+ "version": "1.0.10",
4
+ "description": "Service api",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/proteinjs/service.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/proteinjs/service/issues"
14
+ },
15
+ "homepage": "https://github.com/proteinjs/service#readme",
16
+ "author": "Brent Bahry",
17
+ "license": "MIT",
18
+ "scripts": {
19
+ "clean": "rm -rf dist/ generated/ node_modules/",
20
+ "build": "reflection-build && tsc",
21
+ "watch": "reflection-watch"
22
+ },
23
+ "dependencies": {
24
+ "@proteinjs/reflection": "1.1.1",
25
+ "@proteinjs/serializer": "1.0.7",
26
+ "@proteinjs/server-api": "1.1.1",
27
+ "@proteinjs/user-auth": "1.0.7",
28
+ "@proteinjs/util": "1.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "@proteinjs/reflection-build": "1.0.16",
32
+ "@types/jest": "29.5.5",
33
+ "@types/node": "14.0.27",
34
+ "@typescript-eslint/eslint-plugin": "7.8.0",
35
+ "@typescript-eslint/parser": "7.8.0",
36
+ "eslint": "8.57.0",
37
+ "eslint-config-prettier": "9.1.0",
38
+ "eslint-plugin-prettier": "5.1.3",
39
+ "jest": "29.7.0",
40
+ "ts-jest": "29.1.1",
41
+ "typescript": "5.2.2"
42
+ },
43
+ "main": "./dist/generated/index.js",
44
+ "types": "./dist/generated/index.d.ts",
45
+ "gitHead": "c04befdb0a0b15e3b6bc4fd0762d5fa5d5fd255a"
46
+ }
package/src/Service.ts CHANGED
@@ -6,21 +6,21 @@ export interface Service extends Loadable {
6
6
  serviceMetadata?: {
7
7
  auth?: {
8
8
  /** If true, the user does not need to be logged in or have any roles to call this service. If blank, defaults to false. */
9
- public?: boolean,
9
+ public?: boolean;
10
10
  /** If true, the user does not need to have any roles to call this service, but must be logged in. If blank, defaults to false. */
11
- allUsers?: boolean,
11
+ allUsers?: boolean;
12
12
  /** The user must be logged in and have these roles to call this service. If blank, defaults to requiring the 'admin' role. */
13
- roles?: string[],
14
- /**
13
+ roles?: string[];
14
+ /**
15
15
  * Custom auth function. If provided, all other auth properties are ignored.
16
16
  * @param methodName the name of the service method to be executed
17
17
  * @param args the args[] that will be passed into the method
18
18
  * @return true if the user can access the service method
19
19
  */
20
- canAccess?: (methodName: string, args: any[]) => boolean,
21
- },
20
+ canAccess?: (methodName: string, args: any[]) => boolean;
21
+ };
22
22
  /** Don't await the service's execution, return a response to the client immediately */
23
- doNotAwait?: boolean,
23
+ doNotAwait?: boolean;
24
24
  };
25
25
  [prop: string]: SerializableFunction | NotFunction<any>;
26
26
  }
@@ -31,16 +31,16 @@ export interface Service extends Loadable {
31
31
  * @param serviceInterfaceQualifiedName the package-qualified name of the service interface (ie. service-package-name/MyService)
32
32
  * @returns a function that creates a Service
33
33
  */
34
- export const serviceFactory = <T extends Service>(serviceInterfaceQualifiedName: string): () => T => {
34
+ export const serviceFactory = <T extends Service>(serviceInterfaceQualifiedName: string): (() => T) => {
35
35
  return () => {
36
36
  const service: any = {};
37
37
  const serviceInterface = SourceRepository.get().interface(serviceInterfaceQualifiedName);
38
- for (let method of serviceInterface.methods) {
38
+ for (const method of serviceInterface.methods) {
39
39
  const servicePath = `/service/${serviceInterface.qualifiedName}/${method.name}`;
40
40
  const serviceClient = new ServiceClient(servicePath);
41
41
  service[method.name] = serviceClient.send.bind(serviceClient);
42
42
  }
43
43
 
44
44
  return service;
45
- }
46
- }
45
+ };
46
+ };
@@ -1,21 +1,25 @@
1
- import { Method } from '@proteinjs/reflection'
2
- import { UserAuth } from '@proteinjs/user-auth'
3
- import { Service } from './Service'
1
+ import { Method } from '@proteinjs/reflection';
2
+ import { UserAuth } from '@proteinjs/user-auth';
3
+ import { Service } from './Service';
4
4
 
5
5
  export class ServiceAuth {
6
- static canRunService(service: Service, method: Method, deserializedArgs: any): boolean {
7
- if (service.serviceMetadata?.auth?.canAccess)
8
- return service.serviceMetadata.auth.canAccess(method.name, deserializedArgs);
6
+ static canRunService(service: Service, method: Method, deserializedArgs: any): boolean {
7
+ if (service.serviceMetadata?.auth?.canAccess) {
8
+ return service.serviceMetadata.auth.canAccess(method.name, deserializedArgs);
9
+ }
9
10
 
10
- if (service.serviceMetadata?.auth?.public)
11
+ if (service.serviceMetadata?.auth?.public) {
11
12
  return true;
13
+ }
12
14
 
13
- if (service.serviceMetadata?.auth?.allUsers)
15
+ if (service.serviceMetadata?.auth?.allUsers) {
14
16
  return UserAuth.isLoggedIn();
17
+ }
15
18
 
16
- if (!service.serviceMetadata?.auth?.roles)
19
+ if (!service.serviceMetadata?.auth?.roles) {
17
20
  return UserAuth.hasRole('admin');
21
+ }
18
22
 
19
23
  return UserAuth.hasRoles(service.serviceMetadata.auth?.roles);
20
- }
21
- }
24
+ }
25
+ }
@@ -4,9 +4,7 @@ import { Logger } from '@proteinjs/util';
4
4
  export class ServiceClient {
5
5
  private logger = new Logger(this.constructor.name, 'info', 2000);
6
6
 
7
- constructor(
8
- private servicePath: string,
9
- ) {}
7
+ constructor(private servicePath: string) {}
10
8
 
11
9
  async send(...args: any[]): Promise<any> {
12
10
  const serializedArgs = Serializer.serialize(args);
@@ -18,22 +16,24 @@ export class ServiceClient {
18
16
 
19
17
  private async _send(absoluteUrl: string, serializedArgs: string) {
20
18
  const request = new Request(absoluteUrl, {
21
- method: 'POST',
22
- body: serializedArgs,
23
- redirect: 'follow',
24
- credentials: 'same-origin',
25
- headers: {
19
+ method: 'POST',
20
+ body: serializedArgs,
21
+ redirect: 'follow',
22
+ credentials: 'same-origin',
23
+ headers: {
26
24
  'Content-Type': 'application/json',
27
25
  },
28
- });
26
+ });
29
27
  const response = await fetch(request);
30
- if (response.status != 200)
28
+ if (response.status != 200) {
31
29
  throw new Error(`Failed to process service request: ${absoluteUrl}, error: ${response.statusText}`);
32
-
30
+ }
31
+
33
32
  const body = await response.json();
34
- if (body.error)
35
- throw new Error(body.error);
36
-
33
+ if (body.error) {
34
+ throw new Error(body.error);
35
+ }
36
+
37
37
  return body.serializedReturn;
38
38
  }
39
- }
39
+ }
@@ -10,7 +10,7 @@ export class ServiceExecutor {
10
10
  constructor(
11
11
  public service: Service,
12
12
  private _interface: Interface,
13
- private method: Method,
13
+ private method: Method
14
14
  ) {
15
15
  this.logger = new Logger(`${_interface.name}.${method.name}`, undefined, 2500);
16
16
  }
@@ -26,10 +26,11 @@ export class ServiceExecutor {
26
26
 
27
27
  let _return: any;
28
28
  try {
29
- if (this.service.serviceMetadata?.doNotAwait)
29
+ if (this.service.serviceMetadata?.doNotAwait) {
30
30
  method(...deserializedArgs);
31
- else
31
+ } else {
32
32
  _return = await method(...deserializedArgs);
33
+ }
33
34
  } catch (error: any) {
34
35
  this.logger.error(`Failed with args:\n${JSON.stringify(requestBody, null, 2)}`);
35
36
  throw error;
@@ -38,4 +39,4 @@ export class ServiceExecutor {
38
39
  this.logger.info(`Returning:\n${serializedReturn}`);
39
40
  return serializedReturn;
40
41
  }
41
- }
42
+ }
@@ -6,7 +6,7 @@ import { Logger, isInstanceOf } from '@proteinjs/util';
6
6
 
7
7
  export class ServiceRouter implements Route {
8
8
  private logger = new Logger(this.constructor.name);
9
- private serviceExecutorMap: {[path: string]: ServiceExecutor}|undefined;
9
+ private serviceExecutorMap: { [path: string]: ServiceExecutor } | undefined;
10
10
  path = 'service/*';
11
11
  method: 'post' = 'post';
12
12
 
@@ -14,13 +14,14 @@ export class ServiceRouter implements Route {
14
14
  if (!this.serviceExecutorMap) {
15
15
  this.serviceExecutorMap = {};
16
16
  const serviceTypes = Object.values(SourceRepository.get().directChildren('@proteinjs/service/Service'));
17
- for (let serviceType of serviceTypes) {
17
+ for (const serviceType of serviceTypes) {
18
18
  this.logger.info(`Loading service: ${serviceType.qualifiedName}`);
19
- if (!isInstanceOf(serviceType, Interface))
19
+ if (!isInstanceOf(serviceType, Interface)) {
20
20
  continue;
21
+ }
21
22
 
22
23
  const service = SourceRepository.get().object<Service>(serviceType.qualifiedName);
23
- for (let method of (serviceType as Interface).methods) {
24
+ for (const method of (serviceType as Interface).methods) {
24
25
  const servicePath = `/service/${serviceType.qualifiedName}/${method.name}`;
25
26
  this.serviceExecutorMap[servicePath] = new ServiceExecutor(service, serviceType as Interface, method);
26
27
  }
@@ -31,20 +32,20 @@ export class ServiceRouter implements Route {
31
32
  }
32
33
 
33
34
  async onRequest(request: any, response: any): Promise<any> {
34
- const serviceExecutor = this.getServiceExecutorMap()[request.path];
35
- if (!serviceExecutor) {
36
- const error = `Unable to find service matching path: ${request.path}`;
37
- this.logger.error(error);
38
- response.send({ error });
39
- return;
40
- }
35
+ const serviceExecutor = this.getServiceExecutorMap()[request.path];
36
+ if (!serviceExecutor) {
37
+ const error = `Unable to find service matching path: ${request.path}`;
38
+ this.logger.error(error);
39
+ response.send({ error });
40
+ return;
41
+ }
41
42
 
42
- try {
43
- const serializedReturn = await serviceExecutor.execute(request.body);
44
- response.send({ serializedReturn });
45
- } catch (error: any) {
46
- this.logger.error(error.stack);
47
- response.send({ error: error.message });
48
- }
43
+ try {
44
+ const serializedReturn = await serviceExecutor.execute(request.body);
45
+ response.send({ serializedReturn });
46
+ } catch (error: any) {
47
+ this.logger.error(error.stack);
48
+ response.send({ error: error.message });
49
+ }
49
50
  }
50
- }
51
+ }
package/tsconfig.json CHANGED
@@ -1,23 +1,19 @@
1
1
  {
2
- "compilerOptions": {
3
- "rootDir": "./",
4
- "target": "es5",
5
- "module": "commonjs",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "sourceMap": true,
9
- "outDir": "./dist/",
10
- "strict": true,
11
- "noImplicitAny": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "resolveJsonModule": true,
16
- "typeRoots": [
17
- "./node_modules/@types"
18
- ],
19
- "types": [
20
- "node", "jest"
21
- ]
22
- }
23
- }
2
+ "compilerOptions": {
3
+ "rootDir": "./",
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "outDir": "./dist/",
10
+ "strict": true,
11
+ "noImplicitAny": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "typeRoots": ["./node_modules/@types"],
17
+ "types": ["node", "jest"]
18
+ }
19
+ }