@contember/engine-server 1.2.0-alpha.1 → 1.2.0-alpha.12
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/dist/src/MasterContainer.d.ts +18 -3
- package/dist/src/MasterContainer.d.ts.map +1 -1
- package/dist/src/MasterContainer.js +20 -2
- package/dist/src/MasterContainer.js.map +1 -1
- package/dist/src/bootstrap/Initializer.d.ts.map +1 -1
- package/dist/src/bootstrap/Initializer.js +0 -2
- package/dist/src/bootstrap/Initializer.js.map +1 -1
- package/dist/src/project/ProjectContainer.js +1 -1
- package/dist/src/project/ProjectContainer.js.map +1 -1
- package/dist/src/projectGroup/ProjectGroupContainer.js +1 -1
- package/dist/src/projectGroup/ProjectGroupContainer.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/utils/sentry.d.ts +1 -1
- package/dist/src/utils/sentry.d.ts.map +1 -1
- package/dist/src/utils/sentry.js +1 -1
- package/dist/src/utils/sentry.js.map +1 -1
- package/dist/tests/e2e/acl-condition-variable.test.d.ts +2 -0
- package/dist/tests/e2e/acl-condition-variable.test.d.ts.map +1 -0
- package/dist/tests/e2e/acl-condition-variable.test.js +77 -0
- package/dist/tests/e2e/acl-condition-variable.test.js.map +1 -0
- package/dist/tests/e2e/assume-identity.test.d.ts +2 -0
- package/dist/tests/e2e/assume-identity.test.d.ts.map +1 -0
- package/dist/tests/e2e/assume-identity.test.js +109 -0
- package/dist/tests/e2e/assume-identity.test.js.map +1 -0
- package/dist/tests/e2e/assume-membership.test.d.ts +2 -0
- package/dist/tests/e2e/assume-membership.test.d.ts.map +1 -0
- package/dist/tests/e2e/assume-membership.test.js +58 -0
- package/dist/tests/e2e/assume-membership.test.js.map +1 -0
- package/dist/tests/e2e/content-api-basic.test.d.ts +2 -0
- package/dist/tests/e2e/content-api-basic.test.d.ts.map +1 -0
- package/dist/tests/e2e/content-api-basic.test.js +50 -0
- package/dist/tests/e2e/content-api-basic.test.js.map +1 -0
- package/dist/tests/e2e/content-invalid-schema.test.d.ts +2 -0
- package/dist/tests/e2e/content-invalid-schema.test.d.ts.map +1 -0
- package/dist/tests/e2e/content-invalid-schema.test.js +29 -0
- package/dist/tests/e2e/content-invalid-schema.test.js.map +1 -0
- package/dist/tests/e2e/homepage.test.d.ts +2 -0
- package/dist/tests/e2e/homepage.test.d.ts.map +1 -0
- package/dist/tests/e2e/homepage.test.js +15 -0
- package/dist/tests/e2e/homepage.test.js.map +1 -0
- package/dist/tests/e2e/tenant-member-access.test.d.ts +2 -0
- package/dist/tests/e2e/tenant-member-access.test.d.ts.map +1 -0
- package/dist/tests/e2e/tenant-member-access.test.js +43 -0
- package/dist/tests/e2e/tenant-member-access.test.js.map +1 -0
- package/dist/tests/e2e/x-contember-ref.test.d.ts +2 -0
- package/dist/tests/e2e/x-contember-ref.test.d.ts.map +1 -0
- package/dist/tests/e2e/x-contember-ref.test.js +63 -0
- package/dist/tests/e2e/x-contember-ref.test.js.map +1 -0
- package/dist/tests/{e2e → src}/requests.d.ts +2 -1
- package/dist/tests/src/requests.d.ts.map +1 -0
- package/dist/tests/{e2e → src}/requests.js +14 -5
- package/dist/tests/{e2e → src}/requests.js.map +1 -1
- package/dist/tests/{e2e → src}/tester.d.ts +0 -0
- package/dist/tests/{e2e → src}/tester.d.ts.map +1 -1
- package/dist/tests/{e2e → src}/tester.js +0 -0
- package/dist/tests/{e2e → src}/tester.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -23
- package/src/MasterContainer.ts +39 -3
- package/src/bootstrap/Initializer.ts +0 -2
- package/src/project/ProjectContainer.ts +1 -1
- package/src/projectGroup/ProjectGroupContainer.ts +1 -1
- package/src/utils/sentry.ts +1 -1
- package/tests/e2e/acl-condition-variable.test.ts +74 -0
- package/tests/e2e/assume-identity.test.ts +127 -0
- package/tests/e2e/assume-membership.test.ts +64 -0
- package/tests/e2e/content-api-basic.test.ts +51 -0
- package/tests/e2e/content-invalid-schema.test.ts +31 -0
- package/tests/e2e/homepage.test.ts +10 -0
- package/tests/e2e/tenant-member-access.test.ts +51 -0
- package/tests/e2e/x-contember-ref.test.ts +71 -0
- package/tests/{e2e → src}/requests.ts +15 -5
- package/tests/{e2e → src}/tester.ts +0 -0
- package/dist/tests/e2e/http.test.d.ts +0 -2
- package/dist/tests/e2e/http.test.d.ts.map +0 -1
- package/dist/tests/e2e/http.test.js +0 -192
- package/dist/tests/e2e/http.test.js.map +0 -1
- package/dist/tests/e2e/requests.d.ts.map +0 -1
- package/tests/e2e/http.test.ts +0 -237
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../../src/utils/sentry.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../../src/utils/sentry.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,SAAU,MAAM,SAYtC,CAAA;AAED,UAAU,kBAAkB;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,cAAc,UAAW,GAAG,WAAW,kBAAkB,SAqBrE,CAAA"}
|
package/dist/src/utils/sentry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.js","sourceRoot":"","sources":["../../../src/utils/sentry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsC;AAE/B,MAAM,UAAU,GAAG,CAAC,GAAY,EAAE,EAAE;IAC1C,IAAI,CAAC,GAAG,EAAE;QACT,OAAM;KACN;IACD,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAA;IAClD,MAAM,C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CAAC,KAAU,EAAE,OAA2B,EAAE,EAAE;IACzE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACxB,IAAI,OAAO,CAAC,OAAO,EAAE;YACpB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;SACxC;QACD,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;QACtC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACvB,KAAK,CAAC,OAAO,CAAC;YACb,EAAE,EAAE,OAAO,CAAC,IAAI;SAChB,CAAC,CAAA;QACF,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;YAC/B,OAAO;gBACN,GAAG,KAAK;gBACR,OAAO,EAAE;oBACR,GAAG,EAAE,OAAO,CAAC,GAAG;oBAChB,IAAI,EAAE,OAAO,CAAC,IAAI;iBAClB;aACD,CAAA;QACF,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;AACH,CAAC,CAAA;AArBY,QAAA,cAAc,kBAqB1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acl-condition-variable.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/acl-condition-variable.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const vitest_1 = require("vitest");
|
|
10
|
+
const tester_1 = require("../src/tester");
|
|
11
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
12
|
+
const requests_1 = require("../src/requests");
|
|
13
|
+
var ArticleModel;
|
|
14
|
+
(function (ArticleModel) {
|
|
15
|
+
ArticleModel.readerRole = schema_definition_1.AclDefinition.createRole('reader');
|
|
16
|
+
ArticleModel.subscriptionVariable = schema_definition_1.AclDefinition.createConditionVariable('subscription', ArticleModel.readerRole);
|
|
17
|
+
let Article = class Article {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.publishedAt = schema_definition_1.SchemaDefinition.dateTimeColumn().notNull();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
Article = __decorate([
|
|
23
|
+
schema_definition_1.AclDefinition.allow(ArticleModel.readerRole, {
|
|
24
|
+
read: true,
|
|
25
|
+
when: {
|
|
26
|
+
publishedAt: ArticleModel.subscriptionVariable,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
], Article);
|
|
30
|
+
ArticleModel.Article = Article;
|
|
31
|
+
})(ArticleModel || (ArticleModel = {}));
|
|
32
|
+
(0, vitest_1.test)('ACL: condition variable', async () => {
|
|
33
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(ArticleModel));
|
|
34
|
+
await tester((0, tester_1.gql) `
|
|
35
|
+
mutation {
|
|
36
|
+
articleA: createArticle(data: { publishedAt: "2022-02-01" }) {
|
|
37
|
+
ok
|
|
38
|
+
}
|
|
39
|
+
articleB: createArticle(data: { publishedAt: "2021-12-01" }) {
|
|
40
|
+
ok
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`)
|
|
44
|
+
.expect(response => {
|
|
45
|
+
vitest_1.assert.deepStrictEqual(response.body.data, {
|
|
46
|
+
articleA: {
|
|
47
|
+
ok: true,
|
|
48
|
+
},
|
|
49
|
+
articleB: {
|
|
50
|
+
ok: true,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
.expect(200);
|
|
55
|
+
const email = `john+${Date.now()}@doe.com`;
|
|
56
|
+
const identityId = await (0, requests_1.signUp)(email);
|
|
57
|
+
const authKey = await (0, requests_1.signIn)(email);
|
|
58
|
+
await (0, requests_1.addProjectMember)(identityId, tester.projectSlug, { role: 'reader', variables: [{ name: 'subscription', values: [JSON.stringify({ gte: '2022-01-01' })] }] });
|
|
59
|
+
await tester((0, tester_1.gql) `
|
|
60
|
+
query {
|
|
61
|
+
listArticle {
|
|
62
|
+
publishedAt
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`, { authorizationToken: authKey })
|
|
66
|
+
.expect(response => {
|
|
67
|
+
vitest_1.assert.deepStrictEqual(response.body.data, {
|
|
68
|
+
listArticle: [
|
|
69
|
+
{
|
|
70
|
+
publishedAt: '2022-02-01T00:00:00.000Z',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
})
|
|
75
|
+
.expect(200);
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=acl-condition-variable.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acl-condition-variable.test.js","sourceRoot":"","sources":["../../../tests/e2e/acl-condition-variable.test.ts"],"names":[],"mappings":";;;;;;;;AAAA,mCAAqC;AACrC,0CAAiD;AACjD,oEAA0G;AAC1G,8CAAkE;AAElE,IAAU,YAAY,CAarB;AAbD,WAAU,YAAY;IACR,uBAAU,GAAG,iCAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACrC,iCAAoB,GAAG,iCAAG,CAAC,uBAAuB,CAAC,cAAc,EAAE,aAAA,UAAU,CAAC,CAAA;IAQ3F,IAAa,OAAO,GAApB,MAAa,OAAO;QAApB;YACC,gBAAW,GAAG,oCAAG,CAAC,cAA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C,CAAA;IAElK,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;GAMF,EACD,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAC/B;SACC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAClB,eAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE;YAC1C,WAAW,EAAE;gBACZ;oBACC,WAAW,EAAE,0BAA0B;iBACvC;aACD;SACD,CAAC,CAAA;IACH,CAAC,CAAC;SACD,MAAM,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assume-identity.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/assume-identity.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const tester_1 = require("../src/tester");
|
|
5
|
+
const requests_1 = require("../src/requests");
|
|
6
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
7
|
+
const schema_utils_1 = require("@contember/schema-utils");
|
|
8
|
+
var TagModel;
|
|
9
|
+
(function (TagModel) {
|
|
10
|
+
class Tag {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.label = schema_definition_1.SchemaDefinition.stringColumn();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
TagModel.Tag = Tag;
|
|
16
|
+
})(TagModel || (TagModel = {}));
|
|
17
|
+
(0, vitest_1.test)('Content API: assume identity', async () => {
|
|
18
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel, schema => {
|
|
19
|
+
return {
|
|
20
|
+
...schema,
|
|
21
|
+
acl: {
|
|
22
|
+
roles: {
|
|
23
|
+
test: {
|
|
24
|
+
entities: new schema_utils_1.AllowAllPermissionFactory().create(schema.model),
|
|
25
|
+
variables: {},
|
|
26
|
+
system: {
|
|
27
|
+
history: true,
|
|
28
|
+
assumeIdentity: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}));
|
|
35
|
+
const email = `john+${Date.now()}@doe.com`;
|
|
36
|
+
const identityId = await (0, requests_1.signUp)(email);
|
|
37
|
+
const authKey = await (0, requests_1.signIn)(email);
|
|
38
|
+
await (0, requests_1.addProjectMember)(identityId, tester.projectSlug, { role: 'test', variables: [] });
|
|
39
|
+
const assumedIdentityId = '65e049e7-4b22-487a-a93b-528b3127d967';
|
|
40
|
+
await tester((0, tester_1.gql) `
|
|
41
|
+
mutation {
|
|
42
|
+
createTag(data: {label: "foo bar"}) {
|
|
43
|
+
ok
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`, { authorizationToken: authKey })
|
|
47
|
+
.set('X-Contember-assume-identity', assumedIdentityId)
|
|
48
|
+
.expect(200);
|
|
49
|
+
await tester((0, tester_1.gql) `
|
|
50
|
+
query {
|
|
51
|
+
events {
|
|
52
|
+
tableName
|
|
53
|
+
identityId
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`, { authorizationToken: authKey, path: `/system/${tester.projectSlug}` })
|
|
57
|
+
.expect({ data: { events: [{ tableName: 'tag', identityId: assumedIdentityId }] } })
|
|
58
|
+
.expect(200);
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.test)('Content API: assume identity is declined', async () => {
|
|
61
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel, schema => {
|
|
62
|
+
return {
|
|
63
|
+
...schema,
|
|
64
|
+
acl: {
|
|
65
|
+
roles: {
|
|
66
|
+
foo: {
|
|
67
|
+
entities: {},
|
|
68
|
+
variables: {},
|
|
69
|
+
system: {
|
|
70
|
+
assumeIdentity: true,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
test: {
|
|
74
|
+
entities: new schema_utils_1.AllowAllPermissionFactory().create(schema.model),
|
|
75
|
+
variables: {},
|
|
76
|
+
system: {
|
|
77
|
+
history: true,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}));
|
|
84
|
+
const email = `john+${Date.now()}@doe.com`;
|
|
85
|
+
const identityId = await (0, requests_1.signUp)(email);
|
|
86
|
+
const authKey = await (0, requests_1.signIn)(email);
|
|
87
|
+
await (0, requests_1.addProjectMember)(identityId, tester.projectSlug, { role: 'test', variables: [] });
|
|
88
|
+
const assumedIdentityId = '65e049e7-4b22-487a-a93b-528b3127d967';
|
|
89
|
+
await tester((0, tester_1.gql) `
|
|
90
|
+
mutation {
|
|
91
|
+
createTag(data: {label: "foo bar"}) {
|
|
92
|
+
ok
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`, { authorizationToken: authKey })
|
|
96
|
+
.set('X-Contember-assume-identity', assumedIdentityId)
|
|
97
|
+
.expect(200);
|
|
98
|
+
await tester((0, tester_1.gql) `
|
|
99
|
+
query {
|
|
100
|
+
events {
|
|
101
|
+
tableName
|
|
102
|
+
identityId
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`, { authorizationToken: authKey, path: `/system/${tester.projectSlug}` })
|
|
106
|
+
.expect({ data: { events: [{ tableName: 'tag', identityId }] } })
|
|
107
|
+
.expect(200);
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=assume-identity.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assume-identity.test.js","sourceRoot":"","sources":["../../../tests/e2e/assume-identity.test.ts"],"names":[],"mappings":";;AAAA,mCAA6B;AAC7B,0CAAiD;AACjD,8CAAkE;AAClE,oEAAoF;AACpF,0DAAmE;AAEnE,IAAU,QAAQ,CAIjB;AAJD,WAAU,QAAQ;IACjB,MAAa,GAAG;QAAhB;YACC,UAAK,GAAG,oCAAG,CAAC,YAAY,EAAE,CAAA;QA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AA;;;;;;GAMF,EACD,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAC/B;SACC,GAAG,CAAC,6BAA6B,EAAE,iBAAiB,CAAC;SACrD,MAAM,CAAC,GAAG,CAAC,CAAA;IAGb,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;;GAOF,EACD,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,MAAM,CAAC,WAAW,EAAE,EAAE,CACtE;SACC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;SAChE,MAAM,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assume-membership.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/assume-membership.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const tester_1 = require("../src/tester");
|
|
5
|
+
const requests_1 = require("../src/requests");
|
|
6
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
7
|
+
var TagModel;
|
|
8
|
+
(function (TagModel) {
|
|
9
|
+
class Tag {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.label = schema_definition_1.SchemaDefinition.stringColumn();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
TagModel.Tag = Tag;
|
|
15
|
+
})(TagModel || (TagModel = {}));
|
|
16
|
+
(0, vitest_1.test)('Content API: assume membership', async () => {
|
|
17
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel, schema => {
|
|
18
|
+
return {
|
|
19
|
+
...schema,
|
|
20
|
+
acl: {
|
|
21
|
+
roles: {
|
|
22
|
+
test: {
|
|
23
|
+
entities: {},
|
|
24
|
+
variables: {},
|
|
25
|
+
content: {
|
|
26
|
+
assumeMembership: {
|
|
27
|
+
admin: {},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}));
|
|
35
|
+
const email = `john+${Date.now()}@doe.com`;
|
|
36
|
+
const identityId = await (0, requests_1.signUp)(email);
|
|
37
|
+
const authKey = await (0, requests_1.signIn)(email);
|
|
38
|
+
await (0, requests_1.addProjectMember)(identityId, tester.projectSlug, { role: 'test', variables: [] });
|
|
39
|
+
await tester((0, tester_1.gql) `
|
|
40
|
+
query {
|
|
41
|
+
listTag {
|
|
42
|
+
id
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`, { authorizationToken: authKey })
|
|
46
|
+
.expect(400);
|
|
47
|
+
await tester((0, tester_1.gql) `
|
|
48
|
+
query {
|
|
49
|
+
listTag {
|
|
50
|
+
id
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`, { authorizationToken: authKey })
|
|
54
|
+
.set('X-Contember-assume-membership', JSON.stringify({ memberships: [{ role: 'admin', variables: [] }] }))
|
|
55
|
+
.expect({ data: { listTag: [] } })
|
|
56
|
+
.expect(200);
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=assume-membership.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assume-membership.test.js","sourceRoot":"","sources":["../../../tests/e2e/assume-membership.test.ts"],"names":[],"mappings":";;AAAA,mCAA6B;AAC7B,0CAAiD;AACjD,8CAAkE;AAClE,oEAAoF;AAEpF,IAAU,QAAQ,CAIjB;AAJD,WAAU,QAAQ;IACjB,MAAa,GAAG;QAAhB;YACC,UAAK,GAAG,oCAAG,CAAC,YAAY,EAAE,CAAA;QAC3B,CAAC;KAAA;IAFY,YAAG,MAEf,CAAA;AACF,CAAC,EAJS,QAAQ,KAAR,QAAQ,QAIjB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C,MAAM,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-api-basic.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/content-api-basic.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const tester_1 = require("../src/tester");
|
|
5
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
6
|
+
var TagModel;
|
|
7
|
+
(function (TagModel) {
|
|
8
|
+
class Tag {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.label = schema_definition_1.SchemaDefinition.stringColumn();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
TagModel.Tag = Tag;
|
|
14
|
+
})(TagModel || (TagModel = {}));
|
|
15
|
+
(0, vitest_1.test)('Content API: create & read tag', async () => {
|
|
16
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel));
|
|
17
|
+
await tester((0, tester_1.gql) `
|
|
18
|
+
mutation {
|
|
19
|
+
createTag(data: { label: "graphql" }) {
|
|
20
|
+
ok
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`)
|
|
24
|
+
.expect(response => {
|
|
25
|
+
vitest_1.assert.deepStrictEqual(response.body.data, {
|
|
26
|
+
createTag: {
|
|
27
|
+
ok: true,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
})
|
|
31
|
+
.expect(200);
|
|
32
|
+
await tester((0, tester_1.gql) `
|
|
33
|
+
query {
|
|
34
|
+
listTag(filter: { label: { eq: "graphql" } }) {
|
|
35
|
+
label
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`)
|
|
39
|
+
.expect(response => {
|
|
40
|
+
vitest_1.assert.deepStrictEqual(response.body.data, {
|
|
41
|
+
listTag: [
|
|
42
|
+
{
|
|
43
|
+
label: 'graphql',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
})
|
|
48
|
+
.expect(200);
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=content-api-basic.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-api-basic.test.js","sourceRoot":"","sources":["../../../tests/e2e/content-api-basic.test.ts"],"names":[],"mappings":";;AAAA,mCAAqC;AACrC,0CAAiD;AACjD,oEAAoF;AAEpF,IAAU,QAAQ,CAIjB;AAJD,WAAU,QAAQ;IACjB,MAAa,GAAG;QAAhB;YACC,UAAK,GAAG,oCAAG,CAAC,YAAY,EAAE,CAAA;QAC3B,CAAC;KAAA;IAFY,YAAG,MAEf,CAAA;AACF,CAAC,EAJS,QAAQ,KAAR,QAAQ,QAIjB;AAED,IAAA,aAAI,EAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;IACjD,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,IAAA,gCAAY,EAAC,QAAQ,CAAC,CAAC,CAAA;IAEzD,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;GAMF,CACD;SACC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAClB,eAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE;YAC1C,SAAS,EAAE;gBACV,EAAE,EAAE,IAAI;aACR;SACD,CAAC,CAAA;IACH,CAAC,CAAC;SACD,MAAM,CAAC,GAAG,CAAC,CAAA;IAEb,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;GAMF,CACD;SACC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAClB,eAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE;YAC1C,OAAO,EAAE;gBACR;oBACC,KAAK,EAAE,SAAS;iBAChB;aACD;SACD,CAAC,CAAA;IACH,CAAC,CAAC;SACD,MAAM,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-invalid-schema.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/content-invalid-schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
5
|
+
const tester_1 = require("../src/tester");
|
|
6
|
+
var TagModel;
|
|
7
|
+
(function (TagModel) {
|
|
8
|
+
class Tag {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.label = schema_definition_1.SchemaDefinition.stringColumn();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
TagModel.Tag = Tag;
|
|
14
|
+
})(TagModel || (TagModel = {}));
|
|
15
|
+
(0, vitest_1.test)('Content API: invalid schema error', async () => {
|
|
16
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel));
|
|
17
|
+
await tester((0, tester_1.gql) `
|
|
18
|
+
mutation {
|
|
19
|
+
createFoo(data: { label: "graphql" }) {
|
|
20
|
+
ok
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`)
|
|
24
|
+
.expect(400)
|
|
25
|
+
.expect(response => {
|
|
26
|
+
vitest_1.assert.deepStrictEqual(response.body.errors[0].message, 'Cannot query field "createFoo" on type "Mutation". Did you mean "createTag"?');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=content-invalid-schema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-invalid-schema.test.js","sourceRoot":"","sources":["../../../tests/e2e/content-invalid-schema.test.ts"],"names":[],"mappings":";;AAAA,mCAAqC;AACrC,oEAAoF;AACpF,0CAAiD;AAGjD,IAAU,QAAQ,CAIjB;AAJD,WAAU,QAAQ;IACjB,MAAa,GAAG;QAAhB;YACC,UAAK,GAAG,oCAAG,CAAC,YAAY,EAAE,CAAA;QAC3B,CAAC;KAAA;IAFY,YAAG,MAEf,CAAA;AACF,CAAC,EAJS,QAAQ,KAAR,QAAQ,QAIjB;AAED,IAAA,aAAI,EAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;IACpD,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,IAAA,gCAAY,EAAC,QAAQ,CAAC,CAAC,CAAA;IAEzD,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;GAMF,CACD;SACC,MAAM,CAAC,GAAG,CAAC;SACX,MAAM,CAAC,QAAQ,CAAC,EAAE;QAClB,eAAM,CAAC,eAAe,CACrB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAC/B,8EAA8E,CAC9E,CAAA;IACF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homepage.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/homepage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vitest_1 = require("vitest");
|
|
7
|
+
const supertest_1 = __importDefault(require("supertest"));
|
|
8
|
+
const tester_1 = require("../src/tester");
|
|
9
|
+
(0, vitest_1.test)('show homepage', async () => {
|
|
10
|
+
await (0, supertest_1.default)(tester_1.apiUrl)
|
|
11
|
+
.get('/')
|
|
12
|
+
.expect(200)
|
|
13
|
+
.expect('App is running');
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=homepage.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homepage.test.js","sourceRoot":"","sources":["../../../tests/e2e/homepage.test.ts"],"names":[],"mappings":";;;;;AAAA,mCAA6B;AAC7B,0DAAiC;AACjC,0CAAsC;AAEtC,IAAA,aAAI,EAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IAChC,MAAM,IAAA,mBAAS,EAAC,eAAM,CAAC;SACrB,GAAG,CAAC,GAAG,CAAC;SACR,MAAM,CAAC,GAAG,CAAC;SACX,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAC3B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-member-access.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/tenant-member-access.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
5
|
+
const tester_1 = require("../src/tester");
|
|
6
|
+
const requests_1 = require("../src/requests");
|
|
7
|
+
var TagModel;
|
|
8
|
+
(function (TagModel) {
|
|
9
|
+
class Tag {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.label = schema_definition_1.SchemaDefinition.stringColumn();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
TagModel.Tag = Tag;
|
|
15
|
+
})(TagModel || (TagModel = {}));
|
|
16
|
+
(0, vitest_1.test)('Tenant API: sign up, add to a project and check project access', async () => {
|
|
17
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel));
|
|
18
|
+
const email = `john+${Date.now()}@doe.com`;
|
|
19
|
+
const identityId = await (0, requests_1.signUp)(email);
|
|
20
|
+
const authKey = await (0, requests_1.signIn)(email);
|
|
21
|
+
await tester((0, tester_1.gql) `
|
|
22
|
+
query {
|
|
23
|
+
listTag {
|
|
24
|
+
id
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`, { authorizationToken: authKey })
|
|
28
|
+
.expect(404)
|
|
29
|
+
.expect({ errors: [{ message: `Project ${tester.projectSlug} NOT found`, code: 404 }] });
|
|
30
|
+
await (0, requests_1.addProjectMember)(identityId, tester.projectSlug);
|
|
31
|
+
await tester((0, tester_1.gql) `
|
|
32
|
+
query {
|
|
33
|
+
listTag {
|
|
34
|
+
id
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`, { authorizationToken: authKey })
|
|
38
|
+
.expect(response => {
|
|
39
|
+
vitest_1.assert.deepStrictEqual(response.body.data, { listTag: [] });
|
|
40
|
+
})
|
|
41
|
+
.expect(200);
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=tenant-member-access.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-member-access.test.js","sourceRoot":"","sources":["../../../tests/e2e/tenant-member-access.test.ts"],"names":[],"mappings":";;AAAA,mCAAqC;AACrC,oEAAoF;AACpF,0CAAiD;AACjD,8CAAkE;AAGlE,IAAU,QAAQ,CAIjB;AAJD,WAAU,QAAQ;IACjB,MAAa,GAAG;QAAhB;YACC,UAAK,GAAG,oCAAG,CAAC,YAAY,EAAE,CAAA;QAC3B,CAAC;KAAA;IAFY,YAAG,MAEf,CAAA;AACF,CAAC,EAJS,QAAQ,KAAR,QAAQ,QAIjB;AAGD,IAAA,aAAI,EAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;IACjF,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,IAAA,gCAAY,EAAC,QAAQ,CAAC,CAAC,CAAA;IAEzD,MAAM,KAAK,GAAG,QAAQ,IAAI,CAAC,GAAG,EAAE,UAAU,CAAA;IAC1C,MAAM,UAAU,GAAG,MAAM,IAAA,iBAAM,EAAC,KAAK,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG,MAAM,IAAA,iBAAM,EAAC,KAAK,CAAC,CAAA;IAEnC,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;GAMF,EACD,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAC/B;SACC,MAAM,CAAC,GAAG,CAAC;SACX,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,WAAW,MAAM,CAAC,WAAW,YAAY,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;IAGzF,MAAM,IAAA,2BAAgB,EAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;IAEtD,MAAM,MAAM,CACX,IAAA,YAAG,EAAA;;;;;;GAMF,EACD,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAC/B;SACC,MAAM,CAAC,QAAQ,CAAC,EAAE;QAClB,eAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;IAC5D,CAAC,CAAC;SACD,MAAM,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-contember-ref.test.d.ts","sourceRoot":"","sources":["../../../tests/e2e/x-contember-ref.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const tester_1 = require("../src/tester");
|
|
5
|
+
const schema_definition_1 = require("@contember/schema-definition");
|
|
6
|
+
var TagModel;
|
|
7
|
+
(function (TagModel) {
|
|
8
|
+
class Tag {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.label = schema_definition_1.SchemaDefinition.stringColumn();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
TagModel.Tag = Tag;
|
|
14
|
+
})(TagModel || (TagModel = {}));
|
|
15
|
+
(0, vitest_1.test)('Content API: X-Contember-Ref header', async () => {
|
|
16
|
+
const tester = await (0, tester_1.createTester)((0, schema_definition_1.createSchema)(TagModel));
|
|
17
|
+
await tester((0, tester_1.gql) `
|
|
18
|
+
mutation {
|
|
19
|
+
createTag(data: { label: "typescript" }) {
|
|
20
|
+
ok
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`).expect(200);
|
|
24
|
+
const response = await tester((0, tester_1.gql) `
|
|
25
|
+
query {
|
|
26
|
+
listTag(filter: { label: { eq: "typescript" } }) {
|
|
27
|
+
label
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`)
|
|
31
|
+
.set('X-Contember-Ref', 'None')
|
|
32
|
+
.expect(response => {
|
|
33
|
+
vitest_1.assert.deepStrictEqual(response.body.data, {
|
|
34
|
+
listTag: [
|
|
35
|
+
{
|
|
36
|
+
label: 'typescript',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
})
|
|
41
|
+
.expect(200);
|
|
42
|
+
const eventKey = response.get('X-Contember-Ref');
|
|
43
|
+
await tester((0, tester_1.gql) `
|
|
44
|
+
query {
|
|
45
|
+
listTag {
|
|
46
|
+
label
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`)
|
|
50
|
+
.set('X-Contember-Ref', eventKey)
|
|
51
|
+
.expect(304);
|
|
52
|
+
// ignored for mutation
|
|
53
|
+
await tester((0, tester_1.gql) `
|
|
54
|
+
mutation {
|
|
55
|
+
createTag(data: { label: "typescript" }) {
|
|
56
|
+
ok
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`)
|
|
60
|
+
.set('X-Contember-Ref', eventKey)
|
|
61
|
+
.expect(200);
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=x-contember-ref.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-contember-ref.test.js","sourceRoot":"","sources":["../../../tests/e2e/x-contember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CAAC,CAAA;AACd,CAAC,CAAC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Acl } from '@contember/schema';
|
|
1
2
|
export declare const signIn: (email: string, password?: string) => Promise<string>;
|
|
2
3
|
export declare const signUp: (email: string, password?: string) => Promise<any>;
|
|
3
|
-
export declare const addProjectMember: (identityId: string, projectSlug: string,
|
|
4
|
+
export declare const addProjectMember: (identityId: string, projectSlug: string, membership?: Acl.Membership) => Promise<void>;
|
|
4
5
|
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../tests/src/requests.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAEvC,eAAO,MAAM,MAAM,UAAiB,MAAM,wBAAwB,QAAQ,MAAM,CAoB/E,CAAA;AAGD,eAAO,MAAM,MAAM,UAAiB,MAAM,oCAuBzC,CAAA;AAGD,eAAO,MAAM,gBAAgB,eAAsB,MAAM,eAAe,MAAM,eAAc,IAAI,UAAU,kBA2BzG,CAAA"}
|
|
@@ -40,19 +40,28 @@ const signUp = async (email, password = '123456') => {
|
|
|
40
40
|
return signUpResponse.body.data.signUp.result.person.identity.id;
|
|
41
41
|
};
|
|
42
42
|
exports.signUp = signUp;
|
|
43
|
-
const addProjectMember = async (identityId, projectSlug,
|
|
43
|
+
const addProjectMember = async (identityId, projectSlug, membership = { role: 'admin', variables: [] }) => {
|
|
44
44
|
await (0, tester_1.executeGraphql)('/tenant', (0, tester_1.gql) `
|
|
45
|
-
mutation ($identity: String!, $projectSlug: String!, $
|
|
46
|
-
addProjectMember(identityId: $identity, projectSlug: $projectSlug, memberships: [
|
|
45
|
+
mutation ($identity: String!, $projectSlug: String!, $membership: MembershipInput!) {
|
|
46
|
+
addProjectMember(identityId: $identity, projectSlug: $projectSlug, memberships: [$membership]) {
|
|
47
47
|
ok
|
|
48
|
+
error {
|
|
49
|
+
code
|
|
50
|
+
developerMessage
|
|
51
|
+
membershipValidation {
|
|
52
|
+
code
|
|
53
|
+
role
|
|
54
|
+
variable
|
|
55
|
+
}
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
`, {
|
|
51
|
-
variables: { identity: identityId, projectSlug,
|
|
60
|
+
variables: { identity: identityId, projectSlug, membership },
|
|
52
61
|
})
|
|
53
62
|
.expect(200)
|
|
54
63
|
.expect(response => {
|
|
55
|
-
vitest_1.assert.deepStrictEqual(response.body.data, { addProjectMember: { ok: true } });
|
|
64
|
+
vitest_1.assert.deepStrictEqual(response.body.data, { addProjectMember: { ok: true, error: null } });
|
|
56
65
|
});
|
|
57
66
|
};
|
|
58
67
|
exports.addProjectMember = addProjectMember;
|