@flowcore/sdk 1.11.9 → 1.12.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 (68) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/esm/commands/container-registry/container-registry.create.d.ts +39 -0
  3. package/esm/commands/container-registry/container-registry.create.d.ts.map +1 -0
  4. package/esm/commands/container-registry/container-registry.create.js +29 -0
  5. package/esm/commands/container-registry/container-registry.delete.d.ts +22 -0
  6. package/esm/commands/container-registry/container-registry.delete.d.ts.map +1 -0
  7. package/esm/commands/container-registry/container-registry.delete.js +26 -0
  8. package/esm/commands/container-registry/container-registry.fetch.d.ts +22 -0
  9. package/esm/commands/container-registry/container-registry.fetch.d.ts.map +1 -0
  10. package/esm/commands/container-registry/container-registry.fetch.js +25 -0
  11. package/esm/commands/container-registry/container-registry.list.d.ts +22 -0
  12. package/esm/commands/container-registry/container-registry.list.d.ts.map +1 -0
  13. package/esm/commands/container-registry/container-registry.list.js +25 -0
  14. package/esm/commands/container-registry/container-registry.update.d.ts +33 -0
  15. package/esm/commands/container-registry/container-registry.update.d.ts.map +1 -0
  16. package/esm/commands/container-registry/container-registry.update.js +27 -0
  17. package/esm/commands/index.d.ts +5 -0
  18. package/esm/commands/index.d.ts.map +1 -1
  19. package/esm/commands/index.js +6 -0
  20. package/esm/commands/tenant/tenant.fetch.d.ts +15 -6
  21. package/esm/commands/tenant/tenant.fetch.d.ts.map +1 -1
  22. package/esm/commands/tenant/tenant.fetch.js +32 -63
  23. package/esm/commands/tenant/tenant.list.d.ts +11 -3
  24. package/esm/commands/tenant/tenant.list.d.ts.map +1 -1
  25. package/esm/commands/tenant/tenant.list.js +12 -3
  26. package/esm/common/notification-client.d.ts +12 -3
  27. package/esm/common/notification-client.d.ts.map +1 -1
  28. package/esm/common/notification-client.js +22 -9
  29. package/esm/contracts/container.d.ts +23 -0
  30. package/esm/contracts/container.d.ts.map +1 -0
  31. package/esm/contracts/container.js +16 -0
  32. package/esm/contracts/tenant.d.ts +19 -26
  33. package/esm/contracts/tenant.d.ts.map +1 -1
  34. package/esm/contracts/tenant.js +19 -24
  35. package/package.json +1 -1
  36. package/script/commands/container-registry/container-registry.create.d.ts +39 -0
  37. package/script/commands/container-registry/container-registry.create.d.ts.map +1 -0
  38. package/script/commands/container-registry/container-registry.create.js +33 -0
  39. package/script/commands/container-registry/container-registry.delete.d.ts +22 -0
  40. package/script/commands/container-registry/container-registry.delete.d.ts.map +1 -0
  41. package/script/commands/container-registry/container-registry.delete.js +30 -0
  42. package/script/commands/container-registry/container-registry.fetch.d.ts +22 -0
  43. package/script/commands/container-registry/container-registry.fetch.d.ts.map +1 -0
  44. package/script/commands/container-registry/container-registry.fetch.js +29 -0
  45. package/script/commands/container-registry/container-registry.list.d.ts +22 -0
  46. package/script/commands/container-registry/container-registry.list.d.ts.map +1 -0
  47. package/script/commands/container-registry/container-registry.list.js +29 -0
  48. package/script/commands/container-registry/container-registry.update.d.ts +33 -0
  49. package/script/commands/container-registry/container-registry.update.d.ts.map +1 -0
  50. package/script/commands/container-registry/container-registry.update.js +31 -0
  51. package/script/commands/index.d.ts +5 -0
  52. package/script/commands/index.d.ts.map +1 -1
  53. package/script/commands/index.js +6 -0
  54. package/script/commands/tenant/tenant.fetch.d.ts +15 -6
  55. package/script/commands/tenant/tenant.fetch.d.ts.map +1 -1
  56. package/script/commands/tenant/tenant.fetch.js +31 -62
  57. package/script/commands/tenant/tenant.list.d.ts +11 -3
  58. package/script/commands/tenant/tenant.list.d.ts.map +1 -1
  59. package/script/commands/tenant/tenant.list.js +12 -3
  60. package/script/common/notification-client.d.ts +12 -3
  61. package/script/common/notification-client.d.ts.map +1 -1
  62. package/script/common/notification-client.js +22 -9
  63. package/script/contracts/container.d.ts +23 -0
  64. package/script/contracts/container.d.ts.map +1 -0
  65. package/script/contracts/container.js +19 -0
  66. package/script/contracts/tenant.d.ts +19 -26
  67. package/script/contracts/tenant.d.ts.map +1 -1
  68. package/script/contracts/tenant.js +19 -25
