@flowcore/sdk 1.47.1 → 1.49.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +114 -0
  3. package/esm/commands/index.d.ts +5 -0
  4. package/esm/commands/index.d.ts.map +1 -1
  5. package/esm/commands/index.js +6 -0
  6. package/esm/commands/scenario/scenario.create.d.ts +41 -0
  7. package/esm/commands/scenario/scenario.create.d.ts.map +1 -0
  8. package/esm/commands/scenario/scenario.create.js +44 -0
  9. package/esm/commands/scenario/scenario.delete.d.ts +37 -0
  10. package/esm/commands/scenario/scenario.delete.d.ts.map +1 -0
  11. package/esm/commands/scenario/scenario.delete.js +47 -0
  12. package/esm/commands/scenario/scenario.fetch.d.ts +53 -0
  13. package/esm/commands/scenario/scenario.fetch.d.ts.map +1 -0
  14. package/esm/commands/scenario/scenario.fetch.js +68 -0
  15. package/esm/commands/scenario/scenario.list.d.ts +44 -0
  16. package/esm/commands/scenario/scenario.list.d.ts.map +1 -0
  17. package/esm/commands/scenario/scenario.list.js +49 -0
  18. package/esm/commands/scenario/scenario.update.d.ts +43 -0
  19. package/esm/commands/scenario/scenario.update.d.ts.map +1 -0
  20. package/esm/commands/scenario/scenario.update.js +53 -0
  21. package/esm/contracts/scenario.d.ts +18 -0
  22. package/esm/contracts/scenario.d.ts.map +1 -0
  23. package/esm/contracts/scenario.js +20 -0
  24. package/package.json +1 -1
  25. package/script/commands/index.d.ts +5 -0
  26. package/script/commands/index.d.ts.map +1 -1
  27. package/script/commands/index.js +6 -0
  28. package/script/commands/scenario/scenario.create.d.ts +41 -0
  29. package/script/commands/scenario/scenario.create.d.ts.map +1 -0
  30. package/script/commands/scenario/scenario.create.js +48 -0
  31. package/script/commands/scenario/scenario.delete.d.ts +37 -0
  32. package/script/commands/scenario/scenario.delete.d.ts.map +1 -0
  33. package/script/commands/scenario/scenario.delete.js +51 -0
  34. package/script/commands/scenario/scenario.fetch.d.ts +53 -0
  35. package/script/commands/scenario/scenario.fetch.d.ts.map +1 -0
  36. package/script/commands/scenario/scenario.fetch.js +72 -0
  37. package/script/commands/scenario/scenario.list.d.ts +44 -0
  38. package/script/commands/scenario/scenario.list.d.ts.map +1 -0
  39. package/script/commands/scenario/scenario.list.js +53 -0
  40. package/script/commands/scenario/scenario.update.d.ts +43 -0
  41. package/script/commands/scenario/scenario.update.d.ts.map +1 -0
  42. package/script/commands/scenario/scenario.update.js +57 -0
  43. package/script/contracts/scenario.d.ts +18 -0
  44. package/script/contracts/scenario.d.ts.map +1 -0
  45. package/script/contracts/scenario.js +23 -0
