@flowcore/sdk 1.53.0 → 1.55.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 (50) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/esm/commands/api-key/api-key.create.d.ts +20 -23
  3. package/esm/commands/api-key/api-key.create.d.ts.map +1 -1
  4. package/esm/commands/api-key/api-key.create.js +21 -62
  5. package/esm/commands/api-key/api-key.delete.d.ts +22 -12
  6. package/esm/commands/api-key/api-key.delete.d.ts.map +1 -1
  7. package/esm/commands/api-key/api-key.delete.js +27 -41
  8. package/esm/commands/api-key/api-key.edit.d.ts +41 -0
  9. package/esm/commands/api-key/api-key.edit.d.ts.map +1 -0
  10. package/esm/commands/api-key/api-key.edit.js +40 -0
  11. package/esm/commands/api-key/api-key.list.d.ts +20 -8
  12. package/esm/commands/api-key/api-key.list.d.ts.map +1 -1
  13. package/esm/commands/api-key/api-key.list.js +27 -36
  14. package/esm/commands/index.d.ts +1 -0
  15. package/esm/commands/index.d.ts.map +1 -1
  16. package/esm/commands/index.js +1 -0
  17. package/esm/commands/tenant/tenant.list.d.ts +13 -17
  18. package/esm/commands/tenant/tenant.list.d.ts.map +1 -1
  19. package/esm/commands/tenant/tenant.list.js +20 -66
  20. package/esm/contracts/api-key.d.ts +22 -1
  21. package/esm/contracts/api-key.d.ts.map +1 -1
  22. package/esm/contracts/api-key.js +17 -0
  23. package/esm/contracts/tenant.d.ts +17 -1
  24. package/esm/contracts/tenant.d.ts.map +1 -1
  25. package/esm/contracts/tenant.js +12 -0
  26. package/package.json +1 -1
  27. package/script/commands/api-key/api-key.create.d.ts +20 -23
  28. package/script/commands/api-key/api-key.create.d.ts.map +1 -1
  29. package/script/commands/api-key/api-key.create.js +21 -62
  30. package/script/commands/api-key/api-key.delete.d.ts +22 -12
  31. package/script/commands/api-key/api-key.delete.d.ts.map +1 -1
  32. package/script/commands/api-key/api-key.delete.js +27 -41
  33. package/script/commands/api-key/api-key.edit.d.ts +41 -0
  34. package/script/commands/api-key/api-key.edit.d.ts.map +1 -0
  35. package/script/commands/api-key/api-key.edit.js +44 -0
  36. package/script/commands/api-key/api-key.list.d.ts +20 -8
  37. package/script/commands/api-key/api-key.list.d.ts.map +1 -1
  38. package/script/commands/api-key/api-key.list.js +27 -36
  39. package/script/commands/index.d.ts +1 -0
  40. package/script/commands/index.d.ts.map +1 -1
  41. package/script/commands/index.js +1 -0
  42. package/script/commands/tenant/tenant.list.d.ts +13 -17
  43. package/script/commands/tenant/tenant.list.d.ts.map +1 -1
  44. package/script/commands/tenant/tenant.list.js +20 -66
  45. package/script/contracts/api-key.d.ts +22 -1
  46. package/script/contracts/api-key.d.ts.map +1 -1
  47. package/script/contracts/api-key.js +18 -1
  48. package/script/contracts/tenant.d.ts +17 -1
  49. package/script/contracts/tenant.d.ts.map +1 -1
  50. package/script/contracts/tenant.js +13 -1
@@ -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,35 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiKeyListCommand = void 0;
4
- const typebox_1 = require("@sinclair/typebox");
5
- const command_graphql_js_1 = require("../../common/command-graphql.js");
4
+ const command_js_1 = require("../../common/command.js");
6
5
  const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
7
- const graphQlQueryById = `
8
- query FLOWCORE_SDK_API_KEY_LIST($tenantId: ID!) {
9
- organization(search: {id: $tenantId}) {
10
- apiKeys {
11
- id
12
- name
13
- createdAt
14
- }
15
- }
16
- }
17
- `;
18
- const responseSchema = typebox_1.Type.Object({
19
- data: typebox_1.Type.Object({
20
- organization: typebox_1.Type.Object({
21
- apiKeys: typebox_1.Type.Array(typebox_1.Type.Object({
22
- id: typebox_1.Type.String(),
23
- name: typebox_1.Type.String(),
24
- createdAt: typebox_1.Type.String(),
25
- })),
26
- }),
27
- }),
28
- });
6
+ const typebox_1 = require("@sinclair/typebox");
7
+ const api_key_js_1 = require("../../contracts/api-key.js");
29
8
  /**
30
9
  * List api keys
31
10
  */
