@flowcore/sdk 1.5.0 → 1.7.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.6.0...v1.7.0) (2025-01-12)
4
+
5
+
6
+ ### Features
7
+
8
+ * added method to override and exported command error ([e78a053](https://github.com/flowcore-io/flowcore-sdk/commit/e78a0534283d483ecac1c6bcd35637d452240380))
9
+
10
+ ## [1.6.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.5.0...v1.6.0) (2024-12-31)
11
+
12
+
13
+ ### Features
14
+
15
+ * **exports:** :technologist: export parsed helper method ([4f781bc](https://github.com/flowcore-io/flowcore-sdk/commit/4f781bcf1ca0169f8b8b4361b201e2f38ea61d7c))
16
+
3
17
  ## [1.5.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.4.5...v1.5.0) (2024-12-19)
4
18
 
5
19
 
@@ -33,6 +33,7 @@ export type ClientOptions = ClientOptionsBearer | ClientOptionsApiKey;
33
33
  export declare class FlowcoreClient {
34
34
  private readonly options;
35
35
  private mode;
36
+ private baseUrl;
36
37
  constructor(options: ClientOptions);
37
38
  /**
38
39
  * Get the auth header
@@ -42,6 +43,10 @@ export declare class FlowcoreClient {
42
43
  * Execute a command (inner method)
43
44
  */
44
45
  private innerExecute;
46
+ /**
47
+ * Override the base URL for all commands
48
+ */
49
+ setBaseUrl(baseUrl: string): void;
45
50
  /**
46
51
  * Execute a command
47
52
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flowcore-client.d.ts","sourceRoot":"","sources":["../../src/common/flowcore-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAI3C;;GAEG;AACH,UAAU,mBAAmB;IAC3B,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GA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E,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAErE;;GAEG;AACH,qBAAa,cAAc;IAIb,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,OAAO,CAAoB;gBAEN,OAAO,EAAE,aAAa;IAiBnD;;OAEG;YACW,aAAa;IAc3B;;OAEG;YACW,YAAY;IA0D1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAGzE"}
@@ -18,6 +18,12 @@ export class FlowcoreClient {
18
18
  writable: true,
19
19
  value: void 0
20
20
  });
21
+ Object.defineProperty(this, "baseUrl", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: void 0
26
+ });
21
27
  if (this.options.getBearerToken) {
22
28
  this.mode = "bearer";
23
29
  }
@@ -60,8 +66,9 @@ export class FlowcoreClient {
60
66
  }
61
67
  const authHeader = await this.getAuthHeader();
62
68
  let response;
69
+ const url = this.baseUrl ? this.baseUrl + request.path : request.baseUrl + request.path;
63
70
  try {
64
- response = await fetch(request.baseUrl + request.path, {
71
+ response = await fetch(url, {
65
72
  method: request.method,
66
73
  headers: {
67
74
  ...request.headers,
@@ -97,6 +104,12 @@ export class FlowcoreClient {
97
104
  const parsedBody = await request.parseResponse(body, this);
98
105
  return request.waitForResponse(this, parsedBody);
99
106
  }
107
+ /**
108
+ * Override the base URL for all commands
109
+ */
110
+ setBaseUrl(baseUrl) {
111
+ this.baseUrl = baseUrl;
112
+ }
100
113
  /**
101
114
  * Execute a command
102
115
  */
@@ -1,4 +1,5 @@
1
1
  export * from "./client-error.js";
2
2
  export * from "./invalid-response.js";
3
3
  export * from "./not-found.js";
4
+ export * from "./command-error.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export * from "./client-error.js";
2
2
  export * from "./invalid-response.js";
3
3
  export * from "./not-found.js";
4
+ export * from "./command-error.js";
package/esm/mod.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./commands/index.js";
2
- export * from "./common/flowcore-client.js";
3
2
  export * from "./common/command.js";
3
+ export * from "./common/flowcore-client.js";
4
4
  export * from "./contracts/index.js";
5
5
  export * from "./exceptions/index.js";
6
+ export * from "./utils/parse-response-helper.js";
6
7
  //# sourceMappingURL=mod.d.ts.map
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kCAAkC,CAAA"}
package/esm/mod.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./commands/index.js";
2
- export * from "./common/flowcore-client.js";
3
2
  export * from "./common/command.js";
3
+ export * from "./common/flowcore-client.js";
4
4
  export * from "./contracts/index.js";
5
5
  export * from "./exceptions/index.js";
6
+ export * from "./utils/parse-response-helper.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/sdk",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -33,6 +33,7 @@ export type ClientOptions = ClientOptionsBearer | ClientOptionsApiKey;
33
33
  export declare class FlowcoreClient {
34
34
  private readonly options;
35
35
  private mode;
36
+ private baseUrl;
36
37
  constructor(options: ClientOptions);
37
38
  /**
38
39
  * Get the auth header
@@ -42,6 +43,10 @@ export declare class FlowcoreClient {
42
43
  * Execute a command (inner method)
43
44
  */
44
45
  private innerExecute;
46
+ /**
47
+ * Override the base URL for all commands
48
+ */
49
+ setBaseUrl(baseUrl: string): void;
45
50
  /**
46
51
  * Execute a command
47
52
  */
@@ -1 +1 @@
1
- {"version":3,"file":"flowcore-client.d.ts","sourceRoot":"","sources":["../../src/common/flowcore-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAI3C;;GAEG;AACH,UAAU,mBAAmB;IAC3B,cAAc,EAAE,MAAM,OAAO,CAA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,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,CAAA;CACT;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;AAErE;;GAEG;AACH,qBAAa,cAAc;IAIb,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,OAAO,CAAoB;gBAEN,OAAO,EAAE,aAAa;IAiBnD;;OAEG;YACW,aAAa;IAc3B;;OAEG;YACW,YAAY;IA0D1B;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAGzE"}
@@ -21,6 +21,12 @@ class FlowcoreClient {
21
21
  writable: true,
22
22
  value: void 0
23
23
  });
24
+ Object.defineProperty(this, "baseUrl", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: void 0
29
+ });
24
30
  if (this.options.getBearerToken) {
25
31
  this.mode = "bearer";
26
32
  }
@@ -63,8 +69,9 @@ class FlowcoreClient {
63
69
  }
64
70
  const authHeader = await this.getAuthHeader();
65
71
  let response;
72
+ const url = this.baseUrl ? this.baseUrl + request.path : request.baseUrl + request.path;
66
73
  try {
67
- response = await fetch(request.baseUrl + request.path, {
74
+ response = await fetch(url, {
68
75
  method: request.method,
69
76
  headers: {
70
77
  ...request.headers,
@@ -100,6 +107,12 @@ class FlowcoreClient {
100
107
  const parsedBody = await request.parseResponse(body, this);
101
108
  return request.waitForResponse(this, parsedBody);
102
109
  }
110
+ /**
111
+ * Override the base URL for all commands
112
+ */
113
+ setBaseUrl(baseUrl) {
114
+ this.baseUrl = baseUrl;
115
+ }
103
116
  /**
104
117
  * Execute a command
105
118
  */
@@ -1,4 +1,5 @@
1
1
  export * from "./client-error.js";
2
2
  export * from "./invalid-response.js";
3
3
  export * from "./not-found.js";
4
+ export * from "./command-error.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA"}
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client-error.js"), exports);
18
18
  __exportStar(require("./invalid-response.js"), exports);
19
19
  __exportStar(require("./not-found.js"), exports);
20
+ __exportStar(require("./command-error.js"), exports);
package/script/mod.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./commands/index.js";
2
- export * from "./common/flowcore-client.js";
3
2
  export * from "./common/command.js";
3
+ export * from "./common/flowcore-client.js";
4
4
  export * from "./contracts/index.js";
5
5
  export * from "./exceptions/index.js";
6
+ export * from "./utils/parse-response-helper.js";
6
7
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kCAAkC,CAAA"}
package/script/mod.js CHANGED
@@ -15,7 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./commands/index.js"), exports);
18
- __exportStar(require("./common/flowcore-client.js"), exports);
19
18
  __exportStar(require("./common/command.js"), exports);
19
+ __exportStar(require("./common/flowcore-client.js"), exports);
20
20
  __exportStar(require("./contracts/index.js"), exports);
21
21
  __exportStar(require("./exceptions/index.js"), exports);
22
+ __exportStar(require("./utils/parse-response-helper.js"), exports);