@scalekit-sdk/node 1.0.3 → 1.0.5
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/.github/dependabot.yml +10 -0
- package/README.md +81 -11
- package/lib/connect.js +5 -4
- package/lib/connect.js.map +1 -1
- package/lib/connection.d.ts +17 -3
- package/lib/connection.js +36 -2
- package/lib/connection.js.map +1 -1
- package/lib/constants/user.d.ts +1 -1
- package/lib/core.d.ts +9 -5
- package/lib/core.js +27 -23
- package/lib/core.js.map +1 -1
- package/lib/domain.d.ts +1 -12
- package/lib/domain.js +0 -19
- package/lib/domain.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/organization.d.ts +22 -4
- package/lib/organization.js +44 -7
- package/lib/organization.js.map +1 -1
- package/lib/scalekit.d.ts +12 -14
- package/lib/scalekit.js +18 -14
- package/lib/scalekit.js.map +1 -1
- package/lib/types/{user.d.ts → auth.d.ts} +5 -0
- package/lib/types/{user.js → auth.js} +1 -1
- package/lib/types/auth.js.map +1 -0
- package/lib/types/scalekit.d.ts +10 -9
- package/lib/types/scalekit.js.map +1 -1
- package/package.json +10 -11
- package/src/connect.ts +5 -5
- package/src/connection.ts +38 -15
- package/src/constants/user.ts +1 -1
- package/src/core.ts +32 -25
- package/src/domain.ts +0 -21
- package/src/index.ts +4 -4
- package/src/organization.ts +52 -5
- package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/connections/connections_connect.ts +64 -1
- package/src/pkg/grpc/scalekit/v1/connections/connections_pb.ts +508 -156
- package/src/pkg/grpc/scalekit/v1/domains/domains_connect.ts +10 -1
- package/src/pkg/grpc/scalekit/v1/domains/domains_pb.ts +75 -1
- package/src/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/options/options_pb.ts +9 -1
- package/src/pkg/grpc/scalekit/v1/organizations/organizations_connect.ts +19 -1
- package/src/pkg/grpc/scalekit/v1/organizations/organizations_pb.ts +142 -1
- package/src/scalekit.ts +27 -17
- package/src/types/{user.ts → auth.ts} +6 -0
- package/src/types/scalekit.ts +11 -10
- package/lib/types/user.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
5
5
|
|
|
6
|
-
import { CreateDomainRequest, CreateDomainResponse, DeleteDomainRequest, GetDomainRequest, GetDomainResponse, ListDomainRequest, ListDomainResponse, UpdateDomainRequest, UpdateDomainResponse } from "./domains_pb.js";
|
|
6
|
+
import { CreateDomainRequest, CreateDomainResponse, DeleteDomainRequest, GetDomainRequest, GetDomainResponse, ListAuthorizedDomainRequest, ListAuthorizedDomainResponse, ListDomainRequest, ListDomainResponse, UpdateDomainRequest, UpdateDomainResponse } from "./domains_pb.js";
|
|
7
7
|
import { Empty, MethodKind } from "@bufbuild/protobuf";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -57,6 +57,15 @@ export const DomainService = {
|
|
|
57
57
|
O: ListDomainResponse,
|
|
58
58
|
kind: MethodKind.Unary,
|
|
59
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* @generated from rpc scalekit.v1.domains.DomainService.ListAuthorizedDomains
|
|
62
|
+
*/
|
|
63
|
+
listAuthorizedDomains: {
|
|
64
|
+
name: "ListAuthorizedDomains",
|
|
65
|
+
I: ListAuthorizedDomainRequest,
|
|
66
|
+
O: ListAuthorizedDomainResponse,
|
|
67
|
+
kind: MethodKind.Unary,
|
|
68
|
+
},
|
|
60
69
|
}
|
|
61
70
|
} as const;
|
|
62
71
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
1
|
+
// @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
|
|
2
2
|
// @generated from file scalekit/v1/domains/domains.proto (package scalekit.v1.domains, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
@@ -588,6 +588,80 @@ export class ListDomainResponse extends Message<ListDomainResponse> {
|
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
+
/**
|
|
592
|
+
* @generated from message scalekit.v1.domains.ListAuthorizedDomainRequest
|
|
593
|
+
*/
|
|
594
|
+
export class ListAuthorizedDomainRequest extends Message<ListAuthorizedDomainRequest> {
|
|
595
|
+
/**
|
|
596
|
+
* @generated from field: string origin = 1;
|
|
597
|
+
*/
|
|
598
|
+
origin = "";
|
|
599
|
+
|
|
600
|
+
constructor(data?: PartialMessage<ListAuthorizedDomainRequest>) {
|
|
601
|
+
super();
|
|
602
|
+
proto3.util.initPartial(data, this);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
606
|
+
static readonly typeName = "scalekit.v1.domains.ListAuthorizedDomainRequest";
|
|
607
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
608
|
+
{ no: 1, name: "origin", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
609
|
+
]);
|
|
610
|
+
|
|
611
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListAuthorizedDomainRequest {
|
|
612
|
+
return new ListAuthorizedDomainRequest().fromBinary(bytes, options);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListAuthorizedDomainRequest {
|
|
616
|
+
return new ListAuthorizedDomainRequest().fromJson(jsonValue, options);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListAuthorizedDomainRequest {
|
|
620
|
+
return new ListAuthorizedDomainRequest().fromJsonString(jsonString, options);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
static equals(a: ListAuthorizedDomainRequest | PlainMessage<ListAuthorizedDomainRequest> | undefined, b: ListAuthorizedDomainRequest | PlainMessage<ListAuthorizedDomainRequest> | undefined): boolean {
|
|
624
|
+
return proto3.util.equals(ListAuthorizedDomainRequest, a, b);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* @generated from message scalekit.v1.domains.ListAuthorizedDomainResponse
|
|
630
|
+
*/
|
|
631
|
+
export class ListAuthorizedDomainResponse extends Message<ListAuthorizedDomainResponse> {
|
|
632
|
+
/**
|
|
633
|
+
* @generated from field: repeated string domains = 1;
|
|
634
|
+
*/
|
|
635
|
+
domains: string[] = [];
|
|
636
|
+
|
|
637
|
+
constructor(data?: PartialMessage<ListAuthorizedDomainResponse>) {
|
|
638
|
+
super();
|
|
639
|
+
proto3.util.initPartial(data, this);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
643
|
+
static readonly typeName = "scalekit.v1.domains.ListAuthorizedDomainResponse";
|
|
644
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
645
|
+
{ no: 1, name: "domains", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
646
|
+
]);
|
|
647
|
+
|
|
648
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListAuthorizedDomainResponse {
|
|
649
|
+
return new ListAuthorizedDomainResponse().fromBinary(bytes, options);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListAuthorizedDomainResponse {
|
|
653
|
+
return new ListAuthorizedDomainResponse().fromJson(jsonValue, options);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListAuthorizedDomainResponse {
|
|
657
|
+
return new ListAuthorizedDomainResponse().fromJsonString(jsonString, options);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
static equals(a: ListAuthorizedDomainResponse | PlainMessage<ListAuthorizedDomainResponse> | undefined, b: ListAuthorizedDomainResponse | PlainMessage<ListAuthorizedDomainResponse> | undefined): boolean {
|
|
661
|
+
return proto3.util.equals(ListAuthorizedDomainResponse, a, b);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
591
665
|
/**
|
|
592
666
|
* @generated from message scalekit.v1.domains.Domain
|
|
593
667
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
1
|
+
// @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
|
|
2
2
|
// @generated from file scalekit/v1/errdetails/errdetails.proto (package scalekit.v1.errdetails, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
1
|
+
// @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
|
|
2
2
|
// @generated from file scalekit/v1/options/options.proto (package scalekit.v1.options, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
@@ -52,6 +52,13 @@ export enum AuthenticationType {
|
|
|
52
52
|
*/
|
|
53
53
|
WORKSPACE_SESSION = 80,
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* workspace_id,organization_id is in claims and UI in audience
|
|
57
|
+
*
|
|
58
|
+
* @generated from enum value: WORKSPACE_SESSION_CUSTOMER_PORTAL = 112;
|
|
59
|
+
*/
|
|
60
|
+
WORKSPACE_SESSION_CUSTOMER_PORTAL = 112,
|
|
61
|
+
|
|
55
62
|
/**
|
|
56
63
|
* user_id is in claims
|
|
57
64
|
*
|
|
@@ -95,6 +102,7 @@ proto3.util.setEnumType(AuthenticationType, "scalekit.v1.options.AuthenticationT
|
|
|
95
102
|
{ no: 32, name: "CUSTOMER_PORTAL" },
|
|
96
103
|
{ no: 16, name: "SESSION" },
|
|
97
104
|
{ no: 80, name: "WORKSPACE_SESSION" },
|
|
105
|
+
{ no: 112, name: "WORKSPACE_SESSION_CUSTOMER_PORTAL" },
|
|
98
106
|
{ no: 8, name: "USER" },
|
|
99
107
|
{ no: 4, name: "CLIENT" },
|
|
100
108
|
{ no: 20, name: "SESSION_CLIENT" },
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
5
5
|
|
|
6
|
-
import { CreateOrganizationRequest, CreateOrganizationResponse, DeleteOrganizationRequest, DeletePortalLinkRequest, GeneratePortalLinkRequest, GeneratePortalLinkResponse, GetOrganizationRequest, GetOrganizationResponse, GetPortalLinkRequest, GetPortalLinksResponse, ListOrganizationsRequest, ListOrganizationsResponse, UpdateOrganizationRequest, UpdateOrganizationResponse } from "./organizations_pb.js";
|
|
6
|
+
import { CreateOrganizationRequest, CreateOrganizationResponse, DeleteOrganizationRequest, DeletePortalLinkByIdRequest, DeletePortalLinkRequest, GeneratePortalLinkRequest, GeneratePortalLinkResponse, GetOrganizationRequest, GetOrganizationResponse, GetPortalLinkRequest, GetPortalLinksResponse, ListOrganizationsRequest, ListOrganizationsResponse, SearchOrganizationsRequest, SearchOrganizationsResponse, UpdateOrganizationRequest, UpdateOrganizationResponse } from "./organizations_pb.js";
|
|
7
7
|
import { Empty, MethodKind } from "@bufbuild/protobuf";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -50,6 +50,15 @@ export const OrganizationService = {
|
|
|
50
50
|
O: ListOrganizationsResponse,
|
|
51
51
|
kind: MethodKind.Unary,
|
|
52
52
|
},
|
|
53
|
+
/**
|
|
54
|
+
* @generated from rpc scalekit.v1.organizations.OrganizationService.SearchOrganization
|
|
55
|
+
*/
|
|
56
|
+
searchOrganization: {
|
|
57
|
+
name: "SearchOrganization",
|
|
58
|
+
I: SearchOrganizationsRequest,
|
|
59
|
+
O: SearchOrganizationsResponse,
|
|
60
|
+
kind: MethodKind.Unary,
|
|
61
|
+
},
|
|
53
62
|
/**
|
|
54
63
|
* Delete an Organization
|
|
55
64
|
*
|
|
@@ -81,6 +90,15 @@ export const OrganizationService = {
|
|
|
81
90
|
O: Empty,
|
|
82
91
|
kind: MethodKind.Unary,
|
|
83
92
|
},
|
|
93
|
+
/**
|
|
94
|
+
* @generated from rpc scalekit.v1.organizations.OrganizationService.DeletePortalLinkByID
|
|
95
|
+
*/
|
|
96
|
+
deletePortalLinkByID: {
|
|
97
|
+
name: "DeletePortalLinkByID",
|
|
98
|
+
I: DeletePortalLinkByIdRequest,
|
|
99
|
+
O: Empty,
|
|
100
|
+
kind: MethodKind.Unary,
|
|
101
|
+
},
|
|
84
102
|
/**
|
|
85
103
|
* @generated from rpc scalekit.v1.organizations.OrganizationService.GetPortalLinks
|
|
86
104
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
1
|
+
// @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
|
|
2
2
|
// @generated from file scalekit/v1/organizations/organizations.proto (package scalekit.v1.organizations, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
@@ -562,6 +562,104 @@ export class ListOrganizationsResponse extends Message<ListOrganizationsResponse
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
+
/**
|
|
566
|
+
* @generated from message scalekit.v1.organizations.SearchOrganizationsRequest
|
|
567
|
+
*/
|
|
568
|
+
export class SearchOrganizationsRequest extends Message<SearchOrganizationsRequest> {
|
|
569
|
+
/**
|
|
570
|
+
* @generated from field: string query = 1;
|
|
571
|
+
*/
|
|
572
|
+
query = "";
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* @generated from field: uint32 page_size = 2;
|
|
576
|
+
*/
|
|
577
|
+
pageSize = 0;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @generated from field: string page_token = 3;
|
|
581
|
+
*/
|
|
582
|
+
pageToken = "";
|
|
583
|
+
|
|
584
|
+
constructor(data?: PartialMessage<SearchOrganizationsRequest>) {
|
|
585
|
+
super();
|
|
586
|
+
proto3.util.initPartial(data, this);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
590
|
+
static readonly typeName = "scalekit.v1.organizations.SearchOrganizationsRequest";
|
|
591
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
592
|
+
{ no: 1, name: "query", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
593
|
+
{ no: 2, name: "page_size", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
594
|
+
{ no: 3, name: "page_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
595
|
+
]);
|
|
596
|
+
|
|
597
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SearchOrganizationsRequest {
|
|
598
|
+
return new SearchOrganizationsRequest().fromBinary(bytes, options);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SearchOrganizationsRequest {
|
|
602
|
+
return new SearchOrganizationsRequest().fromJson(jsonValue, options);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SearchOrganizationsRequest {
|
|
606
|
+
return new SearchOrganizationsRequest().fromJsonString(jsonString, options);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
static equals(a: SearchOrganizationsRequest | PlainMessage<SearchOrganizationsRequest> | undefined, b: SearchOrganizationsRequest | PlainMessage<SearchOrganizationsRequest> | undefined): boolean {
|
|
610
|
+
return proto3.util.equals(SearchOrganizationsRequest, a, b);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* @generated from message scalekit.v1.organizations.SearchOrganizationsResponse
|
|
616
|
+
*/
|
|
617
|
+
export class SearchOrganizationsResponse extends Message<SearchOrganizationsResponse> {
|
|
618
|
+
/**
|
|
619
|
+
* @generated from field: string next_page_token = 1;
|
|
620
|
+
*/
|
|
621
|
+
nextPageToken = "";
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* @generated from field: uint32 total_size = 2;
|
|
625
|
+
*/
|
|
626
|
+
totalSize = 0;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* @generated from field: repeated scalekit.v1.organizations.Organization organizations = 3;
|
|
630
|
+
*/
|
|
631
|
+
organizations: Organization[] = [];
|
|
632
|
+
|
|
633
|
+
constructor(data?: PartialMessage<SearchOrganizationsResponse>) {
|
|
634
|
+
super();
|
|
635
|
+
proto3.util.initPartial(data, this);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
639
|
+
static readonly typeName = "scalekit.v1.organizations.SearchOrganizationsResponse";
|
|
640
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
641
|
+
{ no: 1, name: "next_page_token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
642
|
+
{ no: 2, name: "total_size", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
|
|
643
|
+
{ no: 3, name: "organizations", kind: "message", T: Organization, repeated: true },
|
|
644
|
+
]);
|
|
645
|
+
|
|
646
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SearchOrganizationsResponse {
|
|
647
|
+
return new SearchOrganizationsResponse().fromBinary(bytes, options);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SearchOrganizationsResponse {
|
|
651
|
+
return new SearchOrganizationsResponse().fromJson(jsonValue, options);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SearchOrganizationsResponse {
|
|
655
|
+
return new SearchOrganizationsResponse().fromJsonString(jsonString, options);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
static equals(a: SearchOrganizationsResponse | PlainMessage<SearchOrganizationsResponse> | undefined, b: SearchOrganizationsResponse | PlainMessage<SearchOrganizationsResponse> | undefined): boolean {
|
|
659
|
+
return proto3.util.equals(SearchOrganizationsResponse, a, b);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
565
663
|
/**
|
|
566
664
|
* @generated from message scalekit.v1.organizations.DeleteOrganizationRequest
|
|
567
665
|
*/
|
|
@@ -723,6 +821,49 @@ export class DeletePortalLinkRequest extends Message<DeletePortalLinkRequest> {
|
|
|
723
821
|
}
|
|
724
822
|
}
|
|
725
823
|
|
|
824
|
+
/**
|
|
825
|
+
* @generated from message scalekit.v1.organizations.DeletePortalLinkByIdRequest
|
|
826
|
+
*/
|
|
827
|
+
export class DeletePortalLinkByIdRequest extends Message<DeletePortalLinkByIdRequest> {
|
|
828
|
+
/**
|
|
829
|
+
* @generated from field: string id = 1;
|
|
830
|
+
*/
|
|
831
|
+
id = "";
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* @generated from field: string link_id = 2;
|
|
835
|
+
*/
|
|
836
|
+
linkId = "";
|
|
837
|
+
|
|
838
|
+
constructor(data?: PartialMessage<DeletePortalLinkByIdRequest>) {
|
|
839
|
+
super();
|
|
840
|
+
proto3.util.initPartial(data, this);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
844
|
+
static readonly typeName = "scalekit.v1.organizations.DeletePortalLinkByIdRequest";
|
|
845
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
846
|
+
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
847
|
+
{ no: 2, name: "link_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
848
|
+
]);
|
|
849
|
+
|
|
850
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DeletePortalLinkByIdRequest {
|
|
851
|
+
return new DeletePortalLinkByIdRequest().fromBinary(bytes, options);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DeletePortalLinkByIdRequest {
|
|
855
|
+
return new DeletePortalLinkByIdRequest().fromJson(jsonValue, options);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DeletePortalLinkByIdRequest {
|
|
859
|
+
return new DeletePortalLinkByIdRequest().fromJsonString(jsonString, options);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
static equals(a: DeletePortalLinkByIdRequest | PlainMessage<DeletePortalLinkByIdRequest> | undefined, b: DeletePortalLinkByIdRequest | PlainMessage<DeletePortalLinkByIdRequest> | undefined): boolean {
|
|
863
|
+
return proto3.util.equals(DeletePortalLinkByIdRequest, a, b);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
726
867
|
/**
|
|
727
868
|
* @generated from message scalekit.v1.organizations.Link
|
|
728
869
|
*/
|
package/src/scalekit.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { IdTokenClaimToUserMap } from './constants/user';
|
|
|
6
6
|
import CoreClient from './core';
|
|
7
7
|
import DomainClient from './domain';
|
|
8
8
|
import OrganizationClient from './organization';
|
|
9
|
-
import { AuthorizationUrlOptions,
|
|
10
|
-
import { IdTokenClaim, User } from './types/
|
|
9
|
+
import { AuthorizationUrlOptions, AuthenticationOptions, GrantType, AuthenticationResponse } from './types/scalekit';
|
|
10
|
+
import { IdTokenClaim, User } from './types/auth';
|
|
11
11
|
|
|
12
12
|
const authorizeEndpoint = "oauth/authorize";
|
|
13
13
|
|
|
@@ -16,11 +16,11 @@ const authorizeEndpoint = "oauth/authorize";
|
|
|
16
16
|
* @param {string} envUrl The environment url
|
|
17
17
|
* @param {string} clientId The client id
|
|
18
18
|
* @param {string} clientSecret The client secret
|
|
19
|
-
* @returns {
|
|
19
|
+
* @returns {ScalekitClient} Returns the scalekit instance
|
|
20
20
|
* @example
|
|
21
21
|
* const scalekit = new Scalekit(envUrl, clientId, clientSecret);
|
|
22
22
|
*/
|
|
23
|
-
export default class
|
|
23
|
+
export default class ScalekitClient {
|
|
24
24
|
private readonly coreClient: CoreClient;
|
|
25
25
|
private readonly grpcConnect: GrpcConnect;
|
|
26
26
|
readonly organization: OrganizationClient;
|
|
@@ -65,6 +65,9 @@ export default class Scalekit {
|
|
|
65
65
|
* @param {string} options.domainHint Domain hint parameter
|
|
66
66
|
* @param {string} options.connectionId Connection id parameter
|
|
67
67
|
* @param {string} options.organizationId Organization id parameter
|
|
68
|
+
* @param {string} options.provider Provider i.e. google, github, etc.
|
|
69
|
+
* @param {string} options.codeChallenge Code challenge parameter in case of PKCE
|
|
70
|
+
* @param {string} options.codeChallengeMethod Code challenge method parameter in case of PKCE
|
|
68
71
|
*
|
|
69
72
|
* @example
|
|
70
73
|
* const scalekit = new Scalekit(envUrl, clientId, clientSecret);
|
|
@@ -76,7 +79,7 @@ export default class Scalekit {
|
|
|
76
79
|
options?: AuthorizationUrlOptions
|
|
77
80
|
): string {
|
|
78
81
|
const defaultOptions: AuthorizationUrlOptions = {
|
|
79
|
-
scopes: ['openid', 'profile']
|
|
82
|
+
scopes: ['openid', 'profile', 'email']
|
|
80
83
|
}
|
|
81
84
|
options = {
|
|
82
85
|
...defaultOptions,
|
|
@@ -94,6 +97,8 @@ export default class Scalekit {
|
|
|
94
97
|
...(options.domainHint && { domain: options.domainHint }),
|
|
95
98
|
...(options.connectionId && { connection_id: options.connectionId }),
|
|
96
99
|
...(options.organizationId && { organization_id: options.organizationId }),
|
|
100
|
+
...(options.codeChallenge && { code_challenge: options.codeChallenge }),
|
|
101
|
+
...(options.codeChallengeMethod && { code_challenge_method: options.codeChallengeMethod })
|
|
97
102
|
})
|
|
98
103
|
|
|
99
104
|
return `${this.coreClient.envUrl}/${authorizeEndpoint}?${qs}`
|
|
@@ -101,24 +106,28 @@ export default class Scalekit {
|
|
|
101
106
|
|
|
102
107
|
/**
|
|
103
108
|
* Authenticate with the code
|
|
104
|
-
* @param {
|
|
105
|
-
* @param {string}
|
|
106
|
-
* @param {
|
|
107
|
-
* @param {string} options.codeVerifier Code verifier
|
|
108
|
-
* @returns {Promise<
|
|
109
|
+
* @param {string} code Code
|
|
110
|
+
* @param {string} redirectUri Redirect uri
|
|
111
|
+
* @param {AuthenticationOptions} options Code authentication options
|
|
112
|
+
* @param {string} options.codeVerifier Code verifier in case of PKCE
|
|
113
|
+
* @returns {Promise<AuthenticationResponse>} Returns user, id token and access token
|
|
109
114
|
*/
|
|
110
|
-
async authenticateWithCode(
|
|
115
|
+
async authenticateWithCode(
|
|
116
|
+
code: string,
|
|
117
|
+
redirectUri: string,
|
|
118
|
+
options?: AuthenticationOptions,
|
|
119
|
+
): Promise<AuthenticationResponse> {
|
|
111
120
|
const res = await this.coreClient.authenticate(QueryString.stringify({
|
|
112
|
-
code:
|
|
113
|
-
redirect_uri:
|
|
121
|
+
code: code,
|
|
122
|
+
redirect_uri: redirectUri,
|
|
114
123
|
grant_type: GrantType.AuthorizationCode,
|
|
115
124
|
client_id: this.coreClient.clientId,
|
|
116
125
|
client_secret: this.coreClient.clientSecret,
|
|
117
|
-
...(options
|
|
126
|
+
...(options?.codeVerifier && { code_verifier: options.codeVerifier })
|
|
118
127
|
}))
|
|
119
|
-
const { id_token, access_token } = res.data;
|
|
128
|
+
const { id_token, access_token, expires_in } = res.data;
|
|
120
129
|
const claims = jose.decodeJwt<IdTokenClaim>(id_token);
|
|
121
|
-
const user
|
|
130
|
+
const user = <User>{};
|
|
122
131
|
for (const [k, v] of Object.entries(claims)) {
|
|
123
132
|
if (IdTokenClaimToUserMap[k]) {
|
|
124
133
|
user[IdTokenClaimToUserMap[k]] = v;
|
|
@@ -128,7 +137,8 @@ export default class Scalekit {
|
|
|
128
137
|
return {
|
|
129
138
|
user,
|
|
130
139
|
idToken: id_token,
|
|
131
|
-
accessToken: access_token
|
|
140
|
+
accessToken: access_token,
|
|
141
|
+
expiresIn: expires_in
|
|
132
142
|
}
|
|
133
143
|
}
|
|
134
144
|
|
package/src/types/scalekit.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { User } from './auth';
|
|
2
|
+
|
|
1
3
|
export enum GrantType {
|
|
2
4
|
AuthorizationCode = 'authorization_code',
|
|
3
5
|
RefreshToken = 'refresh_token',
|
|
@@ -12,19 +14,18 @@ export type AuthorizationUrlOptions = {
|
|
|
12
14
|
nonce?: string;
|
|
13
15
|
domainHint?: string;
|
|
14
16
|
loginHint?: string;
|
|
17
|
+
codeChallenge?: string;
|
|
18
|
+
codeChallengeMethod?: string;
|
|
19
|
+
provider?: string;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
export type
|
|
18
|
-
code: string;
|
|
19
|
-
redirectUri: string;
|
|
22
|
+
export type AuthenticationOptions = {
|
|
20
23
|
codeVerifier?: string;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export type AuthenticationOptions = {
|
|
29
|
-
refreshToken: string;
|
|
26
|
+
export type AuthenticationResponse = {
|
|
27
|
+
user: User;
|
|
28
|
+
idToken: string;
|
|
29
|
+
accessToken: string;
|
|
30
|
+
expiresIn: number;
|
|
30
31
|
}
|
package/lib/types/user.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":""}
|