@@ -1,83 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TenantFetchCommand = void 0;
4
- const typebox_1 = require("@sinclair/typebox");
5
4
  const command_js_1 = require("../../common/command.js");
6
- const tenant_js_1 = require("../../contracts/tenant.js");
7
5
  const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
6
  const not_found_js_1 = require("../../exceptions/not-found.js");
9
- const graphQlQueryById = `
10
- query FLOWCORE_SDK_TENANT_FETCH($tenantId: ID!) {
11
- organization(search: {id: $tenantId}) {
12
- id
13
- org
14
- displayName
15
- description
16
- website
17
- }
18
- }
19
- `;
20
- const graphQlQueryByName = `
21
- query FLOWCORE_SDK_TENANT_FETCH($tenant: String) {
22
- organization(search: {org: $tenant}) {
23
- id
24
- org
25
- displayName
26
- description
27
- website
28
- }
29
- }
30
- `;
31
- const responseSchema = typebox_1.Type.Object({
32
- data: typebox_1.Type.Object({
33
- organization: typebox_1.Type.Union([
34
- tenant_js_1.TenantV0Schema,
35
- typebox_1.Type.Null(),
36
- ]),
37
- }),
38
- });
7
+ const tenant_js_1 = require("../../contracts/tenant.js");
39
8
  /**
40
9
  * Fetch a tenant
41
10
  */
