@workos-inc/node 7.16.0 → 7.17.1
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/lib/common/interfaces/get-options.interface.d.ts +1 -0
- package/lib/common/interfaces/post-options.interface.d.ts +1 -0
- package/lib/common/utils/fetch-and-deserialize.d.ts +2 -2
- package/lib/common/utils/fetch-and-deserialize.js +2 -4
- package/lib/fga/fga-live-test.spec.d.ts +1 -0
- package/lib/fga/fga-live-test.spec.js +872 -0
- package/lib/fga/fga.d.ts +18 -0
- package/lib/fga/fga.js +105 -0
- package/lib/fga/fga.spec.d.ts +1 -0
- package/lib/fga/fga.spec.js +518 -0
- package/lib/fga/interfaces/check-op.enum.d.ts +5 -0
- package/lib/fga/interfaces/check-op.enum.js +9 -0
- package/lib/fga/interfaces/check.interface.d.ts +71 -0
- package/lib/fga/interfaces/check.interface.js +21 -0
- package/lib/fga/interfaces/index.d.ts +7 -0
- package/lib/fga/interfaces/index.js +23 -0
- package/lib/fga/interfaces/query.interface.d.ts +30 -0
- package/lib/fga/interfaces/query.interface.js +2 -0
- package/lib/fga/interfaces/resource.interface.d.ts +60 -0
- package/lib/fga/interfaces/resource.interface.js +2 -0
- package/lib/fga/interfaces/warrant-op.enum.d.ts +4 -0
- package/lib/fga/interfaces/warrant-op.enum.js +8 -0
- package/lib/fga/interfaces/warrant-token.interface.d.ts +6 -0
- package/lib/fga/interfaces/warrant-token.interface.js +2 -0
- package/lib/fga/interfaces/warrant.interface.d.ts +65 -0
- package/lib/fga/interfaces/warrant.interface.js +2 -0
- package/lib/fga/serializers/check-options.serializer.d.ts +4 -0
- package/lib/fga/serializers/check-options.serializer.js +62 -0
- package/lib/fga/serializers/create-resource-options.serializer.d.ts +2 -0
- package/lib/fga/serializers/create-resource-options.serializer.js +16 -0
- package/lib/fga/serializers/delete-resource-options.serializer.d.ts +2 -0
- package/lib/fga/serializers/delete-resource-options.serializer.js +15 -0
- package/lib/fga/serializers/index.d.ts +11 -0
- package/lib/fga/serializers/index.js +27 -0
- package/lib/fga/serializers/list-resources-options.serializer.d.ts +2 -0
- package/lib/fga/serializers/list-resources-options.serializer.js +12 -0
- package/lib/fga/serializers/list-warrants-options.serializer.d.ts +2 -0
- package/lib/fga/serializers/list-warrants-options.serializer.js +14 -0
- package/lib/fga/serializers/query-options.serializer.d.ts +2 -0
- package/lib/fga/serializers/query-options.serializer.js +12 -0
- package/lib/fga/serializers/query-result.serializer.d.ts +2 -0
- package/lib/fga/serializers/query-result.serializer.js +21 -0
- package/lib/fga/serializers/resource.serializer.d.ts +2 -0
- package/lib/fga/serializers/resource.serializer.js +9 -0
- package/lib/fga/serializers/warrant-token.serializer.d.ts +2 -0
- package/lib/fga/serializers/warrant-token.serializer.js +7 -0
- package/lib/fga/serializers/warrant.serializer.d.ts +2 -0
- package/lib/fga/serializers/warrant.serializer.js +14 -0
- package/lib/fga/serializers/write-warrant-options.serializer.d.ts +2 -0
- package/lib/fga/serializers/write-warrant-options.serializer.js +27 -0
- package/lib/fga/utils/interface-check.d.ts +3 -0
- package/lib/fga/utils/interface-check.js +15 -0
- package/lib/user-management/interfaces/refresh-and-seal-session-data.interface.d.ts +4 -0
- package/lib/user-management/interfaces/refresh-and-seal-session-data.interface.js +4 -0
- package/lib/user-management/user-management.js +2 -2
- package/lib/workos.d.ts +2 -0
- package/lib/workos.js +19 -7
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ResourceInterface, ResourceOptions } from './resource.interface';
|
|
2
|
+
import { PolicyContext, SerializedSubject, Subject } from './warrant.interface';
|
|
3
|
+
import { CheckOp } from './check-op.enum';
|
|
4
|
+
import { PostOptions } from '../../common/interfaces';
|
|
5
|
+
export interface CheckWarrantOptions {
|
|
6
|
+
resource: ResourceInterface | ResourceOptions;
|
|
7
|
+
relation: string;
|
|
8
|
+
subject: ResourceInterface | Subject;
|
|
9
|
+
context?: PolicyContext;
|
|
10
|
+
}
|
|
11
|
+
export interface SerializedCheckWarrantOptions {
|
|
12
|
+
resource_type: string;
|
|
13
|
+
resource_id: string;
|
|
14
|
+
relation: string;
|
|
15
|
+
subject: SerializedSubject;
|
|
16
|
+
context: PolicyContext;
|
|
17
|
+
}
|
|
18
|
+
export interface CheckOptions {
|
|
19
|
+
op?: CheckOp;
|
|
20
|
+
checks: CheckWarrantOptions[];
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CheckBatchOptions {
|
|
24
|
+
checks: CheckWarrantOptions[];
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface SerializedCheckOptions {
|
|
28
|
+
op?: CheckOp;
|
|
29
|
+
checks: SerializedCheckWarrantOptions[];
|
|
30
|
+
debug?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface CheckResultResponse {
|
|
33
|
+
result: string;
|
|
34
|
+
is_implicit: boolean;
|
|
35
|
+
debug_info?: DebugInfoResponse;
|
|
36
|
+
}
|
|
37
|
+
export interface DebugInfo {
|
|
38
|
+
processingTime: number;
|
|
39
|
+
decisionTree: DecisionTreeNode;
|
|
40
|
+
}
|
|
41
|
+
export interface DecisionTreeNode {
|
|
42
|
+
check: CheckWarrantOptions;
|
|
43
|
+
policy?: string;
|
|
44
|
+
decision: string;
|
|
45
|
+
processingTime: number;
|
|
46
|
+
children: DecisionTreeNode[];
|
|
47
|
+
}
|
|
48
|
+
export interface DebugInfoResponse {
|
|
49
|
+
processing_time: number;
|
|
50
|
+
decision_tree: DecisionTreeNodeResponse;
|
|
51
|
+
}
|
|
52
|
+
export interface DecisionTreeNodeResponse {
|
|
53
|
+
check: SerializedCheckWarrantOptions;
|
|
54
|
+
policy?: string;
|
|
55
|
+
decision: string;
|
|
56
|
+
processing_time: number;
|
|
57
|
+
children: DecisionTreeNodeResponse[];
|
|
58
|
+
}
|
|
59
|
+
export interface CheckResultInterface {
|
|
60
|
+
result: string;
|
|
61
|
+
isImplicit: boolean;
|
|
62
|
+
debugInfo?: DebugInfo;
|
|
63
|
+
}
|
|
64
|
+
export declare class CheckResult implements CheckResultInterface {
|
|
65
|
+
result: string;
|
|
66
|
+
isImplicit: boolean;
|
|
67
|
+
debugInfo?: DebugInfo;
|
|
68
|
+
constructor(json: CheckResultResponse);
|
|
69
|
+
isAuthorized(): boolean;
|
|
70
|
+
}
|
|
71
|
+
export type CheckRequestOptions = Pick<PostOptions, 'warrantToken'>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckResult = void 0;
|
|
4
|
+
const check_options_serializer_1 = require("../serializers/check-options.serializer");
|
|
5
|
+
const CHECK_RESULT_AUTHORIZED = 'authorized';
|
|
6
|
+
class CheckResult {
|
|
7
|
+
constructor(json) {
|
|
8
|
+
this.result = json.result;
|
|
9
|
+
this.isImplicit = json.is_implicit;
|
|
10
|
+
this.debugInfo = json.debug_info
|
|
11
|
+
? {
|
|
12
|
+
processingTime: json.debug_info.processing_time,
|
|
13
|
+
decisionTree: (0, check_options_serializer_1.deserializeDecisionTreeNode)(json.debug_info.decision_tree),
|
|
14
|
+
}
|
|
15
|
+
: undefined;
|
|
16
|
+
}
|
|
17
|
+
isAuthorized() {
|
|
18
|
+
return this.result === CHECK_RESULT_AUTHORIZED;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CheckResult = CheckResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./check-op.enum"), exports);
|
|
18
|
+
__exportStar(require("./check.interface"), exports);
|
|
19
|
+
__exportStar(require("./query.interface"), exports);
|
|
20
|
+
__exportStar(require("./resource.interface"), exports);
|
|
21
|
+
__exportStar(require("./warrant-op.enum"), exports);
|
|
22
|
+
__exportStar(require("./warrant-token.interface"), exports);
|
|
23
|
+
__exportStar(require("./warrant.interface"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Warrant, PolicyContext, WarrantResponse } from './warrant.interface';
|
|
2
|
+
import { PaginationOptions } from '../../common/interfaces/pagination-options.interface';
|
|
3
|
+
import { GetOptions } from '../../common/interfaces';
|
|
4
|
+
export interface QueryOptions extends PaginationOptions {
|
|
5
|
+
q: string;
|
|
6
|
+
context?: PolicyContext;
|
|
7
|
+
}
|
|
8
|
+
export interface SerializedQueryOptions extends PaginationOptions {
|
|
9
|
+
q: string;
|
|
10
|
+
context?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface QueryResult {
|
|
13
|
+
resourceType: string;
|
|
14
|
+
resourceId: string;
|
|
15
|
+
relation: string;
|
|
16
|
+
warrant: Warrant;
|
|
17
|
+
isImplicit: boolean;
|
|
18
|
+
meta?: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface QueryResultResponse {
|
|
23
|
+
resource_type: string;
|
|
24
|
+
resource_id: string;
|
|
25
|
+
relation: string;
|
|
26
|
+
warrant: WarrantResponse;
|
|
27
|
+
is_implicit: boolean;
|
|
28
|
+
meta?: Record<string, any>;
|
|
29
|
+
}
|
|
30
|
+
export type QueryRequestOptions = Pick<GetOptions, 'warrantToken'>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PaginationOptions } from '../../common/interfaces/pagination-options.interface';
|
|
2
|
+
export interface ResourceInterface {
|
|
3
|
+
getResourceType(): string;
|
|
4
|
+
getResourceId(): string;
|
|
5
|
+
}
|
|
6
|
+
export interface ResourceOptions {
|
|
7
|
+
resourceType: string;
|
|
8
|
+
resourceId?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SerializedResourceOptions {
|
|
11
|
+
resource_type: string;
|
|
12
|
+
resource_id?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CreateResourceOptions {
|
|
15
|
+
resource: ResourceInterface | ResourceOptions;
|
|
16
|
+
meta?: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface SerializedCreateResourceOptions {
|
|
21
|
+
resource_type: string;
|
|
22
|
+
resource_id?: string;
|
|
23
|
+
meta?: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export type GetResourceOptions = ResourceInterface | ResourceOptions;
|
|
28
|
+
export interface ListResourcesOptions extends PaginationOptions {
|
|
29
|
+
resourceType?: string;
|
|
30
|
+
search?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SerializedListResourcesOptions extends PaginationOptions {
|
|
33
|
+
resource_type?: string;
|
|
34
|
+
search?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface UpdateResourceOptions {
|
|
37
|
+
resource: ResourceInterface | ResourceOptions;
|
|
38
|
+
meta: {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export type DeleteResourceOptions = ResourceInterface | ResourceOptions;
|
|
43
|
+
export interface SerializedDeleteResourceOptions {
|
|
44
|
+
resource_type: string;
|
|
45
|
+
resource_id: string;
|
|
46
|
+
}
|
|
47
|
+
export interface Resource {
|
|
48
|
+
resourceType: string;
|
|
49
|
+
resourceId: string;
|
|
50
|
+
meta?: {
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ResourceResponse {
|
|
55
|
+
resource_type: string;
|
|
56
|
+
resource_id: string;
|
|
57
|
+
meta?: {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarrantOp = void 0;
|
|
4
|
+
var WarrantOp;
|
|
5
|
+
(function (WarrantOp) {
|
|
6
|
+
WarrantOp["Create"] = "create";
|
|
7
|
+
WarrantOp["Delete"] = "delete";
|
|
8
|
+
})(WarrantOp || (exports.WarrantOp = WarrantOp = {}));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { GetOptions } from '../../common/interfaces';
|
|
2
|
+
import { ResourceInterface, ResourceOptions } from './resource.interface';
|
|
3
|
+
import { WarrantOp } from './warrant-op.enum';
|
|
4
|
+
export interface ListWarrantsOptions {
|
|
5
|
+
resourceType?: string;
|
|
6
|
+
resourceId?: string;
|
|
7
|
+
relation?: string;
|
|
8
|
+
subjectType?: string;
|
|
9
|
+
subjectId?: string;
|
|
10
|
+
subjectRelation?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
after?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SerializedListWarrantsOptions {
|
|
15
|
+
resource_type?: string;
|
|
16
|
+
resource_id?: string;
|
|
17
|
+
relation?: string;
|
|
18
|
+
subject_type?: string;
|
|
19
|
+
subject_id?: string;
|
|
20
|
+
subject_relation?: string;
|
|
21
|
+
limit?: number;
|
|
22
|
+
after?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PolicyContext {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface Subject {
|
|
28
|
+
resourceType: string;
|
|
29
|
+
resourceId: string;
|
|
30
|
+
relation?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SerializedSubject {
|
|
33
|
+
resource_type: string;
|
|
34
|
+
resource_id: string;
|
|
35
|
+
relation?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Warrant {
|
|
38
|
+
resourceType: string;
|
|
39
|
+
resourceId: string;
|
|
40
|
+
relation: string;
|
|
41
|
+
subject: Subject;
|
|
42
|
+
policy?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface WriteWarrantOptions {
|
|
45
|
+
op?: WarrantOp;
|
|
46
|
+
resource: ResourceInterface | ResourceOptions;
|
|
47
|
+
relation: string;
|
|
48
|
+
subject: ResourceInterface | Subject;
|
|
49
|
+
policy?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface SerializedWriteWarrantOptions {
|
|
52
|
+
op?: WarrantOp;
|
|
53
|
+
resource_type: string;
|
|
54
|
+
resource_id: string;
|
|
55
|
+
relation: string;
|
|
56
|
+
subject: SerializedSubject;
|
|
57
|
+
policy?: string;
|
|
58
|
+
}
|
|
59
|
+
export type ListWarrantsRequestOptions = Pick<GetOptions, 'warrantToken'>;
|
|
60
|
+
export interface WarrantResponse {
|
|
61
|
+
resource_type: string;
|
|
62
|
+
resource_id: string;
|
|
63
|
+
relation: string;
|
|
64
|
+
subject: SerializedSubject;
|
|
65
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CheckBatchOptions, CheckOptions, DecisionTreeNode, DecisionTreeNodeResponse, SerializedCheckOptions } from '../interfaces';
|
|
2
|
+
export declare const serializeCheckOptions: (options: CheckOptions) => SerializedCheckOptions;
|
|
3
|
+
export declare const serializeCheckBatchOptions: (options: CheckBatchOptions) => SerializedCheckOptions;
|
|
4
|
+
export declare const deserializeDecisionTreeNode: (response: DecisionTreeNodeResponse) => DecisionTreeNode;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeDecisionTreeNode = exports.serializeCheckBatchOptions = exports.serializeCheckOptions = void 0;
|
|
4
|
+
const interfaces_1 = require("../interfaces");
|
|
5
|
+
const interface_check_1 = require("../utils/interface-check");
|
|
6
|
+
const serializeCheckOptions = (options) => ({
|
|
7
|
+
op: options.op,
|
|
8
|
+
checks: options.checks.map(serializeCheckWarrantOptions),
|
|
9
|
+
debug: options.debug,
|
|
10
|
+
});
|
|
11
|
+
exports.serializeCheckOptions = serializeCheckOptions;
|
|
12
|
+
const serializeCheckBatchOptions = (options) => ({
|
|
13
|
+
op: interfaces_1.CheckOp.Batch,
|
|
14
|
+
checks: options.checks.map(serializeCheckWarrantOptions),
|
|
15
|
+
debug: options.debug,
|
|
16
|
+
});
|
|
17
|
+
exports.serializeCheckBatchOptions = serializeCheckBatchOptions;
|
|
18
|
+
const serializeCheckWarrantOptions = (warrant) => {
|
|
19
|
+
var _a;
|
|
20
|
+
return {
|
|
21
|
+
resource_type: (0, interface_check_1.isResourceInterface)(warrant.resource)
|
|
22
|
+
? warrant.resource.getResourceType()
|
|
23
|
+
: warrant.resource.resourceType,
|
|
24
|
+
resource_id: (0, interface_check_1.isResourceInterface)(warrant.resource)
|
|
25
|
+
? warrant.resource.getResourceId()
|
|
26
|
+
: warrant.resource.resourceId
|
|
27
|
+
? warrant.resource.resourceId
|
|
28
|
+
: '',
|
|
29
|
+
relation: warrant.relation,
|
|
30
|
+
subject: (0, interface_check_1.isSubject)(warrant.subject)
|
|
31
|
+
? {
|
|
32
|
+
resource_type: warrant.subject.resourceType,
|
|
33
|
+
resource_id: warrant.subject.resourceId,
|
|
34
|
+
}
|
|
35
|
+
: {
|
|
36
|
+
resource_type: warrant.subject.getResourceType(),
|
|
37
|
+
resource_id: warrant.subject.getResourceId(),
|
|
38
|
+
},
|
|
39
|
+
context: (_a = warrant.context) !== null && _a !== void 0 ? _a : {},
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const deserializeDecisionTreeNode = (response) => {
|
|
43
|
+
return {
|
|
44
|
+
check: {
|
|
45
|
+
resource: {
|
|
46
|
+
resourceType: response.check.resource_type,
|
|
47
|
+
resourceId: response.check.resource_id,
|
|
48
|
+
},
|
|
49
|
+
relation: response.check.relation,
|
|
50
|
+
subject: {
|
|
51
|
+
resourceType: response.check.subject.resource_type,
|
|
52
|
+
resourceId: response.check.subject.resource_id,
|
|
53
|
+
},
|
|
54
|
+
context: response.check.context,
|
|
55
|
+
},
|
|
56
|
+
policy: response.policy,
|
|
57
|
+
decision: response.decision,
|
|
58
|
+
processingTime: response.processing_time,
|
|
59
|
+
children: response.children.map(exports.deserializeDecisionTreeNode),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.deserializeDecisionTreeNode = deserializeDecisionTreeNode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeCreateResourceOptions = void 0;
|
|
4
|
+
const interface_check_1 = require("../utils/interface-check");
|
|
5
|
+
const serializeCreateResourceOptions = (options) => ({
|
|
6
|
+
resource_type: (0, interface_check_1.isResourceInterface)(options.resource)
|
|
7
|
+
? options.resource.getResourceType()
|
|
8
|
+
: options.resource.resourceType,
|
|
9
|
+
resource_id: (0, interface_check_1.isResourceInterface)(options.resource)
|
|
10
|
+
? options.resource.getResourceId()
|
|
11
|
+
: options.resource.resourceId
|
|
12
|
+
? options.resource.resourceId
|
|
13
|
+
: '',
|
|
14
|
+
meta: options.meta,
|
|
15
|
+
});
|
|
16
|
+
exports.serializeCreateResourceOptions = serializeCreateResourceOptions;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeDeleteResourceOptions = void 0;
|
|
4
|
+
const interface_check_1 = require("../utils/interface-check");
|
|
5
|
+
const serializeDeleteResourceOptions = (options) => ({
|
|
6
|
+
resource_type: (0, interface_check_1.isResourceInterface)(options)
|
|
7
|
+
? options.getResourceType()
|
|
8
|
+
: options.resourceType,
|
|
9
|
+
resource_id: (0, interface_check_1.isResourceInterface)(options)
|
|
10
|
+
? options.getResourceId()
|
|
11
|
+
: options.resourceId
|
|
12
|
+
? options.resourceId
|
|
13
|
+
: '',
|
|
14
|
+
});
|
|
15
|
+
exports.serializeDeleteResourceOptions = serializeDeleteResourceOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './check-options.serializer';
|
|
2
|
+
export * from './create-resource-options.serializer';
|
|
3
|
+
export * from './delete-resource-options.serializer';
|
|
4
|
+
export * from './list-resources-options.serializer';
|
|
5
|
+
export * from './list-warrants-options.serializer';
|
|
6
|
+
export * from './query-options.serializer';
|
|
7
|
+
export * from './query-result.serializer';
|
|
8
|
+
export * from './resource.serializer';
|
|
9
|
+
export * from './warrant-token.serializer';
|
|
10
|
+
export * from './warrant.serializer';
|
|
11
|
+
export * from './write-warrant-options.serializer';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./check-options.serializer"), exports);
|
|
18
|
+
__exportStar(require("./create-resource-options.serializer"), exports);
|
|
19
|
+
__exportStar(require("./delete-resource-options.serializer"), exports);
|
|
20
|
+
__exportStar(require("./list-resources-options.serializer"), exports);
|
|
21
|
+
__exportStar(require("./list-warrants-options.serializer"), exports);
|
|
22
|
+
__exportStar(require("./query-options.serializer"), exports);
|
|
23
|
+
__exportStar(require("./query-result.serializer"), exports);
|
|
24
|
+
__exportStar(require("./resource.serializer"), exports);
|
|
25
|
+
__exportStar(require("./warrant-token.serializer"), exports);
|
|
26
|
+
__exportStar(require("./warrant.serializer"), exports);
|
|
27
|
+
__exportStar(require("./write-warrant-options.serializer"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeListResourceOptions = void 0;
|
|
4
|
+
const serializeListResourceOptions = (options) => ({
|
|
5
|
+
resource_type: options.resourceType,
|
|
6
|
+
search: options.search,
|
|
7
|
+
limit: options.limit,
|
|
8
|
+
before: options.before,
|
|
9
|
+
after: options.after,
|
|
10
|
+
order: options.order,
|
|
11
|
+
});
|
|
12
|
+
exports.serializeListResourceOptions = serializeListResourceOptions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeListWarrantsOptions = void 0;
|
|
4
|
+
const serializeListWarrantsOptions = (options) => ({
|
|
5
|
+
resource_type: options.resourceType,
|
|
6
|
+
resource_id: options.resourceId,
|
|
7
|
+
relation: options.relation,
|
|
8
|
+
subject_type: options.subjectType,
|
|
9
|
+
subject_id: options.subjectId,
|
|
10
|
+
subject_relation: options.subjectRelation,
|
|
11
|
+
limit: options.limit,
|
|
12
|
+
after: options.after,
|
|
13
|
+
});
|
|
14
|
+
exports.serializeListWarrantsOptions = serializeListWarrantsOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeQueryOptions = void 0;
|
|
4
|
+
const serializeQueryOptions = (options) => ({
|
|
5
|
+
q: options.q,
|
|
6
|
+
context: JSON.stringify(options.context),
|
|
7
|
+
limit: options.limit,
|
|
8
|
+
before: options.before,
|
|
9
|
+
after: options.after,
|
|
10
|
+
order: options.order,
|
|
11
|
+
});
|
|
12
|
+
exports.serializeQueryOptions = serializeQueryOptions;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeQueryResult = void 0;
|
|
4
|
+
const deserializeQueryResult = (queryResult) => ({
|
|
5
|
+
resourceType: queryResult.resource_type,
|
|
6
|
+
resourceId: queryResult.resource_id,
|
|
7
|
+
relation: queryResult.relation,
|
|
8
|
+
warrant: {
|
|
9
|
+
resourceType: queryResult.warrant.resource_type,
|
|
10
|
+
resourceId: queryResult.warrant.resource_id,
|
|
11
|
+
relation: queryResult.warrant.relation,
|
|
12
|
+
subject: {
|
|
13
|
+
resourceType: queryResult.warrant.subject.resource_type,
|
|
14
|
+
resourceId: queryResult.warrant.subject.resource_id,
|
|
15
|
+
relation: queryResult.warrant.subject.relation,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
isImplicit: queryResult.is_implicit,
|
|
19
|
+
meta: queryResult.meta,
|
|
20
|
+
});
|
|
21
|
+
exports.deserializeQueryResult = deserializeQueryResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeResource = void 0;
|
|
4
|
+
const deserializeResource = (response) => ({
|
|
5
|
+
resourceType: response.resource_type,
|
|
6
|
+
resourceId: response.resource_id,
|
|
7
|
+
meta: response.meta,
|
|
8
|
+
});
|
|
9
|
+
exports.deserializeResource = deserializeResource;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeWarrantToken = void 0;
|
|
4
|
+
const deserializeWarrantToken = (warrantToken) => ({
|
|
5
|
+
warrantToken: warrantToken.warrant_token,
|
|
6
|
+
});
|
|
7
|
+
exports.deserializeWarrantToken = deserializeWarrantToken;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserializeWarrant = void 0;
|
|
4
|
+
const deserializeWarrant = (warrant) => ({
|
|
5
|
+
resourceType: warrant.resource_type,
|
|
6
|
+
resourceId: warrant.resource_id,
|
|
7
|
+
relation: warrant.relation,
|
|
8
|
+
subject: {
|
|
9
|
+
resourceType: warrant.subject.resource_type,
|
|
10
|
+
resourceId: warrant.subject.resource_id,
|
|
11
|
+
relation: warrant.subject.relation,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
exports.deserializeWarrant = deserializeWarrant;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeWriteWarrantOptions = void 0;
|
|
4
|
+
const interface_check_1 = require("../utils/interface-check");
|
|
5
|
+
const serializeWriteWarrantOptions = (warrant) => ({
|
|
6
|
+
op: warrant.op,
|
|
7
|
+
resource_type: (0, interface_check_1.isResourceInterface)(warrant.resource)
|
|
8
|
+
? warrant.resource.getResourceType()
|
|
9
|
+
: warrant.resource.resourceType,
|
|
10
|
+
resource_id: (0, interface_check_1.isResourceInterface)(warrant.resource)
|
|
11
|
+
? warrant.resource.getResourceId()
|
|
12
|
+
: warrant.resource.resourceId
|
|
13
|
+
? warrant.resource.resourceId
|
|
14
|
+
: '',
|
|
15
|
+
relation: warrant.relation,
|
|
16
|
+
subject: (0, interface_check_1.isSubject)(warrant.subject)
|
|
17
|
+
? {
|
|
18
|
+
resource_type: warrant.subject.resourceType,
|
|
19
|
+
resource_id: warrant.subject.resourceId,
|
|
20
|
+
}
|
|
21
|
+
: {
|
|
22
|
+
resource_type: warrant.subject.getResourceType(),
|
|
23
|
+
resource_id: warrant.subject.getResourceId(),
|
|
24
|
+
},
|
|
25
|
+
policy: warrant.policy,
|
|
26
|
+
});
|
|
27
|
+
exports.serializeWriteWarrantOptions = serializeWriteWarrantOptions;
|