@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.49.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.48.0...v1.49.0) (2025-05-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * **scenario:** :tada: enhance scenario fetch command to support fetching by tenantId and name ([c31bfb8](https://github.com/flowcore-io/flowcore-sdk/commit/c31bfb87fe99b1944886c0436ea94cadffbd2571))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **scenario:** :art: clean up whitespace in scenario fetch and test files ([f8248d6](https://github.com/flowcore-io/flowcore-sdk/commit/f8248d6f9ba91544f0b7088a254153456084c4e4))
14
+
15
+ ## [1.48.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.47.1...v1.48.0) (2025-05-14)
16
+
17
+
18
+ ### Features
19
+
20
+ * **scenario:** :tada: add create and list scenario commands with schema ([3b6433e](https://github.com/flowcore-io/flowcore-sdk/commit/3b6433ebb7b85caffc8eae8d99d60a4adc1b96a1))
21
+ * **scenario:** :tada: add delete and update scenario commands with schemas ([452a88c](https://github.com/flowcore-io/flowcore-sdk/commit/452a88c96cb71069580bbee23dd1f472b69a6439))
22
+ * **scenario:** :tada: add fetch scenario command with input and output interfaces ([84a2bba](https://github.com/flowcore-io/flowcore-sdk/commit/84a2bba15dc2ee446c003e2454db928d452afbc5))
23
+ * **scenario:** :tada: add scenario commands for create, fetch, list, and update ([034d1dd](https://github.com/flowcore-io/flowcore-sdk/commit/034d1ddd6e04f5071b76e932120c7ba24f3c00ba))
24
+
3
25
  ## [1.47.1](https://github.com/flowcore-io/flowcore-sdk/compare/v1.47.0...v1.47.1) (2025-05-07)
4
26
 
5
27
 
package/README.md CHANGED
@@ -15,6 +15,7 @@ This is the Flowcore SDK, a TypeScript library for interacting with the Flowcore
15
15
  - [Data Core Operations](#data-core-operations)
16
16
  - [Flow Type Operations](#flow-type-operations)
17
17
  - [Event Type Operations](#event-type-operations)
18
+ - [Scenario Operations](#scenario-operations)
18
19
  - [Notifications](#notifications)
19
20
 
20
21
  ## Installation
@@ -655,6 +656,119 @@ const result = await client.execute(command)
655
656
  > **Note**: If `waitForDelete` or `waitForTruncate` is set to `true`, the command will wait up to 25 seconds for the operation to complete.
656
657
  > **Important**: Event Type deletion and truncation operations require bearer token authentication.
657
658
 
659
+ #### Remove Sensitive Data from an Event Type
660
+
661
+ ```typescript
662
+ import { EventTypeRemoveSensitiveDataCommand, FlowcoreClient } from "@flowcore/sdk"
663
+
664
+ const command = new EventTypeRemoveSensitiveDataCommand({
665
+ eventTypeId: "your-event-type-id",
666
+ application: "my-application-name",
667
+ parentKey: "user",
668
+ key: "email",
669
+ type: "scramble" // or "remove"
670
+ })
671
+
672
+ const result = await client.execute(command)
673
+ // Returns:
674
+ // {
675
+ // success: boolean; // Whether the operation was successful
676
+ // id: string; // ID of the sensitive data removal record
677
+ // }
678
+ ```
679
+
680
+ > **Note**: The `type` parameter determines how sensitive data is handled. Use `scramble` to replace the data with a masked version, or `remove` to completely delete it.
681
+ > **Important**: Sensitive data removal operations require bearer token authentication.
682
+ > **WARNING**: This operation is NON-REVERSIBLE. Once sensitive data has been removed or scrambled, it cannot be recovered. Make sure you have backups before proceeding, as this action permanently alters your data.
683
+
684
+ ### Scenario Operations
685
+
686
+ Scenario operations allow you to manage scenarios in your Flowcore tenant.
687
+
688
+ > **Important**: Scenario operations require bearer token authentication and cannot be performed using API key authentication.
689
+
690
+ #### Create a Scenario
691
+
692
+ ```typescript
693
+ import { ScenarioCreateCommand, FlowcoreClient } from "@flowcore/sdk"
694
+
695
+ const command = new ScenarioCreateCommand({
696
+ tenantId: "your-tenant-id",
697
+ name: "my-scenario",
698
+ description: "A test scenario", // Optional
699
+ displayName: "My Test Scenario" // Optional
700
+ })
701
+
702
+ const result = await client.execute(command)
703
+ // Returns the created Scenario object:
704
+ // {
705
+ // id: string;
706
+ // tenantId: string;
707
+ // name: string;
708
+ // displayName?: string;
709
+ // description?: string;
710
+ // createdAt: string;
711
+ // updatedAt: string;
712
+ // }
713
+ ```
714
+
715
+ #### Fetch a Scenario
716
+
717
+ ```typescript
718
+ import { ScenarioFetchCommand, FlowcoreClient } from "@flowcore/sdk"
719
+
720
+ const command = new ScenarioFetchCommand({
721
+ scenarioId: "your-scenario-id"
722
+ })
723
+
724
+ const scenario = await client.execute(command)
725
+ ```
726
+
727
+ #### List Scenarios
728
+
729
+ ```typescript
730
+ import { ScenarioListCommand, FlowcoreClient } from "@flowcore/sdk"
731
+
732
+ const command = new ScenarioListCommand({
733
+ tenantId: "your-tenant-id"
734
+ })
735
+
736
+ const result = await client.execute(command)
737
+ // Returns:
738
+ // {
739
+ // id: string; // The tenant ID
740
+ // scenarios: Scenario[]; // Array of scenario objects
741
+ // }
742
+ ```
743
+
744
+ #### Update a Scenario
745
+
746
+ ```typescript
747
+ import { ScenarioUpdateCommand, FlowcoreClient } from "@flowcore/sdk"
748
+
749
+ const command = new ScenarioUpdateCommand({
750
+ tenantId: "your-tenant-id",
751
+ scenarioId: "your-scenario-id",
752
+ description: "Updated description", // Optional
753
+ displayName: "Updated Display Name" // Optional
754
+ })
755
+
756
+ const updatedScenario = await client.execute(command)
757
+ ```
758
+
759
+ #### Delete a Scenario
760
+
761
+ ```typescript
762
+ import { ScenarioDeleteCommand, FlowcoreClient } from "@flowcore/sdk"
763
+
764
+ const command = new ScenarioDeleteCommand({
765
+ scenarioId: "your-scenario-id"
766
+ })
767
+
768
+ const result = await client.execute(command)
769
+ // Returns: { success: boolean }
770
+ ```
771
+
658
772
  ### Event Ingestion Operations
659
773
 
660
774
  The SDK provides commands for ingesting events into Flowcore event types.
@@ -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,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,yCAAyC,CAAA;AACvD,cA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AA;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"}
@@ -70,3 +70,9 @@ export * from "./security/pat.exchange.js";
70
70
  export * from "./security/pat.get.js";
71
71
  export * from "./security/pat.list.js";
72
72
  export * from "./security/permissions.list.js";
73
+ // Scenario
74
+ export * from "./scenario/scenario.create.js";
75
+ export * from "./scenario/scenario.delete.js";
76
+ export * from "./scenario/scenario.fetch.js";
77
+ export * from "./scenario/scenario.list.js";
78
+ export * from "./scenario/scenario.update.js";
@@ -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,44 @@
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
+ * Create a scenario
6
+ */
7
+ export class ScenarioCreateCommand 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 "POST";
25
+ }
26
+ /**
27
+ * Get the base url
28
+ */
29
+ getBaseUrl() {
30
+ return "https://scenario-2.api.flowcore.io";
31
+ }
32
+ /**
33
+ * Get the path
34
+ */
35
+ getPath() {
36
+ return `/api/v1/scenarios`;
37
+ }
38
+ /**
39
+ * Parse the response
40
+ */
41
+ parseResponse(rawResponse) {
42
+ return parseResponseHelper(ScenarioSchema, rawResponse);
43
+ }
44
+ }
@@ -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,47 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
+ const ScenarioDeleteOutputSchema = Type.Object({
5
+ success: Type.Boolean(),
6
+ });
7
+ /**
8
+ * Delete a scenario
9
+ */
10
+ export class ScenarioDeleteCommand extends 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 "DELETE";
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/${this.input.scenarioId}`;
40
+ }
41
+ /**
42
+ * Parse the response
43
+ */
44
+ parseResponse(rawResponse) {
45
+ return parseResponseHelper(ScenarioDeleteOutputSchema, rawResponse);
46
+ }
47
+ }
@@ -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,68 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { ScenarioSchema } from "../../contracts/scenario.js";
3
+ import { NotFoundException } from "../../exceptions/not-found.js";
4
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
+ function isScenarioFetchByIdInput(input) {
6
+ return "scenarioId" in input;
7
+ }
8
+ function isScenarioFetchByNameAndTenantInput(input) {
9
+ return "tenantId" in input;
10
+ }
11
+ /**
12
+ * fetch a scenario
13
+ */
14
+ export class ScenarioFetchCommand extends Command {
15
+ constructor() {
16
+ super(...arguments);
17
+ /**
18
+ * Whether the command should retry on failure
19
+ */
20
+ Object.defineProperty(this, "retryOnFailure", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: false
25
+ });
26
+ }
27
+ /**
28
+ * Get the method
29
+ */
30
+ getMethod() {
31
+ return "GET";
32
+ }
33
+ /**
34
+ * Get the base url
35
+ */
36
+ getBaseUrl() {
37
+ return "https://scenario-2.api.flowcore.io";
38
+ }
39
+ /**
40
+ * Get the path
41
+ */
42
+ getPath() {
43
+ if (this.input.scenarioId) {
44
+ return `/api/v1/scenarios/${this.input.scenarioId}`;
45
+ }
46
+ return `/api/v1/scenarios/tenant/${this.input.tenantId}/name/${this.input.name}`;
47
+ }
48
+ /**
49
+ * Parse the response
50
+ */
51
+ parseResponse(rawResponse) {
52
+ return parseResponseHelper(ScenarioSchema, rawResponse);
53
+ }
54
+ /**
55
+ * Handle the client error
56
+ */
57
+ handleClientError(error) {
58
+ if (error.status === 404) {
59
+ if (isScenarioFetchByIdInput(this.input)) {
60
+ throw new NotFoundException("Scenario", { id: this.input.scenarioId });
61
+ }
62
+ else if (isScenarioFetchByNameAndTenantInput(this.input)) {
63
+ throw new NotFoundException("Scenario", { name: this.input.name, tenantId: this.input.tenantId });
64
+ }
65
+ }
66
+ throw error;
67
+ }
68
+ }
@@ -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,49 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { ScenarioSchema } from "../../contracts/scenario.js";
4
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
+ const ScenarioListOutputSchema = Type.Object({
6
+ id: Type.String(),
7
+ scenarios: Type.Array(ScenarioSchema),
8
+ });
9
+ /**
10
+ * list all scenarios
11
+ */
12
+ export class ScenarioListCommand extends Command {
13
+ constructor() {
14
+ super(...arguments);
15
+ /**
16
+ * Whether the command should retry on failure
17
+ */
18
+ Object.defineProperty(this, "retryOnFailure", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: false
23
+ });
24
+ }
25
+ /**
26
+ * Get the method
27
+ */
28
+ getMethod() {
29
+ return "GET";
30
+ }
31
+ /**
32
+ * Get the base url
33
+ */
34
+ getBaseUrl() {
35
+ return "https://scenario-2.api.flowcore.io";
36
+ }
37
+ /**
38
+ * Get the path
39
+ */
40
+ getPath() {
41
+ return `/api/v1/scenarios/tenant/${this.input.tenantId}`;
42
+ }
43
+ /**
44
+ * Parse the response
45
+ */
46
+ parseResponse(rawResponse) {
47
+ return parseResponseHelper(ScenarioListOutputSchema, rawResponse);
48
+ }
49
+ }
@@ -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"}