@flowcore/sdk 1.52.0 → 1.54.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 (99) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +2 -2
  3. package/esm/commands/api-key/api-key.create.d.ts +20 -23
  4. package/esm/commands/api-key/api-key.create.d.ts.map +1 -1
  5. package/esm/commands/api-key/api-key.create.js +21 -62
  6. package/esm/commands/api-key/api-key.delete.d.ts +22 -12
  7. package/esm/commands/api-key/api-key.delete.d.ts.map +1 -1
  8. package/esm/commands/api-key/api-key.delete.js +27 -41
  9. package/esm/commands/api-key/api-key.edit.d.ts +41 -0
  10. package/esm/commands/api-key/api-key.edit.d.ts.map +1 -0
  11. package/esm/commands/api-key/api-key.edit.js +40 -0
  12. package/esm/commands/api-key/api-key.list.d.ts +20 -8
  13. package/esm/commands/api-key/api-key.list.d.ts.map +1 -1
  14. package/esm/commands/api-key/api-key.list.js +27 -36
  15. package/esm/commands/index.d.ts +3 -0
  16. package/esm/commands/index.d.ts.map +1 -1
  17. package/esm/commands/index.js +3 -0
  18. package/esm/commands/secret/secret.create.d.ts +23 -8
  19. package/esm/commands/secret/secret.create.d.ts.map +1 -1
  20. package/esm/commands/secret/secret.create.js +27 -39
  21. package/esm/commands/secret/secret.delete.d.ts +20 -8
  22. package/esm/commands/secret/secret.delete.d.ts.map +1 -1
  23. package/esm/commands/secret/secret.delete.js +27 -41
  24. package/esm/commands/secret/secret.edit.d.ts +45 -0
  25. package/esm/commands/secret/secret.edit.d.ts.map +1 -0
  26. package/esm/commands/secret/secret.edit.js +40 -0
  27. package/esm/commands/secret/secret.list.d.ts +20 -7
  28. package/esm/commands/secret/secret.list.d.ts.map +1 -1
  29. package/esm/commands/secret/secret.list.js +27 -41
  30. package/esm/commands/variable/variable.create.d.ts +21 -7
  31. package/esm/commands/variable/variable.create.d.ts.map +1 -1
  32. package/esm/commands/variable/variable.create.js +26 -44
  33. package/esm/commands/variable/variable.delete.d.ts +20 -8
  34. package/esm/commands/variable/variable.delete.d.ts.map +1 -1
  35. package/esm/commands/variable/variable.delete.js +27 -44
  36. package/esm/commands/variable/variable.edit.d.ts +45 -0
  37. package/esm/commands/variable/variable.edit.d.ts.map +1 -0
  38. package/esm/commands/variable/variable.edit.js +40 -0
  39. package/esm/commands/variable/variable.list.d.ts +19 -7
  40. package/esm/commands/variable/variable.list.d.ts.map +1 -1
  41. package/esm/commands/variable/variable.list.js +27 -47
  42. package/esm/contracts/api-key.d.ts +22 -1
  43. package/esm/contracts/api-key.d.ts.map +1 -1
  44. package/esm/contracts/api-key.js +17 -0
  45. package/esm/contracts/secret.d.ts +16 -0
  46. package/esm/contracts/secret.d.ts.map +1 -0
  47. package/esm/contracts/secret.js +11 -0
  48. package/esm/contracts/variable.d.ts +5 -1
  49. package/esm/contracts/variable.d.ts.map +1 -1
  50. package/esm/contracts/variable.js +4 -0
  51. package/package.json +1 -1
  52. package/script/commands/api-key/api-key.create.d.ts +20 -23
  53. package/script/commands/api-key/api-key.create.d.ts.map +1 -1
  54. package/script/commands/api-key/api-key.create.js +21 -62
  55. package/script/commands/api-key/api-key.delete.d.ts +22 -12
  56. package/script/commands/api-key/api-key.delete.d.ts.map +1 -1
  57. package/script/commands/api-key/api-key.delete.js +27 -41
  58. package/script/commands/api-key/api-key.edit.d.ts +41 -0
  59. package/script/commands/api-key/api-key.edit.d.ts.map +1 -0
  60. package/script/commands/api-key/api-key.edit.js +44 -0
  61. package/script/commands/api-key/api-key.list.d.ts +20 -8
  62. package/script/commands/api-key/api-key.list.d.ts.map +1 -1
  63. package/script/commands/api-key/api-key.list.js +27 -36
  64. package/script/commands/index.d.ts +3 -0
  65. package/script/commands/index.d.ts.map +1 -1
  66. package/script/commands/index.js +3 -0
  67. package/script/commands/secret/secret.create.d.ts +23 -8
  68. package/script/commands/secret/secret.create.d.ts.map +1 -1
  69. package/script/commands/secret/secret.create.js +27 -39
  70. package/script/commands/secret/secret.delete.d.ts +20 -8
  71. package/script/commands/secret/secret.delete.d.ts.map +1 -1
  72. package/script/commands/secret/secret.delete.js +27 -41
  73. package/script/commands/secret/secret.edit.d.ts +45 -0
  74. package/script/commands/secret/secret.edit.d.ts.map +1 -0
  75. package/script/commands/secret/secret.edit.js +44 -0
  76. package/script/commands/secret/secret.list.d.ts +20 -7
  77. package/script/commands/secret/secret.list.d.ts.map +1 -1
  78. package/script/commands/secret/secret.list.js +27 -41
  79. package/script/commands/variable/variable.create.d.ts +21 -7
  80. package/script/commands/variable/variable.create.d.ts.map +1 -1
  81. package/script/commands/variable/variable.create.js +26 -44
  82. package/script/commands/variable/variable.delete.d.ts +20 -8
  83. package/script/commands/variable/variable.delete.d.ts.map +1 -1
  84. package/script/commands/variable/variable.delete.js +27 -44
  85. package/script/commands/variable/variable.edit.d.ts +45 -0
  86. package/script/commands/variable/variable.edit.d.ts.map +1 -0
  87. package/script/commands/variable/variable.edit.js +44 -0
  88. package/script/commands/variable/variable.list.d.ts +19 -7
  89. package/script/commands/variable/variable.list.d.ts.map +1 -1
  90. package/script/commands/variable/variable.list.js +27 -47
  91. package/script/contracts/api-key.d.ts +22 -1
  92. package/script/contracts/api-key.d.ts.map +1 -1
  93. package/script/contracts/api-key.js +18 -1
  94. package/script/contracts/secret.d.ts +16 -0
  95. package/script/contracts/secret.d.ts.map +1 -0
  96. package/script/contracts/secret.js +14 -0
  97. package/script/contracts/variable.d.ts +5 -1
  98. package/script/contracts/variable.d.ts.map +1 -1
  99. package/script/contracts/variable.js +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.54.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.53.0...v1.54.0) (2025-07-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * use new rest api for api keys ([bdccaf2](https://github.com/flowcore-io/flowcore-sdk/commit/bdccaf2e9622a1a22df77f49ea819dabb0fd555a))
9
+ * use new rest api for api keys ([bc7db6b](https://github.com/flowcore-io/flowcore-sdk/commit/bc7db6bb05f75d1960f139f6bce52b90600b2109))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * fix create apikey response ([9438f5d](https://github.com/flowcore-io/flowcore-sdk/commit/9438f5d0838bde01dada8a8a67ed78993375d70f))
15
+
16
+ ## [1.53.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.52.0...v1.53.0) (2025-07-04)
17
+
18
+
19
+ ### Features
20
+
21
+ * change tenant variable and secret commands to use new rest api ([10a89aa](https://github.com/flowcore-io/flowcore-sdk/commit/10a89aac505ff2be4771586385cc86dc161c4c72))
22
+ * change tenant variable and secret commands to use new rest api ([93eef31](https://github.com/flowcore-io/flowcore-sdk/commit/93eef31d217b5dc367c5c18d04e1b68218876488))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * typo ([7876235](https://github.com/flowcore-io/flowcore-sdk/commit/78762351af7dd4c8a9394270c5bdda8127d003b2))
28
+
3
29
  ## [1.52.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.51.0...v1.52.0) (2025-06-23)
4
30
 
5
31
 
package/README.md CHANGED
@@ -643,9 +643,9 @@ const result = await client.execute(command)
643
643
  #### Truncate an Event Type
644
644
 
645
645
  ```typescript
646
- import { EventTypeTruncateRequestCommand, FlowcoreClient } from "@flowcore/sdk"
646
+ import { EventTypeRequestTruncateCommand, FlowcoreClient } from "@flowcore/sdk"
647
647
 
648
- const command = new EventTypeTruncateRequestCommand({
648
+ const command = new EventTypeRequestTruncateCommand({
649
649
  eventTypeId: "your-event-type-id",
650
650
  waitForTruncate: true // Optional: Wait for truncation to complete (default: true)
651
651
  })
@@ -1,46 +1,43 @@
1
- import { GraphQlCommand } from "../../common/command-graphql.js";
2
- import type { ApiKey } from "../../contracts/api-key.js";
3
- import type { FlowcoreClient } from "../../common/flowcore-client.js";
1
+ import { Command } from "../../common/command.js";
2
+ import { type ApiKeyWithValue } from "../../contracts/api-key.js";
4
3
  /**
5
- * The input for the API key create command
4
+ * The input for the api key create command
6
5
  */
7
6
  export interface ApiKeyCreateInput {
8
7
  /** The tenant id */
9
8
  tenantId: string;
10
- /** The name of the API key */
9
+ /** The name of the api key */
11
10
  name: string;
11
+ /** The description of the api key */
12
+ description?: string;
12
13
  }
13
14
  /**
14
- * Create an API key
15
+ * Create an api key
15
16
  */
16
- export declare class ApiKeyCreateCommand extends GraphQlCommand<ApiKeyCreateInput, ApiKey & {
17
- value: string;
18
- }> {
17
+ export declare class ApiKeyCreateCommand extends Command<ApiKeyCreateInput, ApiKeyWithValue> {
19
18
  /**
20
19
  * Whether the command should retry on failure
21
20
  */
22
21
  protected retryOnFailure: boolean;
23
22
  /**
24
- * The allowed modes for the command
23
+ * Get the method
25
24
  */
26
- protected allowedModes: ("apiKey" | "bearer")[];
25
+ protected getMethod(): string;
27
26
  /**
28
- * Parse the response
27
+ * Get the base url
28
+ */
29
+ protected getBaseUrl(): string;
30
+ /**
31
+ * Get the path
29
32
  */
30
- protected parseResponse(rawResponse: unknown): ApiKey & {
31
- value: string;
32
- };
33
+ protected getPath(): string;
33
34
  /**
34
- * Get the body for the request
35
+ * The allowed modes for the command
35
36
  */
36
- protected getBody(): Record<string, unknown>;
37
+ protected allowedModes: ("apiKey" | "bearer")[];
37
38
  /**
38
- * Fill in the missing fields
39
+ * Parse the response
39
40
  */
40
- protected processResponse(flowcoreClient: FlowcoreClient, response: ApiKey & {
41
- value: string;
42
- }): Promise<ApiKey & {
43
- value: string;
44
- }>;
41
+ protected parseResponse(rawResponse: unknown): ApiKeyWithValue;
45
42
  }
46
43
  //# sourceMappingURL=api-key.create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.create.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,cA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AiB,EAAE,eAAe,CAAC;IAClF;;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;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,eAAe;CAGxE"}
@@ -1,81 +1,40 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { GraphQlCommand } from "../../common/command-graphql.js";
1
+ import { Command } from "../../common/command.js";
3
2
  import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
- import { ApiKeyListCommand } from "./api-key.list.js";
5
- import { CommandError } from "../../exceptions/command-error.js";
6
- const graphQlQueryById = `
7
- mutation FLOWCORE_SDK_API_KEY_CREATE($tenantId: ID!, $name: String!) {
8
- organization(id: $tenantId) {
9
- createApiKey(name: $name)
10
- }
11
- }
12
- `;
13
- const responseSchema = Type.Object({
14
- errors: Type.Optional(Type.Array(Type.Object({
15
- message: Type.String(),
16
- }))),
17
- data: Type.Union([
18
- Type.Object({
19
- organization: Type.Object({
20
- createApiKey: Type.Union([Type.String(), Type.Null()]),
21
- }),
22
- }),
23
- Type.Null(),
24
- ]),
25
- });
3
+ import { ApiKeyWithValueSchema } from "../../contracts/api-key.js";
26
4
  /**
27
- * Create an API key
5
+ * Create an api key
28
6
  */
29
- export class ApiKeyCreateCommand extends GraphQlCommand {
7
+ export class ApiKeyCreateCommand extends Command {
30
8
  /**
31
9
  * Whether the command should retry on failure
32
10
  */
33
11
  retryOnFailure = false;
34
12
  /**
35
- * The allowed modes for the command
13
+ * Get the method
36
14
  */
37
- allowedModes = ["bearer"];
15
+ getMethod() {
16
+ return "POST";
17
+ }
38
18
  /**
39
- * Parse the response
19
+ * Get the base url
40
20
  */
41
- parseResponse(rawResponse) {
42
- const response = parseResponseHelper(responseSchema, rawResponse);
43
- if (response.errors) {
44
- throw new CommandError(this.constructor.name, response.errors[0].message);
45
- }
46
- if (!response.data || response.data?.organization.createApiKey === null) {
47
- throw new CommandError(this.constructor.name, "Failed to create API key");
48
- }
49
- return {
50
- id: "",
51
- name: "",
52
- createdAt: "",
53
- value: response.data.organization.createApiKey,
54
- };
21
+ getBaseUrl() {
22
+ return "https://tenant-store.api.flowcore.io";
55
23
  }
56
24
  /**
57
- * Get the body for the request
25
+ * Get the path
58
26
  */
59
- getBody() {
60
- return {
61
- query: graphQlQueryById,
62
- variables: this.input,
63
- };
27
+ getPath() {
28
+ return "/api/v1/api-keys";
64
29
  }
65
30
  /**
66
- * Fill in the missing fields
31
+ * The allowed modes for the command
32
+ */
33
+ allowedModes = ["bearer"];
34
+ /**
35
+ * Parse the response
67
36
  */
68
- async processResponse(flowcoreClient, response) {
69
- const apiKeys = await flowcoreClient.execute(new ApiKeyListCommand({
70
- tenantId: this.input.tenantId,
71
- }));
72
- const apiKey = apiKeys.find((apiKey) => apiKey.name === this.input.name);
73
- if (!apiKey) {
74
- throw new Error("API key not found");
75
- }
76
- return {
77
- ...apiKey,
78
- value: response.value,
79
- };
37
+ parseResponse(rawResponse) {
38
+ return parseResponseHelper(ApiKeyWithValueSchema, rawResponse);
80
39
  }
81
40
  }
@@ -1,17 +1,31 @@
1
- import { GraphQlCommand } from "../../common/command-graphql.js";
1
+ import { Command } from "../../common/command.js";
2
2
  /**
3
- * The input for the API key delete command
3
+ * The input for the api key delete command
4
4
  */
5
5
  export interface ApiKeyDeleteInput {
6
- /** The id of the tenant */
7
- tenantId: string;
8
- /** The id of the API key */
6
+ /** The api key id */
9
7
  apiKeyId: string;
10
8
  }
11
9
  /**
12
- * Delete an API key
10
+ * Delete an api key
13
11
  */
14
- export declare class ApiKeyDeleteCommand extends GraphQlCommand<ApiKeyDeleteInput, boolean> {
12
+ export declare class ApiKeyDeleteCommand extends Command<ApiKeyDeleteInput, boolean> {
13
+ /**
14
+ * Whether the command should retry on failure
15
+ */
16
+ protected retryOnFailure: boolean;
17
+ /**
18
+ * Get the method
19
+ */
20
+ protected getMethod(): string;
21
+ /**
22
+ * Get the base url
23
+ */
24
+ protected getBaseUrl(): string;
25
+ /**
26
+ * Get the path
27
+ */
28
+ protected getPath(): string;
15
29
  /**
16
30
  * The allowed modes for the command
17
31
  */
@@ -19,10 +33,6 @@ export declare class ApiKeyDeleteCommand extends GraphQlCommand<ApiKeyDeleteInpu
19
33
  /**
20
34
  * Parse the response
21
35
  */
22
- protected parseResponse(rawResponse: unknown): boolean;
23
- /**
24
- * Get the body for the request
25
- */
26
- protected getBody(): Record<string, unknown>;
36
+ protected parseResponse(_rawResponse: unknown): boolean;
27
37
  }
28
38
  //# sourceMappingURL=api-key.delete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAIhE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAyBD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACjF;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAW/D;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
1
+ {"version":3,"file":"api-key.delete.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC1E;;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;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO;CAGjE"}
@@ -1,52 +1,38 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { GraphQlCommand } from "../../common/command-graphql.js";
3
- import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
- import { CommandError } from "../../exceptions/command-error.js";
5
- const graphQlQueryById = `
6
- mutation FLOWCORE_SDK_API_KEY_DELETE($tenantId: ID!, $apiKeyId: ID!) {
7
- organization(id: $tenantId) {
8
- deleteApiKey(id: $apiKeyId)
9
- }
10
- }
11
- `;
12
- const responseSchema = Type.Object({
13
- errors: Type.Optional(Type.Array(Type.Object({
14
- message: Type.String(),
15
- }))),
16
- data: Type.Object({
17
- organization: Type.Object({
18
- deleteApiKey: Type.Union([Type.Boolean(), Type.Null()]),
19
- }),
20
- }),
21
- });
1
+ import { Command } from "../../common/command.js";
22
2
  /**
23
- * Delete an API key
3
+ * Delete an api key
24
4
  */
25
- export class ApiKeyDeleteCommand extends GraphQlCommand {
5
+ export class ApiKeyDeleteCommand extends Command {
26
6
  /**
27
- * The allowed modes for the command
7
+ * Whether the command should retry on failure
28
8
  */
29
- allowedModes = ["bearer"];
9
+ retryOnFailure = false;
30
10
  /**
31
- * Parse the response
11
+ * Get the method
32
12
  */
33
- parseResponse(rawResponse) {
34
- const response = parseResponseHelper(responseSchema, rawResponse);
35
- if (response.errors) {
36
- throw new CommandError(this.constructor.name, response.errors[0].message);
37
- }
38
- if (response.data.organization.deleteApiKey !== true) {
39
- throw new CommandError(this.constructor.name, "Failed to delete API key");
40
- }
41
- return response.data.organization.deleteApiKey;
13
+ getMethod() {
14
+ return "DELETE";
42
15
  }
43
16
  /**
44
- * Get the body for the request
17
+ * Get the base url
18
+ */
19
+ getBaseUrl() {
20
+ return "https://tenant-store.api.flowcore.io";
21
+ }
22
+ /**
23
+ * Get the path
24
+ */
25
+ getPath() {
26
+ return `/api/v1/api-keys/${this.input.apiKeyId}`;
27
+ }
28
+ /**
29
+ * The allowed modes for the command
30
+ */
31
+ allowedModes = ["bearer"];
32
+ /**
33
+ * Parse the response
45
34
  */
46
- getBody() {
47
- return {
48
- query: graphQlQueryById,
49
- variables: this.input,
50
- };
35
+ parseResponse(_rawResponse) {
36
+ return true;
51
37
  }
52
38
  }
@@ -0,0 +1,41 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type ApiKey } from "../../contracts/api-key.js";
3
+ /**
4
+ * The input for the api key edit command
5
+ */
6
+ export interface ApiKeyEditInput {
7
+ /** The api key id */
8
+ apiKeyId: string;
9
+ /** The description of the api key */
10
+ description: string;
11
+ }
12
+ /**
13
+ * Edit an api key
14
+ */
15
+ export declare class ApiKeyEditCommand extends Command<ApiKeyEditInput, ApiKey> {
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
+ * The allowed modes for the command
34
+ */
35
+ protected allowedModes: ("apiKey" | "bearer")[];
36
+ /**
37
+ * Parse the response
38
+ */
39
+ protected parseResponse(rawResponse: unknown): ApiKey;
40
+ }
41
+ //# sourceMappingURL=api-key.edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-key.edit.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,4BAA4B,CAAA;AAEtE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC;IACrE;;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;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM;CAG/D"}
@@ -0,0 +1,40 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
3
+ import { ApiKeySchema } from "../../contracts/api-key.js";
4
+ /**
5
+ * Edit an api key
6
+ */
7
+ export class ApiKeyEditCommand extends Command {
8
+ /**
9
+ * Whether the command should retry on failure
10
+ */
11
+ retryOnFailure = false;
12
+ /**
13
+ * Get the method
14
+ */
15
+ getMethod() {
16
+ return "PATCH";
17
+ }
18
+ /**
19
+ * Get the base url
20
+ */
21
+ getBaseUrl() {
22
+ return "https://tenant-store.api.flowcore.io";
23
+ }
24
+ /**
25
+ * Get the path
26
+ */
27
+ getPath() {
28
+ return `/api/v1/api-keys/${this.input.apiKeyId}`;
29
+ }
30
+ /**
31
+ * The allowed modes for the command
32
+ */
33
+ allowedModes = ["bearer"];
34
+ /**
35
+ * Parse the response
36
+ */
37
+ parseResponse(rawResponse) {
38
+ return parseResponseHelper(ApiKeySchema, rawResponse);
39
+ }
40
+ }
@@ -1,7 +1,7 @@
1
- import { GraphQlCommand } from "../../common/command-graphql.js";
2
- import type { ApiKey } from "../../contracts/api-key.js";
1
+ import { Command } from "../../common/command.js";
2
+ import { type ApiKey } from "../../contracts/api-key.js";
3
3
  /**
4
- * The input for the API key list command
4
+ * The input for the api key list command
5
5
  */
6
6
  export interface ApiKeyListInput {
7
7
  /** The tenant id */
@@ -10,7 +10,23 @@ export interface ApiKeyListInput {
10
10
  /**
11
11
  * List api keys
12
12
  */
13
- export declare class ApiKeyListCommand extends GraphQlCommand<ApiKeyListInput, ApiKey[]> {
13
+ export declare class ApiKeyListCommand extends Command<ApiKeyListInput, ApiKey[]> {
14
+ /**
15
+ * Whether the command should retry on failure
16
+ */
17
+ protected retryOnFailure: boolean;
18
+ /**
19
+ * Get the method
20
+ */
21
+ protected getMethod(): string;
22
+ /**
23
+ * Get the base url
24
+ */
25
+ protected getBaseUrl(): string;
26
+ /**
27
+ * Get the path
28
+ */
29
+ protected getPath(): string;
14
30
  /**
15
31
  * The allowed modes for the command
16
32
  */
@@ -19,9 +35,5 @@ export declare class ApiKeyListCommand extends GraphQlCommand<ApiKeyListInput, A
19
35
  * Parse the response
20
36
  */
21
37
  protected parseResponse(rawResponse: unknown): ApiKey[];
22
- /**
23
- * Get the body for the request
24
- */
25
- protected getBody(): Record<string, unknown>;
26
38
  }
27
39
  //# sourceMappingURL=api-key.list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.list.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AA0BD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC9E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE;IAKhE;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMtD"}
1
+ {"version":3,"file":"api-key.list.d.ts","sourceRoot":"","sources":["../../../src/commands/api-key/api-key.list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,4BAA4B,CAAA;AAEtE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IACvE;;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;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE;CAGjE"}
@@ -1,32 +1,33 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { GraphQlCommand } from "../../common/command-graphql.js";
1
+ import { Command } from "../../common/command.js";
3
2
  import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
- const graphQlQueryById = `
5
- query FLOWCORE_SDK_API_KEY_LIST($tenantId: ID!) {
6
- organization(search: {id: $tenantId}) {
7
- apiKeys {
8
- id
9
- name
10
- createdAt
11
- }
12
- }
13
- }
14
- `;
15
- const responseSchema = Type.Object({
16
- data: Type.Object({
17
- organization: Type.Object({
18
- apiKeys: Type.Array(Type.Object({
19
- id: Type.String(),
20
- name: Type.String(),
21
- createdAt: Type.String(),
22
- })),
23
- }),
24
- }),
25
- });
3
+ import { Type } from "@sinclair/typebox";
4
+ import { ApiKeySchema } from "../../contracts/api-key.js";
26
5
  /**
27
6
  * List api keys
28
7
  */
29
- export class ApiKeyListCommand extends GraphQlCommand {
8
+ export class ApiKeyListCommand extends Command {
9
+ /**
10
+ * Whether the command should retry on failure
11
+ */
12
+ retryOnFailure = false;
13
+ /**
14
+ * Get the method
15
+ */
16
+ getMethod() {
17
+ return "GET";
18
+ }
19
+ /**
20
+ * Get the base url
21
+ */
22
+ getBaseUrl() {
23
+ return "https://tenant-store.api.flowcore.io";
24
+ }
25
+ /**
26
+ * Get the path
27
+ */
28
+ getPath() {
29
+ return `/api/v1/api-keys?tenantId=${this.input.tenantId}`;
30
+ }
30
31
  /**
31
32
  * The allowed modes for the command
32
33
  */
@@ -35,16 +36,6 @@ export class ApiKeyListCommand extends GraphQlCommand {
35
36
  * Parse the response
36
37
  */
37
38
  parseResponse(rawResponse) {
38
- const response = parseResponseHelper(responseSchema, rawResponse);
39
- return response.data.organization.apiKeys;
40
- }
41
- /**
42
- * Get the body for the request
43
- */
44
- getBody() {
45
- return {
46
- query: graphQlQueryById,
47
- variables: this.input,
48
- };
39
+ return parseResponseHelper(Type.Array(ApiKeySchema), rawResponse);
49
40
  }
50
41
  }
@@ -5,13 +5,16 @@ export * from "./tenant/tenant.list.js";
5
5
  export * from "./tenant/tenant.translate-name-to-id.js";
6
6
  export * from "./adapter/reset-adapter.js";
7
7
  export * from "./api-key/api-key.create.js";
8
+ export * from "./api-key/api-key.edit.js";
8
9
  export * from "./api-key/api-key.delete.js";
9
10
  export * from "./api-key/api-key.list.js";
10
11
  export * from "./secret/secret.create.js";
11
12
  export * from "./secret/secret.delete.js";
13
+ export * from "./secret/secret.edit.js";
12
14
  export * from "./secret/secret.list.js";
13
15
  export * from "./variable/variable.create.js";
14
16
  export * from "./variable/variable.delete.js";
17
+ export * from "./variable/variable.edit.js";
15
18
  export * from "./variable/variable.list.js";
16
19
  export * from "./data-core/data-core.create.js";
17
20
  export * from "./data-core/data-core.exists.js";
@@ -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,4BAA4B,CAAA;AAG1C,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,cAAc,iCAAiC,CAAA;AAG/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAA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;AACpE,cAAc,gDAAgD,CAAA;AAC9D,cAAc,gDAAgD,CAAA;AAC9D,cAAc,8CAA8C,CAAA;AAC5D,cAAc,+CAA+C,CAAA;AAC7D,cAAc,+CAA+C,CAAA;AAC7D,cAAc,gDAAgD,CAAA;AAC9D,cAAc,iDAAiD,CAAA;AAC/D,cAAc,iDAAiD,CAAA;AAE/D,cAAc,0CAA0C,CAAA;AACxD,cAAc,mDAAmD,CAAA;AACjE,cAAc,kDAAkD,CAAA;AAChE,cAAc,2CAA2C,CAAA;AACzD,cAAc,0CAA0C,CAAA;AACxD,cAAc,2CAA2C,CAAA;AACzD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,6CAA6C,CAAA;AAE3D,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAE7C,cAAc,gDAAgD,CAAA;AAE9D,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
@@ -8,15 +8,18 @@ export * from "./tenant/tenant.translate-name-to-id.js";
8
8
  export * from "./adapter/reset-adapter.js";
9
9
  // Api Key
10
10
  export * from "./api-key/api-key.create.js";
11
+ export * from "./api-key/api-key.edit.js";
11
12
  export * from "./api-key/api-key.delete.js";
12
13
  export * from "./api-key/api-key.list.js";
13
14
  // Secret
14
15
  export * from "./secret/secret.create.js";
15
16
  export * from "./secret/secret.delete.js";
17
+ export * from "./secret/secret.edit.js";
16
18
  export * from "./secret/secret.list.js";
17
19
  // Variable
18
20
  export * from "./variable/variable.create.js";
19
21
  export * from "./variable/variable.delete.js";
22
+ export * from "./variable/variable.edit.js";
20
23
  export * from "./variable/variable.list.js";
21
24
  // Data Core
22
25
  export * from "./data-core/data-core.create.js";