@flowcore/sdk 1.16.0 → 1.18.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,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.18.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.17.0...v1.18.0) (2025-03-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * **security:** :sparkles: add commands for managing Personal Access Tokens (PAT) ([4c3760a](https://github.com/flowcore-io/flowcore-sdk/commit/4c3760aa880c8bbd793b64a9653080fa308b64e7))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **security:** :art: remove unused import for PAT and PATSchema ([4d281d6](https://github.com/flowcore-io/flowcore-sdk/commit/4d281d6bf75f122448f9d62aa395d95b96faf221))
14
+
15
+ ## [1.17.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.16.0...v1.17.0) (2025-03-07)
16
+
17
+
18
+ ### Features
19
+
20
+ * add tenant to dataCore schema and remove v0 schemas ([f710f14](https://github.com/flowcore-io/flowcore-sdk/commit/f710f1427f86b7730162e05f0935829ae139534d))
21
+ * add tenant to dataCore schema and remove v0 schemas ([91158d2](https://github.com/flowcore-io/flowcore-sdk/commit/91158d25cb5838072a8785051dbcc82d28a0aa26))
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * add tenant arg to fetch datacore ([92b5e29](https://github.com/flowcore-io/flowcore-sdk/commit/92b5e296031d728c90b1f965033ee090bd8e06f2))
27
+ * fix tests ([ea249d4](https://github.com/flowcore-io/flowcore-sdk/commit/ea249d4c3d1076df4f4cba521bf97316a57769aa))
28
+ * fix tests ([99ffaf8](https://github.com/flowcore-io/flowcore-sdk/commit/99ffaf859040d6f057c522a27f2d53d6963b1fd0))
29
+
3
30
  ## [1.16.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.15.0...v1.16.0) (2025-03-06)
4
31
 
5
32
 
@@ -7,17 +7,34 @@ import type { ClientError } from "../../exceptions/client-error.js";
7
7
  export interface DataCoreFetchByIdInput {
8
8
  /** The id of the data core */
9
9
  dataCoreId: string;
10
- /** The name of the data core */
11
- dataCore?: never;
12
10
  /** The tenant id */
13
11
  tenantId?: never;
12
+ /** The tenant */
13
+ tenant?: never;
14
+ /** The name of the data core */
15
+ dataCore?: never;
14
16
  }
15
17
  /**
16
- * The input for the data core fetch by name command
18
+ * The input for the data core fetch by name and tenant id command
17
19
  */
18
- export interface DataCoreFetchByNameInput {
20
+ export interface DataCoreFetchByNameAndTenantIdInput {
19
21
  /** The tenant id */
20
22
  tenantId: string;
23
+ /** The tenant */
24
+ tenant?: never;
25
+ /** The name of the data core */
26
+ dataCore: string;
27
+ /** The id of the data core */
28
+ dataCoreId?: never;
29
+ }
30
+ /**
31
+ * The input for the data core fetch by name and tenant command
32
+ */
33
+ export interface DataCoreFetchByNameAndTenantInput {
34
+ /** The tenant id */
35
+ tenantId?: never;
36
+ /** The tenant */
37
+ tenant: string;
21
38
  /** The name of the data core */
22
39
  dataCore: string;
23
40
  /** The id of the data core */
@@ -26,7 +43,7 @@ export interface DataCoreFetchByNameInput {
26
43
  /**
27
44
  * The input for the data core fetch command
28
45
  */
29
- export type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameInput;
46
+ export type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameAndTenantIdInput | DataCoreFetchByNameAndTenantInput;
30
47
  /**
31
48
  * Fetch a data core
32
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"data-core.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAEnE;;GAEG;AACH,MAAM,WAAW,sB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AAE,KAAK,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB;IACjB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAgBD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,sBAAsB,GACtB,mCAAmC,GACnC,iCAAiC,CAAA;AAErC;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC7E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAepC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;IAgBhE;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAY/D"}
@@ -3,6 +3,15 @@ import { Command } from "../../common/command.js";
3
3
  import { DataCoreSchema } from "../../contracts/data-core.js";
4
4
  import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
5
  import { NotFoundException } from "../../exceptions/not-found.js";
6
+ function isDataCoreFetchByIdInput(input) {
7
+ return "dataCoreId" in input;
8
+ }
9
+ function isDataCoreFetchByNameAndTenantIdInput(input) {
10
+ return "tenantId" in input;
11
+ }
12
+ function isDataCoreFetchByNameAndTenantInput(input) {
13
+ return "tenant" in input;
14
+ }
6
15
  /**
7
16
  * Fetch a data core
8
17
  */
@@ -23,11 +32,16 @@ export class DataCoreFetchCommand extends Command {
23
32
  * Get the path
24
33
  */
25
34
  getPath() {
26
- if ("dataCoreId" in this.input) {
35
+ if (isDataCoreFetchByIdInput(this.input)) {
27
36
  return `/api/v1/data-cores/${this.input.dataCoreId}`;
28
37
  }
29
38
  const queryParams = new URLSearchParams();
30
- queryParams.set("tenantId", this.input.tenantId);
39
+ if (isDataCoreFetchByNameAndTenantIdInput(this.input)) {
40
+ queryParams.set("tenantId", this.input.tenantId);
41
+ }
42
+ if (isDataCoreFetchByNameAndTenantInput(this.input)) {
43
+ queryParams.set("tenant", this.input.tenant);
44
+ }
31
45
  queryParams.set("name", this.input.dataCore);
32
46
  return `/api/v1/data-cores?${queryParams.toString()}`;
33
47
  }
@@ -35,13 +49,18 @@ export class DataCoreFetchCommand extends Command {
35
49
  * Parse the response
36
50
  */
37
51
  parseResponse(rawResponse) {
38
- if ("dataCoreId" in this.input) {
52
+ if (isDataCoreFetchByIdInput(this.input)) {
39
53
  const response = parseResponseHelper(DataCoreSchema, rawResponse);
40
54
  return response;
41
55
  }
42
56
  const response = parseResponseHelper(Type.Array(DataCoreSchema), rawResponse);
43
57
  if (response.length === 0) {
44
- throw new NotFoundException("DataCore", { name: this.input.dataCore });
58
+ if (isDataCoreFetchByNameAndTenantIdInput(this.input)) {
59
+ throw new NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId });
60
+ }
61
+ else {
62
+ throw new NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant });
63
+ }
45
64
  }
46
65
  return response[0];
47
66
  }
@@ -50,9 +69,15 @@ export class DataCoreFetchCommand extends Command {
50
69
  */
51
70
  handleClientError(error) {
52
71
  if (error.status === 404) {
53
- throw new NotFoundException("DataCore", {
54
- [this.input.dataCoreId ? "id" : "name"]: this.input.dataCoreId ?? this.input.dataCore,
55
- });
72
+ if (isDataCoreFetchByIdInput(this.input)) {
73
+ throw new NotFoundException("DataCore", { id: this.input.dataCoreId });
74
+ }
75
+ else if (isDataCoreFetchByNameAndTenantIdInput(this.input)) {
76
+ throw new NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId });
77
+ }
78
+ else {
79
+ throw new NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant });
80
+ }
56
81
  }
57
82
  throw error;
58
83
  }
@@ -1,10 +1,11 @@
1
- import { type Static, type TArray, type TBoolean, type TLiteral, type TNull, type TObject, type TOptional, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TLiteral, type TObject, type TString, type TUnion } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for a data core
4
4
  */
5
5
  export declare const DataCoreSchema: TObject<{
6
6
  id: TString;
7
7
  tenantId: TString;
8
+ tenant: TString;
8
9
  name: TString;
9
10
  description: TString;
10
11
  accessControl: TUnion<[TLiteral<"public">, TLiteral<"private">]>;
@@ -15,27 +16,4 @@ export declare const DataCoreSchema: TObject<{
15
16
  * The type for a data core
16
17
  */
17
18
  export type DataCore = Static<typeof DataCoreSchema>;
18
- /**
19
- * The schema for a data core v0
20
- */
21
- export declare const DataCoreV0Schema: TObject<{
22
- id: TString;
23
- name: TString;
24
- description: TUnion<[TString, TNull]>;
25
- isPublic: TBoolean;
26
- configuration: TOptional<TArray<TObject<{
27
- key: TLiteral<"DELETE_PROTECTION_ENABLED">;
28
- value: TUnion<[TLiteral<"true">, TLiteral<"false">]>;
29
- }>>>;
30
- truncating: TBoolean;
31
- deleting: TBoolean;
32
- }>;
33
- /**
34
- * The type for a data core v0
35
- */
36
- export type DataCoreV0 = Static<typeof DataCoreV0Schema>;
37
- /**
38
- * Convert a data core v0 to a data core
39
- */
40
- export declare const dataCoreV0ToDataCore: (dataCoreV0: DataCoreV0, organizationId: string) => DataCore;
41
19
  //# sourceMappingURL=data-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-core.d.ts","source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AA;AACF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,eACnB,UAAU,kBACN,MAAM,KACrB,QAUF,CAAA"}
1
+ {"version":3,"file":"data-core.d.ts","sourceRoot":"","sources":["../../src/contracts/data-core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,mBAAmB,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC;IACnC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAChE,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,UAAU,EAAE,QAAQ,CAAA;CACrB,CASC,CAAA;AACF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -5,38 +5,10 @@ import { Type, } from "@sinclair/typebox";
5
5
  export const DataCoreSchema = Type.Object({
6
6
  id: Type.String(),
7
7
  tenantId: Type.String(),
8
+ tenant: Type.String(),
8
9
  name: Type.String(),
9
10
  description: Type.String(),
10
11
  accessControl: Type.Union([Type.Literal("public"), Type.Literal("private")]),
11
12
  deleteProtection: Type.Boolean(),
12
13
  isDeleting: Type.Boolean(),
13
14
  });
14
- /**
15
- * The schema for a data core v0
16
- */
17
- export const DataCoreV0Schema = Type.Object({
18
- id: Type.String(),
19
- name: Type.String(),
20
- description: Type.Union([Type.String(), Type.Null()]),
21
- isPublic: Type.Boolean(),
22
- configuration: Type.Optional(Type.Array(Type.Object({
23
- key: Type.Literal("DELETE_PROTECTION_ENABLED"),
24
- value: Type.Union([Type.Literal("true"), Type.Literal("false")]),
25
- }), { minItems: 0, maxItems: 1 })),
26
- truncating: Type.Boolean(),
27
- deleting: Type.Boolean(),
28
- });
29
- /**
30
- * Convert a data core v0 to a data core
31
- */
32
- export const dataCoreV0ToDataCore = (dataCoreV0, organizationId) => {
33
- return {
34
- id: dataCoreV0.id,
35
- tenantId: organizationId,
36
- name: dataCoreV0.name,
37
- description: dataCoreV0.description ?? "",
38
- accessControl: dataCoreV0.isPublic ? "public" : "private",
39
- deleteProtection: dataCoreV0.configuration?.[0]?.value === "true",
40
- isDeleting: dataCoreV0.deleting,
41
- };
42
- };
@@ -1,4 +1,4 @@
1
- import { type Static, type TBoolean, type TNull, type TObject, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TObject, type TString } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for an event type
4
4
  */
@@ -16,22 +16,4 @@ export declare const EventTypeSchema: TObject<{
16
16
  * The type for an event type
17
17
  */
18
18
  export type EventType = Static<typeof EventTypeSchema>;
19
- /**
20
- * The schema for an event type v0
21
- */
22
- export declare const EventTypeV0Schema: TObject<{
23
- id: TString;
24
- name: TString;
25
- description: TUnion<[TString, TNull]>;
26
- truncating: TBoolean;
27
- deleting: TBoolean;
28
- }>;
29
- /**
30
- * The type for an event type v0
31
- */
32
- export type EventTypeV0 = Static<typeof EventTypeV0Schema>;
33
- /**
34
- * Convert an event type v0 to an event type
35
- */
36
- export declare const eventTypeV0ToEventType: (eventTypeV0: EventTypeV0, organizationId: string, dataCoreId: string, flowTypeId: string) => EventType;
37
19
  //# sourceMappingURL=event-type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-type.d.ts","sourceRoot":"","sources":["../../src/contracts/event-type.ts"],"names":[],"mappings":"AAAA,OAAO,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EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,QAAQ,CAAA;IACtB,UAAU,EAAE,QAAQ,CAAA;CACrB,CASC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Type, } from "@sinclair/typebox";
1
+ import { Type } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for an event type
4
4
  */
@@ -12,28 +12,3 @@ export const EventTypeSchema = Type.Object({
12
12
  isTruncating: Type.Boolean(),
13
13
  isDeleting: Type.Boolean(),
14
14
  });
15
- /**
16
- * The schema for an event type v0
17
- */
18
- export const EventTypeV0Schema = Type.Object({
19
- id: Type.String(),
20
- name: Type.String(),
21
- description: Type.Union([Type.String(), Type.Null()]),
22
- truncating: Type.Boolean(),
23
- deleting: Type.Boolean(),
24
- });
25
- /**
26
- * Convert an event type v0 to an event type
27
- */
28
- export const eventTypeV0ToEventType = (eventTypeV0, organizationId, dataCoreId, flowTypeId) => {
29
- return {
30
- id: eventTypeV0.id,
31
- tenantId: organizationId,
32
- dataCoreId,
33
- flowTypeId,
34
- name: eventTypeV0.name,
35
- description: eventTypeV0.description ?? "",
36
- isTruncating: eventTypeV0.truncating,
37
- isDeleting: eventTypeV0.deleting,
38
- };
39
- };
@@ -1,4 +1,4 @@
1
- import { type Static, type TBoolean, type TNull, type TObject, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TObject, type TString } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for a flow type
4
4
  */
@@ -14,21 +14,4 @@ export declare const FlowTypeSchema: TObject<{
14
14
  * The type for a flow type
15
15
  */
16
16
  export type FlowType = Static<typeof FlowTypeSchema>;
17
- /**
18
- * The schema for a flow type v0
19
- */
20
- export declare const FlowTypeV0Schema: TObject<{
21
- id: TString;
22
- aggregator: TString;
23
- description: TUnion<[TString, TNull]>;
24
- deleting: TBoolean;
25
- }>;
26
- /**
27
- * The type for a flow type v0
28
- */
29
- export type FlowTypeV0 = Static<typeof FlowTypeV0Schema>;
30
- /**
31
- * Convert a flow type v0 to a flow type
32
- */
33
- export declare const flowTypeV0ToFlowType: (flowTypeV0: FlowTypeV0, organizationId: string, dataCoreId: string) => FlowType;
34
17
  //# sourceMappingURL=flow-type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow-type.d.ts","sourceRoot":"","sources":["../../src/contracts/flow-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,mBAAmB,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC;IACnC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,QAAQ,CAAA;CACrB,CAOC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC;IACrC,EAAE,EAAE,OAAO,CAAA;IACX,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IACrC,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAKC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,eACnB,UAAU,kBACN,MAAM,cACV,MAAM,KACjB,QASF,CAAA"}
1
+ {"version":3,"file":"flow-type.d.ts","sourceRoot":"","sources":["../../src/contracts/flow-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEhG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC;IACnC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,QAAQ,CAAA;CACrB,CAOC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Type, } from "@sinclair/typebox";
1
+ import { Type } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for a flow type
4
4
  */
@@ -10,25 +10,3 @@ export const FlowTypeSchema = Type.Object({
10
10
  description: Type.String(),
11
11
  isDeleting: Type.Boolean(),
12
12
  });
13
- /**
14
- * The schema for a flow type v0
15
- */
16
- export const FlowTypeV0Schema = Type.Object({
17
- id: Type.String(),
18
- aggregator: Type.String(),
19
- description: Type.Union([Type.String(), Type.Null()]),
20
- deleting: Type.Boolean(),
21
- });
22
- /**
23
- * Convert a flow type v0 to a flow type
24
- */
25
- export const flowTypeV0ToFlowType = (flowTypeV0, organizationId, dataCoreId) => {
26
- return {
27
- id: flowTypeV0.id,
28
- tenantId: organizationId,
29
- dataCoreId,
30
- name: flowTypeV0.aggregator,
31
- description: flowTypeV0.description ?? "",
32
- isDeleting: flowTypeV0.deleting,
33
- };
34
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowcore/sdk",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Flowcore SDK",
5
5
  "homepage": "https://github.com/flowcore-io/flowcore-sdk#readme",
6
6
  "repository": {
@@ -7,17 +7,34 @@ import type { ClientError } from "../../exceptions/client-error.js";
7
7
  export interface DataCoreFetchByIdInput {
8
8
  /** The id of the data core */
9
9
  dataCoreId: string;
10
- /** The name of the data core */
11
- dataCore?: never;
12
10
  /** The tenant id */
13
11
  tenantId?: never;
12
+ /** The tenant */
13
+ tenant?: never;
14
+ /** The name of the data core */
15
+ dataCore?: never;
14
16
  }
15
17
  /**
16
- * The input for the data core fetch by name command
18
+ * The input for the data core fetch by name and tenant id command
17
19
  */
18
- export interface DataCoreFetchByNameInput {
20
+ export interface DataCoreFetchByNameAndTenantIdInput {
19
21
  /** The tenant id */
20
22
  tenantId: string;
23
+ /** The tenant */
24
+ tenant?: never;
25
+ /** The name of the data core */
26
+ dataCore: string;
27
+ /** The id of the data core */
28
+ dataCoreId?: never;
29
+ }
30
+ /**
31
+ * The input for the data core fetch by name and tenant command
32
+ */
33
+ export interface DataCoreFetchByNameAndTenantInput {
34
+ /** The tenant id */
35
+ tenantId?: never;
36
+ /** The tenant */
37
+ tenant: string;
21
38
  /** The name of the data core */
22
39
  dataCore: string;
23
40
  /** The id of the data core */
@@ -26,7 +43,7 @@ export interface DataCoreFetchByNameInput {
26
43
  /**
27
44
  * The input for the data core fetch command
28
45
  */
29
- export type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameInput;
46
+ export type DataCoreFetchInput = DataCoreFetchByIdInput | DataCoreFetchByNameAndTenantIdInput | DataCoreFetchByNameAndTenantInput;
30
47
  /**
31
48
  * Fetch a data core
32
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"data-core.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.fetch.ts"],"names":[],"mappings":"AACA,OAA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,sBAAsB;IACrC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,iBAAiB;IACjB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,gCAAgC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB;IACjB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAgBD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,sBAAsB,GACtB,mCAAmC,GACnC,iCAAiC,CAAA;AAErC;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC7E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAepC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;IAgBhE;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAY/D"}
@@ -6,6 +6,15 @@ const command_js_1 = require("../../common/command.js");
6
6
  const data_core_js_1 = require("../../contracts/data-core.js");
7
7
  const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
8
  const not_found_js_1 = require("../../exceptions/not-found.js");
9
+ function isDataCoreFetchByIdInput(input) {
10
+ return "dataCoreId" in input;
11
+ }
12
+ function isDataCoreFetchByNameAndTenantIdInput(input) {
13
+ return "tenantId" in input;
14
+ }
15
+ function isDataCoreFetchByNameAndTenantInput(input) {
16
+ return "tenant" in input;
17
+ }
9
18
  /**
10
19
  * Fetch a data core
11
20
  */
@@ -26,11 +35,16 @@ class DataCoreFetchCommand extends command_js_1.Command {
26
35
  * Get the path
27
36
  */
28
37
  getPath() {
29
- if ("dataCoreId" in this.input) {
38
+ if (isDataCoreFetchByIdInput(this.input)) {
30
39
  return `/api/v1/data-cores/${this.input.dataCoreId}`;
31
40
  }
32
41
  const queryParams = new URLSearchParams();
33
- queryParams.set("tenantId", this.input.tenantId);
42
+ if (isDataCoreFetchByNameAndTenantIdInput(this.input)) {
43
+ queryParams.set("tenantId", this.input.tenantId);
44
+ }
45
+ if (isDataCoreFetchByNameAndTenantInput(this.input)) {
46
+ queryParams.set("tenant", this.input.tenant);
47
+ }
34
48
  queryParams.set("name", this.input.dataCore);
35
49
  return `/api/v1/data-cores?${queryParams.toString()}`;
36
50
  }
@@ -38,13 +52,18 @@ class DataCoreFetchCommand extends command_js_1.Command {
38
52
  * Parse the response
39
53
  */
40
54
  parseResponse(rawResponse) {
41
- if ("dataCoreId" in this.input) {
55
+ if (isDataCoreFetchByIdInput(this.input)) {
42
56
  const response = (0, parse_response_helper_js_1.parseResponseHelper)(data_core_js_1.DataCoreSchema, rawResponse);
43
57
  return response;
44
58
  }
45
59
  const response = (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Array(data_core_js_1.DataCoreSchema), rawResponse);
46
60
  if (response.length === 0) {
47
- throw new not_found_js_1.NotFoundException("DataCore", { name: this.input.dataCore });
61
+ if (isDataCoreFetchByNameAndTenantIdInput(this.input)) {
62
+ throw new not_found_js_1.NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId });
63
+ }
64
+ else {
65
+ throw new not_found_js_1.NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant });
66
+ }
48
67
  }
49
68
  return response[0];
50
69
  }
@@ -53,9 +72,15 @@ class DataCoreFetchCommand extends command_js_1.Command {
53
72
  */
54
73
  handleClientError(error) {
55
74
  if (error.status === 404) {
56
- throw new not_found_js_1.NotFoundException("DataCore", {
57
- [this.input.dataCoreId ? "id" : "name"]: this.input.dataCoreId ?? this.input.dataCore,
58
- });
75
+ if (isDataCoreFetchByIdInput(this.input)) {
76
+ throw new not_found_js_1.NotFoundException("DataCore", { id: this.input.dataCoreId });
77
+ }
78
+ else if (isDataCoreFetchByNameAndTenantIdInput(this.input)) {
79
+ throw new not_found_js_1.NotFoundException("DataCore", { name: this.input.dataCore, tenantId: this.input.tenantId });
80
+ }
81
+ else {
82
+ throw new not_found_js_1.NotFoundException("DataCore", { name: this.input.dataCore, tenant: this.input.tenant });
83
+ }
59
84
  }
60
85
  throw error;
61
86
  }
@@ -1,10 +1,11 @@
1
- import { type Static, type TArray, type TBoolean, type TLiteral, type TNull, type TObject, type TOptional, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TLiteral, type TObject, type TString, type TUnion } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for a data core
4
4
  */
5
5
  export declare const DataCoreSchema: TObject<{
6
6
  id: TString;
7
7
  tenantId: TString;
8
+ tenant: TString;
8
9
  name: TString;
9
10
  description: TString;
10
11
  accessControl: TUnion<[TLiteral<"public">, TLiteral<"private">]>;
@@ -15,27 +16,4 @@ export declare const DataCoreSchema: TObject<{
15
16
  * The type for a data core
16
17
  */
17
18
  export type DataCore = Static<typeof DataCoreSchema>;
18
- /**
19
- * The schema for a data core v0
20
- */
21
- export declare const DataCoreV0Schema: TObject<{
22
- id: TString;
23
- name: TString;
24
- description: TUnion<[TString, TNull]>;
25
- isPublic: TBoolean;
26
- configuration: TOptional<TArray<TObject<{
27
- key: TLiteral<"DELETE_PROTECTION_ENABLED">;
28
- value: TUnion<[TLiteral<"true">, TLiteral<"false">]>;
29
- }>>>;
30
- truncating: TBoolean;
31
- deleting: TBoolean;
32
- }>;
33
- /**
34
- * The type for a data core v0
35
- */
36
- export type DataCoreV0 = Static<typeof DataCoreV0Schema>;
37
- /**
38
- * Convert a data core v0 to a data core
39
- */
40
- export declare const dataCoreV0ToDataCore: (dataCoreV0: DataCoreV0, organizationId: string) => DataCore;
41
19
  //# sourceMappingURL=data-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-core.d.ts","sourceRoot":"","sources":["../../src/contracts/data-core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,mBAAmB,CAAA;AAE1B;;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,OAAO,CAAA;IACpB,aAAa,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAChE,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,UAAU,EAAE,QAAQ,CAAA;CACrB,CAQC,CAAA;AACF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC;IACrC,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IACrC,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@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dataCoreV0ToDataCore = exports.DataCoreV0Schema = exports.DataCoreSchema = void 0;
3
+ exports.DataCoreSchema = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  /**
6
6
  * The schema for a data core
@@ -8,39 +8,10 @@ const typebox_1 = require("@sinclair/typebox");
8
8
  exports.DataCoreSchema = typebox_1.Type.Object({
9
9
  id: typebox_1.Type.String(),
10
10
  tenantId: typebox_1.Type.String(),
11
+ tenant: typebox_1.Type.String(),
11
12
  name: typebox_1.Type.String(),
12
13
  description: typebox_1.Type.String(),
13
14
  accessControl: typebox_1.Type.Union([typebox_1.Type.Literal("public"), typebox_1.Type.Literal("private")]),
14
15
  deleteProtection: typebox_1.Type.Boolean(),
15
16
  isDeleting: typebox_1.Type.Boolean(),
16
17
  });
17
- /**
18
- * The schema for a data core v0
19
- */
20
- exports.DataCoreV0Schema = typebox_1.Type.Object({
21
- id: typebox_1.Type.String(),
22
- name: typebox_1.Type.String(),
23
- description: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
24
- isPublic: typebox_1.Type.Boolean(),
25
- configuration: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
26
- key: typebox_1.Type.Literal("DELETE_PROTECTION_ENABLED"),
27
- value: typebox_1.Type.Union([typebox_1.Type.Literal("true"), typebox_1.Type.Literal("false")]),
28
- }), { minItems: 0, maxItems: 1 })),
29
- truncating: typebox_1.Type.Boolean(),
30
- deleting: typebox_1.Type.Boolean(),
31
- });
32
- /**
33
- * Convert a data core v0 to a data core
34
- */
35
- const dataCoreV0ToDataCore = (dataCoreV0, organizationId) => {
36
- return {
37
- id: dataCoreV0.id,
38
- tenantId: organizationId,
39
- name: dataCoreV0.name,
40
- description: dataCoreV0.description ?? "",
41
- accessControl: dataCoreV0.isPublic ? "public" : "private",
42
- deleteProtection: dataCoreV0.configuration?.[0]?.value === "true",
43
- isDeleting: dataCoreV0.deleting,
44
- };
45
- };
46
- exports.dataCoreV0ToDataCore = dataCoreV0ToDataCore;
@@ -1,4 +1,4 @@
1
- import { type Static, type TBoolean, type TNull, type TObject, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TObject, type TString } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for an event type
4
4
  */
@@ -16,22 +16,4 @@ export declare const EventTypeSchema: TObject<{
16
16
  * The type for an event type
17
17
  */
18
18
  export type EventType = Static<typeof EventTypeSchema>;
19
- /**
20
- * The schema for an event type v0
21
- */
22
- export declare const EventTypeV0Schema: TObject<{
23
- id: TString;
24
- name: TString;
25
- description: TUnion<[TString, TNull]>;
26
- truncating: TBoolean;
27
- deleting: TBoolean;
28
- }>;
29
- /**
30
- * The type for an event type v0
31
- */
32
- export type EventTypeV0 = Static<typeof EventTypeV0Schema>;
33
- /**
34
- * Convert an event type v0 to an event type
35
- */
36
- export declare const eventTypeV0ToEventType: (eventTypeV0: EventTypeV0, organizationId: string, dataCoreId: string, flowTypeId: string) => EventType;
37
19
  //# sourceMappingURL=event-type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-type.d.ts","sourceRoot":"","sources":["../../src/contracts/event-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,mBAAmB,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC;IACpC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,QAAQ,CAAA;IACtB,UAAU,EAAE,QAAQ,CAAA;CACrB,CASC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC;IACtC,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IACrC,UAAU,EAAE,QAAQ,CAAA;IACpB,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAMC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,sBAAsB,gBACpB,WAAW,kBACR,MAAM,cACV,MAAM,cACN,MAAM,KACjB,SAWF,CAAA"}
1
+ {"version":3,"file":"event-type.d.ts","sourceRoot":"","sources":["../../src/contracts/event-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEhG;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC;IACpC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,QAAQ,CAAA;IACtB,UAAU,EAAE,QAAQ,CAAA;CACrB,CASC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventTypeV0ToEventType = exports.EventTypeV0Schema = exports.EventTypeSchema = void 0;
3
+ exports.EventTypeSchema = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  /**
6
6
  * The schema for an event type
@@ -15,29 +15,3 @@ exports.EventTypeSchema = typebox_1.Type.Object({
15
15
  isTruncating: typebox_1.Type.Boolean(),
16
16
  isDeleting: typebox_1.Type.Boolean(),
17
17
  });
18
- /**
19
- * The schema for an event type v0
20
- */
21
- exports.EventTypeV0Schema = typebox_1.Type.Object({
22
- id: typebox_1.Type.String(),
23
- name: typebox_1.Type.String(),
24
- description: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
25
- truncating: typebox_1.Type.Boolean(),
26
- deleting: typebox_1.Type.Boolean(),
27
- });
28
- /**
29
- * Convert an event type v0 to an event type
30
- */
31
- const eventTypeV0ToEventType = (eventTypeV0, organizationId, dataCoreId, flowTypeId) => {
32
- return {
33
- id: eventTypeV0.id,
34
- tenantId: organizationId,
35
- dataCoreId,
36
- flowTypeId,
37
- name: eventTypeV0.name,
38
- description: eventTypeV0.description ?? "",
39
- isTruncating: eventTypeV0.truncating,
40
- isDeleting: eventTypeV0.deleting,
41
- };
42
- };
43
- exports.eventTypeV0ToEventType = eventTypeV0ToEventType;
@@ -1,4 +1,4 @@
1
- import { type Static, type TBoolean, type TNull, type TObject, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TObject, type TString } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for a flow type
4
4
  */
@@ -14,21 +14,4 @@ export declare const FlowTypeSchema: TObject<{
14
14
  * The type for a flow type
15
15
  */
16
16
  export type FlowType = Static<typeof FlowTypeSchema>;
17
- /**
18
- * The schema for a flow type v0
19
- */
20
- export declare const FlowTypeV0Schema: TObject<{
21
- id: TString;
22
- aggregator: TString;
23
- description: TUnion<[TString, TNull]>;
24
- deleting: TBoolean;
25
- }>;
26
- /**
27
- * The type for a flow type v0
28
- */
29
- export type FlowTypeV0 = Static<typeof FlowTypeV0Schema>;
30
- /**
31
- * Convert a flow type v0 to a flow type
32
- */
33
- export declare const flowTypeV0ToFlowType: (flowTypeV0: FlowTypeV0, organizationId: string, dataCoreId: string) => FlowType;
34
17
  //# sourceMappingURL=flow-type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow-type.d.ts","sourceRoot":"","sources":["../../src/contracts/flow-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EAEZ,MAAM,mBAAmB,CAAA;AAE1B;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC;IACnC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,QAAQ,CAAA;CACrB,CAOC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC;IACrC,EAAE,EAAE,OAAO,CAAA;IACX,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IACrC,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAKC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB,eACnB,UAAU,kBACN,MAAM,cACV,MAAM,KACjB,QASF,CAAA"}
1
+ {"version":3,"file":"flow-type.d.ts","sourceRoot":"","sources":["../../src/contracts/flow-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEhG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC;IACnC,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,QAAQ,CAAA;CACrB,CAOC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flowTypeV0ToFlowType = exports.FlowTypeV0Schema = exports.FlowTypeSchema = void 0;
3
+ exports.FlowTypeSchema = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  /**
6
6
  * The schema for a flow type
@@ -13,26 +13,3 @@ exports.FlowTypeSchema = typebox_1.Type.Object({
13
13
  description: typebox_1.Type.String(),
14
14
  isDeleting: typebox_1.Type.Boolean(),
15
15
  });
16
- /**
17
- * The schema for a flow type v0
18
- */
19
- exports.FlowTypeV0Schema = typebox_1.Type.Object({
20
- id: typebox_1.Type.String(),
21
- aggregator: typebox_1.Type.String(),
22
- description: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
23
- deleting: typebox_1.Type.Boolean(),
24
- });
25
- /**
26
- * Convert a flow type v0 to a flow type
27
- */
28
- const flowTypeV0ToFlowType = (flowTypeV0, organizationId, dataCoreId) => {
29
- return {
30
- id: flowTypeV0.id,
31
- tenantId: organizationId,
32
- dataCoreId,
33
- name: flowTypeV0.aggregator,
34
- description: flowTypeV0.description ?? "",
35
- isDeleting: flowTypeV0.deleting,
36
- };
37
- };
38
- exports.flowTypeV0ToFlowType = flowTypeV0ToFlowType;