starpc 0.15.2 → 0.15.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -36,7 +36,7 @@
36
36
  "build": "rimraf ./dist && tsc --project tsconfig.build.json --outDir ./dist/",
37
37
  "check": "npm run typecheck",
38
38
  "typecheck": "tsc --noEmit",
39
- "deps": "depcheck --ignores 'bufferutil,utf-8-validate,ts-proto'",
39
+ "deps": "depcheck --ignores 'bufferutil,utf-8-validate,ts-proto,@aperturerobotics/ts-common'",
40
40
  "codegen": "npm run gen",
41
41
  "ci": "npm run build && npm run lint:js && npm run lint:go",
42
42
  "format": "prettier --write './{srpc,echo,e2e,integration,rpcstream}/**/(*.ts|*.tsx|*.html|*.css)'",
@@ -51,7 +51,8 @@
51
51
  "lint": "npm run lint:go && npm run lint:js",
52
52
  "lint:go": "make lint",
53
53
  "lint:js": "eslint -c .eslintrc.js --ext .ts ./{srpc,echo,rpcstream}/**/*.ts",
54
- "prepare": "patch-package",
54
+ "patch": "patch-package --use-yarn --patch-dir ./node_modules/@aperturerobotics/ts-common/patches",
55
+ "prepare": "npm run patch && go mod vendor",
55
56
  "precommit": "npm run format"
56
57
  },
57
58
  "prettier": {
@@ -59,6 +60,7 @@
59
60
  "singleQuote": true
60
61
  },
61
62
  "devDependencies": {
63
+ "@aperturerobotics/ts-common": "^0.2.6",
62
64
  "@typescript-eslint/eslint-plugin": "^5.45.0",
63
65
  "@typescript-eslint/parser": "^5.45.0",
64
66
  "bufferutil": "^4.0.7",
@@ -99,10 +99,10 @@ func (r *ClientRPC) HandleCallStart(pkt *CallStart) error {
99
99
 
100
100
  // Close releases any resources held by the ClientRPC.
101
101
  func (r *ClientRPC) Close() {
102
- r.mtx.Lock()
103
102
  if r.writer != nil {
104
- _ = r.writeCancelLocked()
103
+ _ = r.WriteCancel()
105
104
  }
105
+ r.mtx.Lock()
106
106
  r.closeLocked()
107
107
  r.bcast.Broadcast()
108
108
  r.mtx.Unlock()
@@ -107,8 +107,6 @@ func (c *commonRPC) ReadOne() ([]byte, error) {
107
107
 
108
108
  // WriteCallData writes a call data packet.
109
109
  func (c *commonRPC) WriteCallData(data []byte, complete bool, err error) error {
110
- c.mtx.Lock()
111
- defer c.mtx.Unlock()
112
110
  if c.writer == nil {
113
111
  return ErrCompleted
114
112
  }
@@ -173,8 +171,8 @@ func (c *commonRPC) HandleCallData(pkt *CallData) error {
173
171
  return nil
174
172
  }
175
173
 
176
- // writeCancelLocked writes a call cancel packet.
177
- func (c *commonRPC) writeCancelLocked() error {
174
+ // WriteCancel writes a call cancel packet.
175
+ func (c *commonRPC) WriteCancel() error {
178
176
  if c.writer != nil {
179
177
  return c.writer.WritePacket(NewCallCancelPacket())
180
178
  }
@@ -1,43 +0,0 @@
1
- diff --git a/node_modules/ts-poet/build/Import.js b/node_modules/ts-poet/build/Import.js
2
- index e2c318e..5d46854 100644
3
- --- a/node_modules/ts-poet/build/Import.js
4
- +++ b/node_modules/ts-poet/build/Import.js
5
- @@ -294,6 +294,18 @@ function emitImports(imports, ourModulePath, importMappings) {
6
- return "";
7
- }
8
- let result = "";
9
- + // HACK: take the project root import path from $PROJECT
10
- + const thisProject = process.env.PROJECT;
11
- + let ourModuleImportPath = path.normalize(ourModulePath);
12
- + // HACK: if this is an import from our project, set the path accordingly
13
- + // github.com/aperturerobotics/protobuf-project/example/example -> ./example/example
14
- + if (thisProject) {
15
- + if (ourModuleImportPath.startsWith(thisProject)) {
16
- + ourModuleImportPath = './' + ourModuleImportPath.substr(thisProject.length + 1);
17
- + } else {
18
- + ourModuleImportPath = '@go/' + ourModuleImportPath;
19
- + }
20
- + }
21
- const augmentImports = (0, utils_1.groupBy)(filterInstances(imports, Augmented), (a) => a.augmented);
22
- // Group the imports by source module they're imported from
23
- const importsByModule = (0, utils_1.groupBy)(imports.filter((it) => it.source !== undefined &&
24
- @@ -308,7 +320,18 @@ function emitImports(imports, ourModulePath, importMappings) {
25
- if (modulePath in importMappings) {
26
- modulePath = importMappings[modulePath];
27
- }
28
- - const importPath = maybeRelativePath(ourModulePath, modulePath);
29
- + if (thisProject) {
30
- + if (modulePath.startsWith('./')) {
31
- + if (modulePath.substring(2).startsWith(thisProject)) {
32
- + modulePath = './' + modulePath.substring(3 + thisProject.length);
33
- + } else if (modulePath.startsWith('./google/protobuf')) {
34
- + modulePath = '@aperturerobotics/ts-proto-common-types/' + path.normalize(modulePath);
35
- + } else {
36
- + modulePath = '@go/' + path.normalize(modulePath);
37
- + }
38
- + }
39
- + }
40
- + const importPath = maybeRelativePath(ourModuleImportPath, modulePath);
41
- // Output star imports individually
42
- unique(filterInstances(imports, ImportsAll).map((i) => i.symbol)).forEach((symbol) => {
43
- result += `import * as ${symbol} from '${importPath}';\n`;