32
- class ApiKeyListCommand extends command_graphql_js_1.GraphQlCommand {
11
+ class ApiKeyListCommand extends command_js_1.Command {
12
+ /**
13
+ * Whether the command should retry on failure
14
+ */
15
+ retryOnFailure = false;
16
+ /**
17
+ * Get the method
18
+ */
19
+ getMethod() {
20
+ return "GET";
21
+ }
22
+ /**
23
+ * Get the base url
24
+ */
25
+ getBaseUrl() {
26
+ return "https://tenant-store.api.flowcore.io";
27
+ }
28
+ /**
29
+ * Get the path
30
+ */
31
+ getPath() {
32
+ return `/api/v1/api-keys?tenantId=${this.input.tenantId}`;
33
+ }
33
34
  /**
34
35
  * The allowed modes for the command
35
36
  */
@@ -38,17 +39,7 @@ class ApiKeyListCommand extends command_graphql_js_1.GraphQlCommand {
38
39
  * Parse the response
39
40
  */
40
41
  parseResponse(rawResponse) {
41
- const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
42
- return response.data.organization.apiKeys;
43
- }
44
- /**
45
- * Get the body for the request
46
- */
47
- getBody() {
48
- return {
49
- query: graphQlQueryById,
50
- variables: this.input,
51
- };
42
+ return (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Array(api_key_js_1.ApiKeySchema), rawResponse);
52
43
  }
53
44
  }
54
45
  exports.ApiKeyListCommand = ApiKeyListCommand;
@@ -5,6 +5,7 @@ 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";
@@ -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;AACvC,cAAc,yBAAyB,CAAA;AAGvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc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  // Api Key
26
26
  __exportStar(require("./api-key/api-key.create.js"), exports);
27
+ __exportStar(require("./api-key/api-key.edit.js"), exports);
27
28
  __exportStar(require("./api-key/api-key.delete.js"), exports);
28
29
  __exportStar(require("./api-key/api-key.list.js"), exports);
29
30
  // Secret
@@ -1,28 +1,24 @@
1
- import { GraphQlCommand } from "../../common/command-graphql.js";
2
- interface TenantListItem {
3
- id: string;
4
- name: string;
5
- displayName: string;
6
- description: string;
7
- websiteUrl: string;
8
- linkType: "OWNER" | "COLLABORATOR";
9
- }
1
+ import { Command } from "../../common/command.js";
2
+ import { type TenantListItem } from "../../contracts/tenant.js";
10
3
  /**
11
4
  * List tenants
12
5
  */
13
- export declare class TenantListCommand extends GraphQlCommand<void, TenantListItem[]> {
6
+ export declare class TenantListCommand extends Command<Record<string, never>, TenantListItem[]> {
14
7
  /**
15
- * The allowed modes for the command
8
+ * Get the method
16
9
  */
17
- protected allowedModes: ("apiKey" | "bearer")[];
10
+ protected getMethod(): string;
18
11
  /**
19
- * Parse the response
12
+ * Get the base url
20
13
  */
21
- protected parseResponse(rawResponse: unknown): TenantListItem[];
14
+ protected getBaseUrl(): string;
22
15
  /**
23
- * Get the body for the request
16
+ * Get the path
24
17
  */
25
- protected getBody(): Record<string, unknown>;
18
+ protected getPath(): string;
19
+ /**
20
+ * Parse the response
21
+ */
22
+ protected parseResponse(rawResponse: unknown): TenantListItem[];
26
23
  }
27
- export {};
28
24
  //# sourceMappingURL=tenant.list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.list.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAIhE,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,OAAO,GAAG,cAAc,CAAA;CACnC;AA6CD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC;IAC3E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,cAAc,EAAE;IAiBxE;;OAEG;cACgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAKtD"}
1
+ {"version":3,"file":"tenant.list.d.ts","sourceRoot":"","sources":["../../../src/commands/tenant/tenant.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,2BAA2B,CAAA;AAGrF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACrF;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,cAAc,EAAE;CAIzE"}
@@ -2,83 +2,37 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TenantListCommand = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
- const command_graphql_js_1 = require("../../common/command-graphql.js");
5
+ const command_js_1 = require("../../common/command.js");
6
+ const tenant_js_1 = require("../../contracts/tenant.js");
6
7
  const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
7
- const command_error_js_1 = require("../../exceptions/command-error.js");
8
- const graphQlQueryById = `
9
- query FLOWCORE_SDK_TENANT_LIST {
10
- me {
11
- organizations {
12
- linkType
13
- organization {
14
- id
15
- org
16
- displayName
17
- description
18
- website
19
- }
20
- }
21
- }
22
- }
23
- `;
24
- const responseSchema = typebox_1.Type.Object({
25
- data: typebox_1.Type.Union([
26
- typebox_1.Type.Object({
27
- me: typebox_1.Type.Object({
28
- organizations: typebox_1.Type.Array(typebox_1.Type.Object({
29
- linkType: typebox_1.Type.Union([typebox_1.Type.Literal("OWNER"), typebox_1.Type.Literal("COLLABORATOR")]),
30
- organization: typebox_1.Type.Object({
31
- id: typebox_1.Type.String(),
32
- org: typebox_1.Type.String(),
33
- displayName: typebox_1.Type.String(),
34
- description: typebox_1.Type.String(),
35
- website: typebox_1.Type.String(),
36
- }),
37
- })),
38
- }),
39
- }),
40
- typebox_1.Type.Null(),
41
- ]),
42
- errors: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
43
- message: typebox_1.Type.String(),
44
- path: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())),
45
- }))),
46
- });
47
8
  /**
48
9
  * List tenants
49
10
  */
