@aloma.io/integration-sdk 3.4.2 → 3.4.4

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.
@@ -50,10 +50,10 @@ export default class RuntimeContext {
50
50
  if (data.auth?.oauth) {
51
51
  configuration.oauth(data.auth?.oauth);
52
52
  }
53
- configuration.main(async ({ newTask, updateTask, config, oauth, getClient, getBlob, getBlobContent, putBlob, }) => {
53
+ configuration.main(async ({ newTask, updateTask, config, oauth, getClient, getBlob, getBlobContent, createBlob, }) => {
54
54
  try {
55
55
  await controller._doStop();
56
- await controller._doStart(config, oauth, newTask, updateTask, getClient, getBlob, getBlobContent, putBlob);
56
+ await controller._doStart(config, oauth, newTask, updateTask, getClient, getBlob, getBlobContent, createBlob);
57
57
  }
58
58
  catch (e) {
59
59
  console.log(e);
@@ -13,7 +13,7 @@ export declare abstract class AbstractController {
13
13
  customize?: (request: any) => void;
14
14
  }): Promise<any>;
15
15
  protected updateTask(name: string, data: any): Promise<string>;
16
- protected newBlob({ content, name, size, mimetype, meta, taskId, }: {
16
+ protected createBlob({ content, name, size, mimetype, meta, taskId, }: {
17
17
  content: string;
18
18
  name?: string;
19
19
  size?: number;
@@ -32,6 +32,6 @@ export declare abstract class AbstractController {
32
32
  __endpoint(arg: any): Promise<any | null>;
33
33
  __configQuery(arg: any): Promise<any | null>;
34
34
  __default(arg: any): Promise<any | null>;
35
- _doStart(config: any, client: any, newTask: any, updateTask: any, getClient: any, getBlob: any, getBlobContent: any, putBlob: any): Promise<void>;
35
+ _doStart(config: any, client: any, newTask: any, updateTask: any, getClient: any, getBlob: any, getBlobContent: any, createBlob: any): Promise<void>;
36
36
  _doStop(isShutdown?: boolean): Promise<void>;
37
37
  }
@@ -21,7 +21,7 @@ export class AbstractController {
21
21
  async updateTask(name, data) {
22
22
  throw new Error("not implemented");
23
23
  }
24
- async newBlob({ content, name, size, mimetype, meta, taskId, }) {
24
+ async createBlob({ content, name, size, mimetype, meta, taskId, }) {
25
25
  throw new Error("not implemented");
26
26
  }
27
27
  async getBlob(id) {
@@ -39,13 +39,13 @@ export class AbstractController {
39
39
  async __default(arg) {
40
40
  return this.fallback(arg);
41
41
  }
42
- async _doStart(config, client, newTask, updateTask, getClient, getBlob, getBlobContent, putBlob) {
42
+ async _doStart(config, client, newTask, updateTask, getClient, getBlob, getBlobContent, createBlob) {
43
43
  this.config = config;
44
44
  this.client = client;
45
45
  this.newTask = newTask;
46
46
  this.updateTask = updateTask;
47
47
  this.getClient = getClient;
48
- this.newBlob = putBlob;
48
+ this.createBlob = createBlob;
49
49
  this.getBlob = getBlob;
50
50
  this.getBlobContent = getBlobContent;
51
51
  await this.start();
@@ -520,7 +520,7 @@ ${text}
520
520
  };
521
521
  const getBlobContent = (id) => {
522
522
  return new Promise((resolve, reject) => {
523
- const packet = transport.newPacket({}, (ret) => (ret?.error ? reject(ret.error) : resolve(ret)), `_req-${cuid()}`);
523
+ const packet = transport.newPacket({}, (ret) => ret?.error ? reject(ret.error) : resolve(ret?.content), `_req-${cuid()}`);
524
524
  packet.method("connector.blob.get-content");
525
525
  packet.args({
526
526
  id,
@@ -528,10 +528,10 @@ ${text}
528
528
  transport.send(packet);
529
529
  });
530
530
  };
531
- const putBlob = (args = {}) => {
531
+ const createBlob = (args = {}) => {
532
532
  return new Promise((resolve, reject) => {
533
533
  const packet = transport.newPacket({}, (ret) => (ret?.error ? reject(ret.error) : resolve(ret?.id)), `_req-${cuid()}`);
534
- packet.method("connector.blob.put");
534
+ packet.method("connector.blob.create");
535
535
  packet.args(args);
536
536
  transport.send(packet);
537
537
  });
@@ -541,7 +541,7 @@ ${text}
541
541
  oauth: theOAuth,
542
542
  getBlob,
543
543
  getBlobContent,
544
- putBlob,
544
+ createBlob,
545
545
  getClient: (arg) => theOAuth ? theOAuth.getClient(arg) : new Fetcher(arg),
546
546
  newTask: (name, data) => {
547
547
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloma.io/integration-sdk",
3
- "version": "3.4.2",
3
+ "version": "3.4.4",
4
4
  "description": "",
5
5
  "author": "aloma.io",
6
6
  "license": "Apache-2.0",
@@ -72,7 +72,7 @@ export default class RuntimeContext {
72
72
  getClient,
73
73
  getBlob,
74
74
  getBlobContent,
75
- putBlob,
75
+ createBlob,
76
76
  }) => {
77
77
  try {
78
78
  await controller._doStop();
@@ -84,7 +84,7 @@ export default class RuntimeContext {
84
84
  getClient,
85
85
  getBlob,
86
86
  getBlobContent,
87
- putBlob,
87
+ createBlob,
88
88
  );
89
89
  } catch (e) {
90
90
  console.log(e);
@@ -38,7 +38,7 @@ export abstract class AbstractController {
38
38
  throw new Error("not implemented");
39
39
  }
40
40
 
41
- protected async newBlob({
41
+ protected async createBlob({
42
42
  content,
43
43
  name,
44
44
  size,
@@ -90,14 +90,14 @@ export abstract class AbstractController {
90
90
  getClient: any,
91
91
  getBlob: any,
92
92
  getBlobContent: any,
93
- putBlob: any,
93
+ createBlob: any,
94
94
  ): Promise<void> {
95
95
  this.config = config;
96
96
  this.client = client;
97
97
  this.newTask = newTask;
98
98
  this.updateTask = updateTask;
99
99
  this.getClient = getClient;
100
- this.newBlob = putBlob;
100
+ this.createBlob = createBlob;
101
101
  this.getBlob = getBlob;
102
102
  this.getBlobContent = getBlobContent;
103
103
 
@@ -658,7 +658,8 @@ ${text}
658
658
  return new Promise((resolve, reject) => {
659
659
  const packet = transport.newPacket(
660
660
  {},
661
- (ret) => (ret?.error ? reject(ret.error) : resolve(ret)),
661
+ (ret) =>
662
+ ret?.error ? reject(ret.error) : resolve(ret?.content),
662
663
  `_req-${cuid()}`,
663
664
  );
664
665
 
@@ -671,7 +672,7 @@ ${text}
671
672
  });
672
673
  };
673
674
 
674
- const putBlob = (args = {}) => {
675
+ const createBlob = (args = {}) => {
675
676
  return new Promise((resolve, reject) => {
676
677
  const packet = transport.newPacket(
677
678
  {},
@@ -679,7 +680,7 @@ ${text}
679
680
  `_req-${cuid()}`,
680
681
  );
681
682
 
682
- packet.method("connector.blob.put");
683
+ packet.method("connector.blob.create");
683
684
  packet.args(args);
684
685
 
685
686
  transport.send(packet);
@@ -691,7 +692,7 @@ ${text}
691
692
  oauth: theOAuth,
692
693
  getBlob,
693
694
  getBlobContent,
694
- putBlob,
695
+ createBlob,
695
696
  getClient: (arg) =>
696
697
  theOAuth ? theOAuth.getClient(arg) : new Fetcher(arg),
697
698
  newTask: (name, data) => {