42
- class TenantFetchCommand extends command_js_1.GraphQlCommand {
43
- constructor() {
44
- super(...arguments);
45
- /**
46
- * The allowed modes for the command
47
- */
48
- Object.defineProperty(this, "allowedModes", {
49
- enumerable: true,
50
- configurable: true,
51
- writable: true,
52
- value: ["bearer"]
53
- });
11
+ class TenantFetchCommand extends command_js_1.Command {
12
+ /**
13
+ * Get the method
14
+ */
15
+ getMethod() {
16
+ return "GET";
17
+ }
18
+ /**
19
+ * Get the base url
20
+ */
21
+ getBaseUrl() {
22
+ return "https://tenant.api.flowcore.io";
23
+ }
24
+ /**
25
+ * Get the path
26
+ */
27
+ getPath() {
28
+ if ("tenantId" in this.input) {
29
+ return `/api/v1/tenants/by-id/${this.input.tenantId}`;
30
+ }
31
+ return `/api/v1/tenants/by-name/${this.input.tenant}`;
54
32
  }
55
33
  /**
56
34
  * Parse the response
57
35
  */
58
36
  parseResponse(rawResponse) {
59
- const response = (0, parse_response_helper_js_1.parseResponseHelper)(responseSchema, rawResponse);
60
- if (!response.data.organization) {
61
- throw new not_found_js_1.NotFoundException("Tenant", {
62
- [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant,
63
- });
64
- }
65
- return (0, tenant_js_1.tenantV0ToTenant)(response.data.organization);
37
+ const response = (0, parse_response_helper_js_1.parseResponseHelper)(tenant_js_1.TenantSchema, rawResponse);
38
+ return response;
66
39
  }
67
40
  /**
68
- * Get the body for the request
41
+ * Handle the client error
69
42
  */
70
- getBody() {
71
- if ("tenantId" in this.input) {
72
- return {
73
- query: graphQlQueryById,
74
- variables: this.input,
75
- };
43
+ handleClientError(error) {
44
+ if (error.status === 404) {
45
+ throw new not_found_js_1.NotFoundException("Tenant", {
46
+ [this.input.tenantId ? "id" : "name"]: this.input.tenantId ?? this.input.tenant,
47
+ });
76
48
  }
77
- return {
78
- query: graphQlQueryByName,
79
- variables: this.input,
80
- };
49
+ throw error;
81
50
  }
82
51
  }
83
52
  exports.TenantFetchCommand = TenantFetchCommand;
@@ -1,9 +1,16 @@
1
1
  import { GraphQlCommand } from "../../common/command.js";
2
- import { type TenantWithLinkType } from "../../contracts/tenant.js";
2
+ interface TenantListItem {
3
+ id: string;
4
+ name: string;
5
+ displayName: string;
6
+ description: string;
7
+ websiteUrl: string;
8
+ linkType: "OWNER" | "COLLABORATOR";
9
+ }
3
10
  /**
4
11
  * List tenants
5
12
  */
6
- export declare class TenantListCommand extends GraphQlCommand<void, TenantWithLinkType[]> {
13
+ export declare class TenantListCommand extends GraphQlCommand<void, TenantListItem[]> {
7
14
  /**
8
15
  * The allowed modes for the command
9
16
  */
@@ -11,10 +18,11 @@ export declare class TenantListCommand extends GraphQlCommand<void, TenantWithLi
11
18
  /**
12
19
  * Parse the response
13
20
  */
14
- protected parseResponse(rawResponse: unknown): TenantWithLinkType[];
21
+ protected parseResponse(rawResponse: unknown): TenantListItem[];
15
22
  /**
16
23
  * Get the body for the request
17
24
  */
18
25
  protected getBody(): Record<string, unknown>;
19
26
  }
27
+ export {};
20
28
  //# 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,yBAAyB,CAAA;AACxD,OAAO,EAAoC,KAAK,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAyCrG;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC/E;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,kBAAkB,EAAE;IAa5E;;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,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD,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"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TenantListCommand = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  const command_js_1 = require("../../common/command.js");
6
- const tenant_js_1 = require("../../contracts/tenant.js");
7
6
  const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
8
7
  const command_error_js_1 = require("../../exceptions/command-error.js");
9
8
  const graphQlQueryById = `
@@ -28,7 +27,13 @@ const responseSchema = typebox_1.Type.Object({
28
27
  me: typebox_1.Type.Object({
29
28
  organizations: typebox_1.Type.Array(typebox_1.Type.Object({
30
29
  linkType: typebox_1.Type.Union([typebox_1.Type.Literal("OWNER"), typebox_1.Type.Literal("COLLABORATOR")]),
31
- organization: tenant_js_1.TenantV0Schema,
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
+ }),
32
37
  })),
33
38
  }),
34
39
  }),
@@ -67,7 +72,11 @@ class TenantListCommand extends command_js_1.GraphQlCommand {
67
72
  throw new command_error_js_1.CommandError(this.constructor.name, "No data returned from the command");
68
73
  }
69
74
  return response.data.me.organizations.flatMap((organization) => ({
70
- ...(0, tenant_js_1.tenantV0ToTenant)(organization.organization),
75
+ id: organization.organization.id,
76
+ name: organization.organization.org,
77
+ displayName: organization.organization.displayName,
78
+ description: organization.organization.description,
79
+ websiteUrl: organization.organization.website,
71
80
  linkType: organization.linkType,
72
81
  }));
73
82
  }
@@ -31,13 +31,21 @@ export type NotificationClientOptions = {
31
31
  maxEvents?: number;
32
32
  logger?: Logger;
33
33
  };
34
+ interface NotificationClientAuthOptionsBearer {
35
+ oidcClient: OidcClient;
36
+ }
37
+ interface NotificationClientAuthOptionsApiKey {
38
+ apiKey: string;
39
+ apiKeyId: string;
40
+ }
41
+ type NotificationClientAuthOptions = NotificationClientAuthOptionsBearer | NotificationClientAuthOptionsApiKey;
34
42
  /**
35
43
  * Client for handling WebSocket connections to the Flowcore notification system.
36
44
  * Manages connection lifecycle, authentication, and event handling.
37
45
  */
38
46
  export declare class NotificationClient {
39
47
  private readonly observer;
40
- private readonly oidcClient;
48
+ private readonly authOptions;
41
49
  private readonly subscriptionSpec;
42
50
  private url;
43
51
  private webSocket;
@@ -51,11 +59,11 @@ export declare class NotificationClient {
51
59
  /**
52
60
  * Creates a new NotificationClient instance
53
61
  * @param observer - RxJS Subject for emitting notification events
54
- * @param oidcClient - Client for handling OIDC authentication
62
+ * @param authOptions - Auth options for the client
55
63
  * @param subscriptionSpec - Specification for what notifications to subscribe to
56
64
  * @param options - Configuration options for the client
57
65
  */
58
- constructor(observer: Subject<NotificationEvent>, oidcClient: OidcClient, subscriptionSpec: {
66
+ constructor(observer: Subject<NotificationEvent>, authOptions: NotificationClientAuthOptions, subscriptionSpec: {
59
67
  tenant: string;
60
68
  dataCore: string;
61
69
  flowType?: string;
@@ -87,4 +95,5 @@ export declare class NotificationClient {
87
95
  */
88
96
  overrideBaseUrl(url: string): void;
89
97
  }
98
+ export {};
90
99
  //# sourceMappingURL=notification-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-client.d.ts","sourceRoot":"","sources":["../../src/common/notification-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AASnC,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAM/D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;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EG;IACH,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED;;OAEG;IACG,OAAO;IAmIb;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;OAEG;IACH,UAAU;IAMV;;;OAGG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM;CAGnC"}
1
+ {"version":3,"file":"notification-client.d.ts","sourceRoot":"","sources":["../../src/common/notification-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AASnC,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAM/D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,OAAO,CAAC;QACtB,WAAW,EAAE,MAAM,CAAA;KACpB,CAAC,CAAA;CACH,CAAA;AAcD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAKD,UAAU,mCAAmC;IAC3C,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,UAAU,mCAAmC;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,KAAK,6BAA6B,GAC9B,mCAAmC,GACnC,mCAAmC,CAAA;AAEvC;;;GAGG;AACH,qBAAa,kBAAkB;IAmB3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IApBnC,OAAO,CAAC,GAAG,CAA+C;IAC1D,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,iBAAiB,CAAQ;IACjC,OAAO,CAAC,iBAAiB,CAAI;IAC7B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,aAAa,CAAiB;IAEtC;;;;;;OAMG;gBAEgB,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,EACpC,WAAW,EAAE,6BAA6B,EAC1C,gBAAgB,EAAE;QACjC,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,EACD,OAAO,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC;IAU9C;;OAEG;IACH,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED;;OAEG;IACG,OAAO;IA+Ib;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;OAEG;IACH,UAAU;IAMV;;;OAGG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM;CAGnC"}
@@ -39,22 +39,22 @@ class NotificationClient {
39
39
  /**
40
40
  * Creates a new NotificationClient instance
41
41
  * @param observer - RxJS Subject for emitting notification events
42
- * @param oidcClient - Client for handling OIDC authentication
42
+ * @param authOptions - Auth options for the client
43
43
  * @param subscriptionSpec - Specification for what notifications to subscribe to
44
44
  * @param options - Configuration options for the client
45
45
  */
46
- constructor(observer, oidcClient, subscriptionSpec, options) {
46
+ constructor(observer, authOptions, subscriptionSpec, options) {
47
47
  Object.defineProperty(this, "observer", {
48
48
  enumerable: true,
49
49
  configurable: true,
50
50
  writable: true,
51
51
  value: observer
52
52
  });
53
- Object.defineProperty(this, "oidcClient", {
53
+ Object.defineProperty(this, "authOptions", {
54
54
  enumerable: true,
55
55
  configurable: true,
56
56
  writable: true,
57
- value: oidcClient
57
+ value: authOptions
58
58
  });
59
59
  Object.defineProperty(this, "subscriptionSpec", {
60
60
  enumerable: true,
@@ -144,10 +144,23 @@ class NotificationClient {
144
144
  return;
145
145
  }
146
146
  this._isConnecting = true;
147
- const token = await this.oidcClient.getToken();
148
- const flowcoreClient = new flowcore_client_js_1.FlowcoreClient({
149
- getBearerToken: () => Promise.resolve(token.accessToken),
150
- });
147
+ let flowcoreClient = null;
148
+ const urlParams = new URLSearchParams();
149
+ if ("oidcClient" in this.authOptions) {
150
+ const oidcClient = this.authOptions.oidcClient;
151
+ flowcoreClient = new flowcore_client_js_1.FlowcoreClient({
152
+ getBearerToken: async () => (await oidcClient.getToken()).accessToken,
153
+ });
154
+ urlParams.set("token", (await oidcClient.getToken()).accessToken);
155
+ }
156
+ else {
157
+ flowcoreClient = new flowcore_client_js_1.FlowcoreClient({
158
+ apiKey: this.authOptions.apiKey,
159
+ apiKeyId: this.authOptions.apiKeyId,
160
+ });
161
+ urlParams.set("api_key", this.authOptions.apiKey);
162
+ urlParams.set("api_key_id", this.authOptions.apiKeyId);
163
+ }
151
164
  const tenant = await flowcoreClient.execute(new mod_js_1.TenantFetchCommand({
152
165
  tenant: this.subscriptionSpec.tenant,
153
166
  }));
@@ -169,7 +182,7 @@ class NotificationClient {
169
182
  }));
170
183
  }
171
184
  }
172
- this.webSocket = new dntShim.WebSocket(`${this.url}?token=${encodeURIComponent(token.accessToken)}`);
185
+ this.webSocket = new dntShim.WebSocket(`${this.url}?${urlParams.toString()}`);
173
186
  this.webSocket.onopen = () => {
174
187
  this._isOpen = true;
175
188
  this._isConnecting = false;
@@ -0,0 +1,23 @@
1
+ import { type Static, type TArray, type TObject, type TOptional, type TString } from "@sinclair/typebox";
2
+ /**
3
+ * the schema for a container
4
+ */
5
+ export declare const ContainerRegistrySchema: TObject<{
6
+ tenantId: TString;
7
+ name: TString;
8
+ description: TOptional<TString>;
9
+ username: TOptional<TString>;
10
+ id: TString;
11
+ }>;
12
+ export declare const ContainerRegistryCreateSchema: TObject<{
13
+ id: TString;
14
+ }>;
15
+ export declare const ContainerRegistryDeleteSchema: TObject<{
16
+ id: TString;
17
+ }>;
18
+ export declare const ContainerRegistryListSchema: TArray;
19
+ export type ContainerRegistry = Static<typeof ContainerRegistrySchema>;
20
+ export type ContainerRegistryList = Static<typeof ContainerRegistryListSchema>;
21
+ export type ContainerRegistryCreate = Static<typeof ContainerRegistryCreateSchema>;
22
+ export type ContainerRegistryDelete = Static<typeof ContainerRegistryDeleteSchema>;
23
+ //# sourceMappingURL=container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/contracts/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAE9G;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC5B,EAAE,EAAE,OAAO,CAAA;CACZ,CAMC,CAAA;AAEF,eAAO,MAAM,6BAA6B,EAAE,OAAO,CAAC;IAClD,EAAE,EAAE,OAAO,CAAA;CACZ,CAEC,CAAA;AAEF,eAAO,MAAM,6BAA6B;QALpC,OAAO;EAK6D,CAAA;AAE1E,eAAO,MAAM,2BAA2B,EAAE,MAA4C,CAAA;AAEtF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACtE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAC9E,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAClF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainerRegistryListSchema = exports.ContainerRegistryDeleteSchema = exports.ContainerRegistryCreateSchema = exports.ContainerRegistrySchema = void 0;
4
+ const typebox_1 = require("@sinclair/typebox");
5
+ /**
6
+ * the schema for a container
7
+ */
8
+ exports.ContainerRegistrySchema = typebox_1.Type.Object({
9
+ tenantId: typebox_1.Type.String(),
10
+ name: typebox_1.Type.String(),
11
+ description: typebox_1.Type.Optional(typebox_1.Type.String()),
12
+ username: typebox_1.Type.Optional(typebox_1.Type.String()),
13
+ id: typebox_1.Type.String(),
14
+ });
15
+ exports.ContainerRegistryCreateSchema = typebox_1.Type.Object({
16
+ id: typebox_1.Type.String(),
17
+ });
18
+ exports.ContainerRegistryDeleteSchema = exports.ContainerRegistryCreateSchema;
19
+ exports.ContainerRegistryListSchema = typebox_1.Type.Array(exports.ContainerRegistrySchema);
@@ -1,4 +1,4 @@
1
- import { type Static, type TObject, type TString } from "@sinclair/typebox";
1
+ import { type Static, type TBoolean, type TLiteral, type TNull, type TObject, type TString, type TUnion } from "@sinclair/typebox";
2
2
  interface TenantById {
3
3
  tenantId: string;
4
4
  tenant?: never;
@@ -16,35 +16,28 @@ export declare const TenantSchema: TObject<{
16
16
  name: TString;
17
17
  displayName: TString;
18
18
  description: TString;
19
- website: TString;
19
+ websiteUrl: TString;
20
+ isDedicated: TBoolean;
21
+ dedicated: TUnion<[
22
+ TNull,
23
+ TObject<{
24
+ status: TUnion<[
25
+ TLiteral<"ready">,
26
+ TLiteral<"degraded">,
27
+ TLiteral<"offline">
28
+ ]>;
29
+ configuration: TObject<{
30
+ webhookUrl: TString;
31
+ eventSourceUrl: TString;
32
+ deleteManagerUrl: TString;
33
+ configurationRepoUrl: TString;
34
+ }>;
35
+ }>
36
+ ]>;
20
37
  }>;
21
38
  /**
22
39
  * The type for a tenant
23
40
  */
24
41
  export type Tenant = Static<typeof TenantSchema>;
25
- /**
26
- * The type for a tenant with a link type
27
- */
28
- export type TenantWithLinkType = Tenant & {
29
- linkType: "OWNER" | "COLLABORATOR";
30
- };
31
- /**
32
- * The schema for a tenant v0
33
- */
34
- export declare const TenantV0Schema: TObject<{
35
- id: TString;
36
- org: TString;
37
- displayName: TString;
38
- description: TString;
39
- website: TString;
40
- }>;
41
- /**
42
- * The type for a tenant v0
43
- */
44
- export type TenantV0 = Static<typeof TenantV0Schema>;
45
- /**
46
- * Convert a data core v0 to a data core
47
- */
48
- export declare const tenantV0ToTenant: (tenantV0: TenantV0) => Tenant;
49
42
  export {};
50
43
  //# sourceMappingURL=tenant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.d.ts","sourceRoot":"","sources":["../../src/contracts/tenant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AAEjF,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,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,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,UAAU,EAAE,OAAO,CAAA;gBACnB,cAAc,EAAE,OAAO,CAAA;gBACvB,gBAAgB,EAAE,OAAO,CAAA;gBACzB,oBAAoB,EAAE,OAAO,CAAA;aAC9B,CAAC,CAAA;SACH,CAAC;KACH,CAAC,CAAA;CACH,CAuBC,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tenantV0ToTenant = exports.TenantV0Schema = exports.TenantSchema = void 0;
3
+ exports.TenantSchema = void 0;
4
4
  const typebox_1 = require("@sinclair/typebox");
5
5
  /**
6
6
  * The schema for a tenant
@@ -10,28 +10,22 @@ exports.TenantSchema = typebox_1.Type.Object({
10
10
  name: typebox_1.Type.String(),
11
11
  displayName: typebox_1.Type.String(),
12
12
  description: typebox_1.Type.String(),
13
- website: typebox_1.Type.String(),
13
+ websiteUrl: typebox_1.Type.String(),
14
+ isDedicated: typebox_1.Type.Boolean(),
15
+ dedicated: typebox_1.Type.Union([
16
+ typebox_1.Type.Null(),
17
+ typebox_1.Type.Object({
18
+ status: typebox_1.Type.Union([
19
+ typebox_1.Type.Literal("ready"),
20
+ typebox_1.Type.Literal("degraded"),
21
+ typebox_1.Type.Literal("offline"),
22
+ ]),
23
+ configuration: typebox_1.Type.Object({
24
+ webhookUrl: typebox_1.Type.String(),
25
+ eventSourceUrl: typebox_1.Type.String(),
26
+ deleteManagerUrl: typebox_1.Type.String(),
27
+ configurationRepoUrl: typebox_1.Type.String(),
28
+ }),
29
+ }),
30
+ ]),
14
31
  });
15
- /**
16
- * The schema for a tenant v0
17
- */
18
- exports.TenantV0Schema = typebox_1.Type.Object({
19
- id: typebox_1.Type.String(),
20
- org: typebox_1.Type.String(),
21
- displayName: typebox_1.Type.String(),
22
- description: typebox_1.Type.String(),
23
- website: typebox_1.Type.String(),
24
- });
25
- /**
26
- * Convert a data core v0 to a data core
27
- */
28
- const tenantV0ToTenant = (tenantV0) => {
29
- return {
30
- id: tenantV0.id,
31
- name: tenantV0.org,
32
- displayName: tenantV0.displayName,
33
- description: tenantV0.description,
34
- website: tenantV0.website,
35
- };
36
- };
37
- exports.tenantV0ToTenant = tenantV0ToTenant;