@@ -0,0 +1,53 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { ScenarioSchema } from "../../contracts/scenario.js";
3
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
+ /**
5
+ * Update a scenario
6
+ */
7
+ export class ScenarioUpdateCommand extends Command {
8
+ constructor() {
9
+ super(...arguments);
10
+ /**
11
+ * Whether the command should retry on failure
12
+ */
13
+ Object.defineProperty(this, "retryOnFailure", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: false
18
+ });
19
+ }
20
+ /**
21
+ * Get the method
22
+ */
23
+ getMethod() {
24
+ return "PATCH";
25
+ }
26
+ /**
27
+ * Get the base url
28
+ */
29
+ getBaseUrl() {
30
+ return "https://scenario-2.api.flowcore.io";
31
+ }
32
+ /**
33
+ * Get the body
34
+ */
35
+ getBody() {
36
+ return {
37
+ ...(this.input.description && { description: this.input.description }),
38
+ ...(this.input.displayName && { displayName: this.input.displayName }),
39
+ };
40
+ }
41
+ /**
42
+ * Get the path
43
+ */
44
+ getPath() {
45
+ return `/api/v1/scenarios/${this.input.scenarioId}`;
46
+ }
47
+ /**
48
+ * Parse the response
49
+ */
50
+ parseResponse(rawResponse) {
51
+ return parseResponseHelper(ScenarioSchema, rawResponse);
52
+ }
53
+ }
@@ -0,0 +1,18 @@
1
+ import { type Static, type TObject, type TOptional, type TString } from "@sinclair/typebox";
2
+ /**
3
+ * The schema for an event type
4
+ */
5
+ export declare const ScenarioSchema: TObject<{
6
+ id: TString;
7
+ tenantId: TString;
8
+ name: TString;
9
+ displayName: TOptional<TString>;
10
+ description: TOptional<TString>;
11
+ createdAt: TString;
12
+ updatedAt: TString;
13
+ }>;
14
+ /**
15
+ * The type for an event type
16
+ */
17
+ export type Scenario = Static<typeof ScenarioSchema>;
18
+ //# sourceMappingURL=scenario.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/contracts/scenario.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEjG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC;IACnC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;CACnB,CAeC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ /**
3
+ * The schema for an event type
4
+ */
5
+ export const ScenarioSchema = Type.Object({
6
+ /** Unique identifier for the event type */
7
+ id: Type.String(),
8
+ /** ID of the tenant that owns this event type */
9
+ tenantId: Type.String(),
10
+ /** Name of the event type */
11
+ name: Type.String(),
12
+ /** Display name of the event type */
13
+ displayName: Type.Optional(Type.String()),
14
+ /** Description of the event type */
15
+ description: Type.Optional(Type.String()),
16
+ /** Creation timestamp */
17
+ createdAt: Type.String(),
18
+ /** Last update timestamp */
19
+ updatedAt: Type.String(),
20
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/sdk",
3
- "version": "1.47.1",
3
+ "version": "1.49.0",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -58,4 +58,9 @@ export * from "./security/pat.exchange.js";
58
58
  export * from "./security/pat.get.js";
59
59
  export * from "./security/pat.list.js";
60
60
  export * from "./security/permissions.list.js";
61
+ export * from "./scenario/scenario.create.js";
62
+ export * from "./scenario/scenario.delete.js";
63
+ export * from "./scenario/scenario.fetch.js";
64
+ export * from "./scenario/scenario.list.js";
65
+ export * from "./scenario/scenario.update.js";
61
66
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AACA,cAAc,2CAA2C,CAAA;AACzD,cAAc,0CAA0C,CAAA;AACxD,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yCAAyC,CAAA;AAGvD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AAGzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAG3C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yCAAyC,CAAA;AACvD,cAAc,iCAAiC,CAAA;AAG/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CA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c,kDAAkD,CAAA;AAChE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,mDAAmD,CAAA;AAGjE,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAG9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA"}
@@ -86,3 +86,9 @@ __exportStar(require("./security/pat.exchange.js"), exports);
86
86
  __exportStar(require("./security/pat.get.js"), exports);
87
87
  __exportStar(require("./security/pat.list.js"), exports);
88
88
  __exportStar(require("./security/permissions.list.js"), exports);
89
+ // Scenario
90
+ __exportStar(require("./scenario/scenario.create.js"), exports);
91
+ __exportStar(require("./scenario/scenario.delete.js"), exports);
92
+ __exportStar(require("./scenario/scenario.fetch.js"), exports);
93
+ __exportStar(require("./scenario/scenario.list.js"), exports);
94
+ __exportStar(require("./scenario/scenario.update.js"), exports);
@@ -0,0 +1,41 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type Scenario } from "../../contracts/scenario.js";
3
+ /**
4
+ * The input for the scenario create command
5
+ */
6
+ export interface ScenarioCreateInput {
7
+ /** The tenant id */
8
+ tenantId: string;
9
+ /** The name of the scenario */
10
+ name: string;
11
+ /** The description of the scenario */
12
+ description?: string;
13
+ /** The display name of the scenario */
14
+ displayName?: string;
15
+ }
16
+ /**
17
+ * Create a scenario
18
+ */
19
+ export declare class ScenarioCreateCommand extends Command<ScenarioCreateInput, Scenario> {
20
+ /**
21
+ * Whether the command should retry on failure
22
+ */
23
+ protected retryOnFailure: boolean;
24
+ /**
25
+ * Get the method
26
+ */
27
+ protected getMethod(): string;
28
+ /**
29
+ * Get the base url
30
+ */
31
+ protected getBaseUrl(): string;
32
+ /**
33
+ * Get the path
34
+ */
35
+ protected getPath(): string;
36
+ /**
37
+ * Parse the response
38
+ */
39
+ protected parseResponse(rawResponse: unknown): Scenario;
40
+ }
41
+ //# sourceMappingURL=scenario.create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.create.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,6BAA6B,CAAA;AAG3E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScenarioCreateCommand = void 0;
4
+ const command_js_1 = require("../../common/command.js");
5
+ const scenario_js_1 = require("../../contracts/scenario.js");
6
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
7
+ /**
8
+ * Create a scenario
9
+ */
10
+ class ScenarioCreateCommand extends command_js_1.Command {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Whether the command should retry on failure
15
+ */
16
+ Object.defineProperty(this, "retryOnFailure", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: false
21
+ });
22
+ }
23
+ /**
24
+ * Get the method
25
+ */
26
+ getMethod() {
27
+ return "POST";
28
+ }
29
+ /**
30
+ * Get the base url
31
+ */
32
+ getBaseUrl() {
33
+ return "https://scenario-2.api.flowcore.io";
34
+ }
35
+ /**
36
+ * Get the path
37
+ */
38
+ getPath() {
39
+ return `/api/v1/scenarios`;
40
+ }
41
+ /**
42
+ * Parse the response
43
+ */
44
+ parseResponse(rawResponse) {
45
+ return (0, parse_response_helper_js_1.parseResponseHelper)(scenario_js_1.ScenarioSchema, rawResponse);
46
+ }
47
+ }
48
+ exports.ScenarioCreateCommand = ScenarioCreateCommand;
@@ -0,0 +1,37 @@
1
+ import { Command } from "../../common/command.js";
2
+ /**
3
+ * The input for the scenario delete command
4
+ */
5
+ export interface ScenarioDeleteInput {
6
+ /** The scenario id */
7
+ scenarioId: string;
8
+ }
9
+ export interface ScenarioDeleteOutput {
10
+ success: boolean;
11
+ }
12
+ /**
13
+ * Delete a scenario
14
+ */
15
+ export declare class ScenarioDeleteCommand extends Command<ScenarioDeleteInput, ScenarioDeleteOutput> {
16
+ /**
17
+ * Whether the command should retry on failure
18
+ */
19
+ protected retryOnFailure: boolean;
20
+ /**
21
+ * Get the method
22
+ */
23
+ protected getMethod(): string;
24
+ /**
25
+ * Get the base url
26
+ */
27
+ protected getBaseUrl(): string;
28
+ /**
29
+ * Get the path
30
+ */
31
+ protected getPath(): string;
32
+ /**
33
+ * Parse the response
34
+ */
35
+ protected parseResponse(rawResponse: unknown): ScenarioDeleteOutput;
36
+ }
37
+ //# sourceMappingURL=scenario.delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;CACjB;AAMD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;IAC3F;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,oBAAoB;CAG7E"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScenarioDeleteCommand = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const command_js_1 = require("../../common/command.js");
6
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
7
+ const ScenarioDeleteOutputSchema = typebox_1.Type.Object({
8
+ success: typebox_1.Type.Boolean(),
9
+ });
10
+ /**
11
+ * Delete a scenario
12
+ */
13
+ class ScenarioDeleteCommand extends command_js_1.Command {
14
+ constructor() {
15
+ super(...arguments);
16
+ /**
17
+ * Whether the command should retry on failure
18
+ */
19
+ Object.defineProperty(this, "retryOnFailure", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: false
24
+ });
25
+ }
26
+ /**
27
+ * Get the method
28
+ */
29
+ getMethod() {
30
+ return "DELETE";
31
+ }
32
+ /**
33
+ * Get the base url
34
+ */
35
+ getBaseUrl() {
36
+ return "https://scenario-2.api.flowcore.io";
37
+ }
38
+ /**
39
+ * Get the path
40
+ */
41
+ getPath() {
42
+ return `/api/v1/scenarios/${this.input.scenarioId}`;
43
+ }
44
+ /**
45
+ * Parse the response
46
+ */
47
+ parseResponse(rawResponse) {
48
+ return (0, parse_response_helper_js_1.parseResponseHelper)(ScenarioDeleteOutputSchema, rawResponse);
49
+ }
50
+ }
51
+ exports.ScenarioDeleteCommand = ScenarioDeleteCommand;
@@ -0,0 +1,53 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type Scenario } from "../../contracts/scenario.js";
3
+ import type { ClientError } from "../../exceptions/client-error.js";
4
+ export interface ScenarioFetchByIdInput {
5
+ /** The scenario id */
6
+ scenarioId: string;
7
+ /** The tenant id */
8
+ tenantId?: never;
9
+ /** scenario name */
10
+ name?: never;
11
+ }
12
+ export interface ScenarioFetchByNameInput {
13
+ /** The scenario id */
14
+ scenarioId?: never;
15
+ /** The tenant id */
16
+ tenantId: string;
17
+ /** scenario name */
18
+ name: string;
19
+ }
20
+ /**
21
+ * The input for the scenario fetch command
22
+ */
23
+ export type ScenarioFetchInput = ScenarioFetchByIdInput | ScenarioFetchByNameInput;
24
+ /**
25
+ * fetch a scenario
26
+ */
27
+ export declare class ScenarioFetchCommand extends Command<ScenarioFetchInput, Scenario> {
28
+ /**
29
+ * Whether the command should retry on failure
30
+ */
31
+ protected retryOnFailure: boolean;
32
+ /**
33
+ * Get the method
34
+ */
35
+ protected getMethod(): string;
36
+ /**
37
+ * Get the base url
38
+ */
39
+ protected getBaseUrl(): string;
40
+ /**
41
+ * Get the path
42
+ */
43
+ protected getPath(): string;
44
+ /**
45
+ * Parse the response
46
+ */
47
+ protected parseResponse(rawResponse: unknown): Scenario;
48
+ /**
49
+ * Handle the client error
50
+ */
51
+ protected handleClientError(error: ClientError): void;
52
+ }
53
+ //# sourceMappingURL=scenario.fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,6BAA6B,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAInE,MAAM,WAAW,sBAAsB;IACrC,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,oBAAoB;IACpB,IAAI,CAAC,EAAE,KAAK,CAAA;CACb;AAED,MAAM,WAAW,wBAAwB;IACvC,sBAAsB;IACtB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;CACb;AAUD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,wBAAwB,CAAA;AAElF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC7E;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAOpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;IAIhE;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAU/D"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScenarioFetchCommand = void 0;
4
+ const command_js_1 = require("../../common/command.js");
5
+ const scenario_js_1 = require("../../contracts/scenario.js");
6
+ const not_found_js_1 = require("../../exceptions/not-found.js");
7
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
+ function isScenarioFetchByIdInput(input) {
9
+ return "scenarioId" in input;
10
+ }
11
+ function isScenarioFetchByNameAndTenantInput(input) {
12
+ return "tenantId" in input;
13
+ }
14
+ /**
15
+ * fetch a scenario
16
+ */
17
+ class ScenarioFetchCommand extends command_js_1.Command {
18
+ constructor() {
19
+ super(...arguments);
20
+ /**
21
+ * Whether the command should retry on failure
22
+ */
23
+ Object.defineProperty(this, "retryOnFailure", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: false
28
+ });
29
+ }
30
+ /**
31
+ * Get the method
32
+ */
33
+ getMethod() {
34
+ return "GET";
35
+ }
36
+ /**
37
+ * Get the base url
38
+ */
39
+ getBaseUrl() {
40
+ return "https://scenario-2.api.flowcore.io";
41
+ }
42
+ /**
43
+ * Get the path
44
+ */
45
+ getPath() {
46
+ if (this.input.scenarioId) {
47
+ return `/api/v1/scenarios/${this.input.scenarioId}`;
48
+ }
49
+ return `/api/v1/scenarios/tenant/${this.input.tenantId}/name/${this.input.name}`;
50
+ }
51
+ /**
52
+ * Parse the response
53
+ */
54
+ parseResponse(rawResponse) {
55
+ return (0, parse_response_helper_js_1.parseResponseHelper)(scenario_js_1.ScenarioSchema, rawResponse);
56
+ }
57
+ /**
58
+ * Handle the client error
59
+ */
60
+ handleClientError(error) {
61
+ if (error.status === 404) {
62
+ if (isScenarioFetchByIdInput(this.input)) {
63
+ throw new not_found_js_1.NotFoundException("Scenario", { id: this.input.scenarioId });
64
+ }
65
+ else if (isScenarioFetchByNameAndTenantInput(this.input)) {
66
+ throw new not_found_js_1.NotFoundException("Scenario", { name: this.input.name, tenantId: this.input.tenantId });
67
+ }
68
+ }
69
+ throw error;
70
+ }
71
+ }
72
+ exports.ScenarioFetchCommand = ScenarioFetchCommand;
@@ -0,0 +1,44 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type Scenario } from "../../contracts/scenario.js";
3
+ /**
4
+ * The input for the scenario create command
5
+ */
6
+ export interface ScenarioListInput {
7
+ /** The tenant id */
8
+ tenantId: string;
9
+ }
10
+ /**
11
+ * The output for the scenario list command
12
+ */
13
+ export interface ScenarioListOutput {
14
+ /** The tenant id */
15
+ id: string;
16
+ /** the scenarios in that tenant */
17
+ scenarios: Scenario[];
18
+ }
19
+ /**
20
+ * list all scenarios
21
+ */
22
+ export declare class ScenarioListCommand extends Command<ScenarioListInput, ScenarioListOutput> {
23
+ /**
24
+ * Whether the command should retry on failure
25
+ */
26
+ protected retryOnFailure: boolean;
27
+ /**
28
+ * Get the method
29
+ */
30
+ protected getMethod(): string;
31
+ /**
32
+ * Get the base url
33
+ */
34
+ protected getBaseUrl(): string;
35
+ /**
36
+ * Get the path
37
+ */
38
+ protected getPath(): string;
39
+ /**
40
+ * Parse the response
41
+ */
42
+ protected parseResponse(rawResponse: unknown): ScenarioListOutput;
43
+ }
44
+ //# sourceMappingURL=scenario.list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.list.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,6BAA6B,CAAA;AAG3E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,mCAAmC;IACnC,SAAS,EAAE,QAAQ,EAAE,CAAA;CACtB;AAOD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,OAAO,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IACrF;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,kBAAkB;CAG3E"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScenarioListCommand = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ const command_js_1 = require("../../common/command.js");
6
+ const scenario_js_1 = require("../../contracts/scenario.js");
7
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
+ const ScenarioListOutputSchema = typebox_1.Type.Object({
9
+ id: typebox_1.Type.String(),
10
+ scenarios: typebox_1.Type.Array(scenario_js_1.ScenarioSchema),
11
+ });
12
+ /**
13
+ * list all scenarios
14
+ */
15
+ class ScenarioListCommand extends command_js_1.Command {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * Whether the command should retry on failure
20
+ */
21
+ Object.defineProperty(this, "retryOnFailure", {
22
+ enumerable: true,
23
+ configurable: true,
24
+ writable: true,
25
+ value: false
26
+ });
27
+ }
28
+ /**
29
+ * Get the method
30
+ */
31
+ getMethod() {
32
+ return "GET";
33
+ }
34
+ /**
35
+ * Get the base url
36
+ */
37
+ getBaseUrl() {
38
+ return "https://scenario-2.api.flowcore.io";
39
+ }
40
+ /**
41
+ * Get the path
42
+ */
43
+ getPath() {
44
+ return `/api/v1/scenarios/tenant/${this.input.tenantId}`;
45
+ }
46
+ /**
47
+ * Parse the response
48
+ */
49
+ parseResponse(rawResponse) {
50
+ return (0, parse_response_helper_js_1.parseResponseHelper)(ScenarioListOutputSchema, rawResponse);
51
+ }
52
+ }
53
+ exports.ScenarioListCommand = ScenarioListCommand;
@@ -0,0 +1,43 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type Scenario } from "../../contracts/scenario.js";
3
+ /**
4
+ * The input for the scenario update command
5
+ */
6
+ export interface ScenarioUpdateInput {
7
+ /** The scenario id */
8
+ scenarioId: string;
9
+ /** The description of the scenario */
10
+ description?: string;
11
+ /** The display name of the scenario */
12
+ displayName?: string;
13
+ }
14
+ /**
15
+ * Update a scenario
16
+ */
17
+ export declare class ScenarioUpdateCommand extends Command<ScenarioUpdateInput, Scenario> {
18
+ /**
19
+ * Whether the command should retry on failure
20
+ */
21
+ protected retryOnFailure: boolean;
22
+ /**
23
+ * Get the method
24
+ */
25
+ protected getMethod(): string;
26
+ /**
27
+ * Get the base url
28
+ */
29
+ protected getBaseUrl(): string;
30
+ /**
31
+ * Get the body
32
+ */
33
+ protected getBody(): Record<string, unknown> | Array<unknown> | undefined;
34
+ /**
35
+ * Get the path
36
+ */
37
+ protected getPath(): string;
38
+ /**
39
+ * Parse the response
40
+ */
41
+ protected parseResponse(rawResponse: unknown): Scenario;
42
+ }
43
+ //# sourceMappingURL=scenario.update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenario.update.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,6BAA6B,CAAA;AAG3E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;IACH,UAAmB,cAAc,EAAE,OAAO,CAAQ;IAElD;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,SAAS;IAOlF;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScenarioUpdateCommand = void 0;
4
+ const command_js_1 = require("../../common/command.js");
5
+ const scenario_js_1 = require("../../contracts/scenario.js");
6
+ const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
7
+ /**
8
+ * Update a scenario
9
+ */
10
+ class ScenarioUpdateCommand extends command_js_1.Command {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Whether the command should retry on failure
15
+ */
16
+ Object.defineProperty(this, "retryOnFailure", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: false
21
+ });
22
+ }
23
+ /**
24
+ * Get the method
25
+ */
26
+ getMethod() {
27
+ return "PATCH";
28
+ }
29
+ /**
30
+ * Get the base url
31
+ */
32
+ getBaseUrl() {
33
+ return "https://scenario-2.api.flowcore.io";
34
+ }
35
+ /**
36
+ * Get the body
37
+ */
38
+ getBody() {
39
+ return {
40
+ ...(this.input.description && { description: this.input.description }),
41
+ ...(this.input.displayName && { displayName: this.input.displayName }),
42
+ };
43
+ }
44
+ /**
45
+ * Get the path
46
+ */
47
+ getPath() {
48
+ return `/api/v1/scenarios/${this.input.scenarioId}`;
49
+ }
50
+ /**
51
+ * Parse the response
52
+ */
53
+ parseResponse(rawResponse) {
54
+ return (0, parse_response_helper_js_1.parseResponseHelper)(scenario_js_1.ScenarioSchema, rawResponse);
55
+ }
56
+ }
57
+ exports.ScenarioUpdateCommand = ScenarioUpdateCommand;