50
- class TenantListCommand extends command_graphql_js_1.GraphQlCommand {
11
+ class TenantListCommand extends command_js_1.Command {
51
12
  /**
52
- * The allowed modes for the command
13
+ * Get the method
53
14
  */
54
- allowedModes = ["bearer"];
15
+ getMethod() {
16
+ return "GET";
17
+ }
55
18
  /**
56
- * Parse the response
19
+ * Get the base url
57
20
  */
58
- parseResponse(rawResponse) {
59
- const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
60
- if (response.errors?.length) {
61
- throw new command_error_js_1.CommandError(this.constructor.name, response.errors.map((error) => error.message).join("; "));
62
- }
63
- else if (!response.data) {
64
- throw new command_error_js_1.CommandError(this.constructor.name, "No data returned from the command");
65
- }
66
- return response.data.me.organizations.flatMap((organization) => ({
67
- id: organization.organization.id,
68
- name: organization.organization.org,
69
- displayName: organization.organization.displayName,
70
- description: organization.organization.description,
71
- websiteUrl: organization.organization.website,
72
- linkType: organization.linkType,
73
- }));
21
+ getBaseUrl() {
22
+ return "https://tenant.api.flowcore.io";
74
23
  }
75
24
  /**
76
- * Get the body for the request
25
+ * Get the path
77
26
  */
78
- getBody() {
79
- return {
80
- query: graphQlQueryById,
81
- };
27
+ getPath() {
28
+ return `/api/v1/tenants/list`;
29
+ }
30
+ /**
31
+ * Parse the response
32
+ */
33
+ parseResponse(rawResponse) {
34
+ const response = (0, parse_response_helper_js_1.parseResponseHelper)(typebox_1.Type.Array(tenant_js_1.TenantListItemSchema), rawResponse);
35
+ return response;
82
36
  }
83
37
  }
84
38
  exports.TenantListCommand = TenantListCommand;
@@ -1,14 +1,35 @@
1
- import { type Static, type TObject, type TString } from "@sinclair/typebox";
1
+ import { type Static, type TNull, type TObject, type TString, type TUnion } from "@sinclair/typebox";
2
2
  /**
3
3
  * The schema for an api key
4
4
  */
5
5
  export declare const ApiKeySchema: TObject<{
6
6
  id: TString;
7
+ tenantId: TString;
7
8
  name: TString;
9
+ description: TString;
10
+ maskedApiKey: TString;
8
11
  createdAt: TString;
12
+ lastUsedAt: TUnion<[TString, TNull]>;
9
13
  }>;
10
14
  /**
11
15
  * The type for an api key
12
16
  */
13
17
  export type ApiKey = Static<typeof ApiKeySchema>;
18
+ /**
19
+ * The schema for an api key with value
20
+ */
21
+ export declare const ApiKeyWithValueSchema: TObject<{
22
+ id: TString;
23
+ tenantId: TString;
24
+ name: TString;
25
+ description: TString;
26
+ maskedApiKey: TString;
27
+ createdAt: TString;
28
+ lastUsedAt: TUnion<[TString, TNull]>;
29
+ apiKey: TString;
30
+ }>;
31
+ /**
32
+ * The type for an api key with value
33
+ */
34
+ export type ApiKeyWithValue = Static<typeof ApiKeyWithValueSchema>;
14
35
  //# sourceMappingURL=api-key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.d.ts","sourceRoot":"","sources":["../../src/contracts/api-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mB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AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -1,12 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiKeySchema = void 0;
3
+ exports.ApiKeyWithValueSchema = exports.ApiKeySchema = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  /**
6
6
  * The schema for an api key
7
7
  */
8
8
  exports.ApiKeySchema = typebox_1.Type.Object({
9
9
  id: typebox_1.Type.String(),
10
+ tenantId: typebox_1.Type.String(),
10
11
  name: typebox_1.Type.String(),
12
+ description: typebox_1.Type.String(),
13
+ maskedApiKey: typebox_1.Type.String(),
11
14
  createdAt: typebox_1.Type.String(),
15
+ lastUsedAt: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
16
+ });
17
+ /**
18
+ * The schema for an api key with value
19
+ */
20
+ exports.ApiKeyWithValueSchema = typebox_1.Type.Object({
21
+ id: typebox_1.Type.String(),
22
+ tenantId: typebox_1.Type.String(),
23
+ name: typebox_1.Type.String(),
24
+ description: typebox_1.Type.String(),
25
+ maskedApiKey: typebox_1.Type.String(),
26
+ createdAt: typebox_1.Type.String(),
27
+ lastUsedAt: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
28
+ apiKey: typebox_1.Type.String(),
12
29
  });
@@ -1,4 +1,4 @@
1
- import { type Static, type TBoolean, type TLiteral, type TNull, type TObject, type TOptional, type TString, type TUnion } from "@sinclair/typebox";
1
+ import { type Static, type TArray, type TBoolean, type TLiteral, type TNull, type TObject, type TOptional, type TString, type TUnion } from "@sinclair/typebox";
2
2
  interface TenantById {
3
3
  tenantId: string;
4
4
  tenant?: never;
@@ -39,5 +39,21 @@ export declare const TenantSchema: TObject<{
39
39
  * The type for a tenant
40
40
  */
41
41
  export type Tenant = Static<typeof TenantSchema>;
42
+ /**
43
+ * The schema for a tenant list item
44
+ */
45
+ export declare const TenantListItemSchema: TObject<{
46
+ id: TString;
47
+ name: TString;
48
+ displayName: TString;
49
+ description: TString;
50
+ websiteUrl: TString;
51
+ isDedicated: TBoolean;
52
+ permissions: TArray<TString>;
53
+ }>;
54
+ /**
55
+ * The type for a tenant list item
56
+ */
57
+ export type TenantListItem = Static<typeof TenantListItemSchema>;
42
58
  export {};
43
59
  //# sourceMappingURL=tenant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.d.ts","sourceRoot":"","sources":["../../src/contracts/tenant.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,KAAK,CAAA;CACf;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,CAAA;AAExD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC;IACjC,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,QAAQ,CAAA;IACrB,SAAS,EAAE,MAAM,CAAC;QAChB,KAAK;QACL,OAAO,CAAC;YACN,MAAM,EAAE,MAAM,CAAC;gBACb,QAAQ,CAAC,OAAO,CAAC;gBACjB,QAAQ,CAAC,UAAU,CAAC;gBACpB,QAAQ,CAAC,SAAS,CAAC;aACpB,CAAC,CAAA;YACF,aAAa,EAAE,OAAO,CAAC;gBACrB,MAAM,EAAE,OAA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,OAAO,CAAC;gBACrB,MAAM,EAAE,OAAO,CAAA;gBACf,oBAAoB,EAAE,OAAO,CAAA;gBAC7B,4BAA4B,EAAE,OAAO,CAAA;aACtC,CAAC,CAAA;SACH,CAAC;KACH,CAAC,CAAA;IACF,oBAAoB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;CAC1C,CAuBC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,YAAY,CAAC,CAAA;AAEhD;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC;IACzC,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,QAAQ,CAAA;IACrB,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;CAC7B,CAQC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TenantSchema = void 0;
3
+ exports.TenantListItemSchema = exports.TenantSchema = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  /**
6
6
  * The schema for a tenant
@@ -29,3 +29,15 @@ exports.TenantSchema = typebox_1.Type.Object({
29
29
  ]),
30
30
  sensitiveDataEnabled: typebox_1.Type.Optional(typebox_1.Type.Boolean()),
31
31
  });
32
+ /**
33
+ * The schema for a tenant list item
34
+ */
35
+ exports.TenantListItemSchema = typebox_1.Type.Object({
36
+ id: typebox_1.Type.String(),
37
+ name: typebox_1.Type.String(),
38
+ displayName: typebox_1.Type.String(),
39
+ description: typebox_1.Type.String(),
40
+ websiteUrl: typebox_1.Type.String(),
41
+ isDedicated: typebox_1.Type.Boolean(),
42
+ permissions: typebox_1.Type.Array(typebox_1.Type.String()),
43
+ });