@bitrix24/mcp-docs 0.1.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.
- package/dist/__tests__/methods.test.d.ts +1 -0
- package/dist/__tests__/methods.test.js +54 -0
- package/dist/__tests__/methods.test.js.map +1 -0
- package/dist/__tests__/placements.test.d.ts +1 -0
- package/dist/__tests__/placements.test.js +36 -0
- package/dist/__tests__/placements.test.js.map +1 -0
- package/dist/__tests__/references.test.d.ts +1 -0
- package/dist/__tests__/references.test.js +42 -0
- package/dist/__tests__/references.test.js.map +1 -0
- package/dist/__tests__/scopes.test.d.ts +1 -0
- package/dist/__tests__/scopes.test.js +32 -0
- package/dist/__tests__/scopes.test.js.map +1 -0
- package/dist/__tests__/search.test.d.ts +1 -0
- package/dist/__tests__/search.test.js +43 -0
- package/dist/__tests__/search.test.js.map +1 -0
- package/dist/data/app-types.json +64 -0
- package/dist/data/categories.json +32 -0
- package/dist/data/methods.json +370 -0
- package/dist/data/placements.json +252 -0
- package/dist/data/scopes.json +177 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/guides.d.ts +6 -0
- package/dist/resources/guides.js +26 -0
- package/dist/resources/guides.js.map +1 -0
- package/dist/tools/methods.d.ts +33 -0
- package/dist/tools/methods.js +24 -0
- package/dist/tools/methods.js.map +1 -0
- package/dist/tools/placements.d.ts +29 -0
- package/dist/tools/placements.js +18 -0
- package/dist/tools/placements.js.map +1 -0
- package/dist/tools/references.d.ts +12 -0
- package/dist/tools/references.js +9 -0
- package/dist/tools/references.js.map +1 -0
- package/dist/tools/scopes.d.ts +15 -0
- package/dist/tools/scopes.js +12 -0
- package/dist/tools/scopes.js.map +1 -0
- package/dist/tools/search.d.ts +18 -0
- package/dist/tools/search.js +47 -0
- package/dist/tools/search.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { getRestMethods, getMethodDetail } from '../tools/methods.js';
|
|
3
|
+
describe('getRestMethods', () => {
|
|
4
|
+
it('returns all methods when no filter', () => {
|
|
5
|
+
const result = getRestMethods();
|
|
6
|
+
expect(result).toHaveLength(34);
|
|
7
|
+
});
|
|
8
|
+
it('filters by scope "crm"', () => {
|
|
9
|
+
const result = getRestMethods('crm');
|
|
10
|
+
expect(result).toHaveLength(12);
|
|
11
|
+
for (const m of result) {
|
|
12
|
+
expect(m.scope).toBe('crm');
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
it('filters by query matching method name', () => {
|
|
16
|
+
const result = getRestMethods(undefined, 'deal.list');
|
|
17
|
+
expect(result.length).toBeGreaterThan(0);
|
|
18
|
+
for (const m of result) {
|
|
19
|
+
expect(m.method.toLowerCase()).toContain('deal.list');
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
it('filters by query matching description', () => {
|
|
23
|
+
const result = getRestMethods(undefined, 'paginated');
|
|
24
|
+
expect(result.length).toBeGreaterThan(0);
|
|
25
|
+
});
|
|
26
|
+
it('combines scope and query filters', () => {
|
|
27
|
+
const result = getRestMethods('crm', 'deal');
|
|
28
|
+
expect(result.length).toBeGreaterThan(0);
|
|
29
|
+
for (const m of result) {
|
|
30
|
+
expect(m.scope).toBe('crm');
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
it('returns empty array when no match', () => {
|
|
34
|
+
const result = getRestMethods('nonexistent_scope_xyz');
|
|
35
|
+
expect(result).toEqual([]);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('getMethodDetail', () => {
|
|
39
|
+
it('returns method for known name', () => {
|
|
40
|
+
const result = getMethodDetail('crm.deal.list');
|
|
41
|
+
expect(result).not.toBeNull();
|
|
42
|
+
expect(result?.method).toBe('crm.deal.list');
|
|
43
|
+
expect(result).toHaveProperty('description');
|
|
44
|
+
expect(result).toHaveProperty('scope');
|
|
45
|
+
expect(result).toHaveProperty('parameters');
|
|
46
|
+
expect(result).toHaveProperty('returns');
|
|
47
|
+
expect(result).toHaveProperty('example');
|
|
48
|
+
});
|
|
49
|
+
it('returns null for unknown method', () => {
|
|
50
|
+
const result = getMethodDetail('nonexistent.method.xyz');
|
|
51
|
+
expect(result).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=methods.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.test.js","sourceRoot":"","sources":["../../src/__tests__/methods.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QACpC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;QAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;QACrD,MAAM,CAAC,MAAM,CAAC,MA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,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;QAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;QAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;QACxC,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,MAAM,GAAG,eAAe,CAAC,wBAAwB,CAAC,CAAA;QACxD,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { getPlacements, getPlacementDetail } from '../tools/placements.js';
|
|
3
|
+
describe('getPlacements', () => {
|
|
4
|
+
it('returns all placements when no filter', () => {
|
|
5
|
+
const result = getPlacements();
|
|
6
|
+
expect(result).toHaveLength(21);
|
|
7
|
+
});
|
|
8
|
+
it('filters by module "crm"', () => {
|
|
9
|
+
const result = getPlacements('crm');
|
|
10
|
+
expect(result).toHaveLength(16);
|
|
11
|
+
for (const p of result) {
|
|
12
|
+
expect(p.module).toBe('crm');
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
it('returns empty array for unknown module', () => {
|
|
16
|
+
const result = getPlacements('nonexistent_module');
|
|
17
|
+
expect(result).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe('getPlacementDetail', () => {
|
|
21
|
+
it('returns placement for known code', () => {
|
|
22
|
+
const result = getPlacementDetail('CRM_LEAD_LIST_MENU');
|
|
23
|
+
expect(result).not.toBeNull();
|
|
24
|
+
expect(result?.code).toBe('CRM_LEAD_LIST_MENU');
|
|
25
|
+
expect(result).toHaveProperty('title');
|
|
26
|
+
expect(result).toHaveProperty('description');
|
|
27
|
+
expect(result).toHaveProperty('module');
|
|
28
|
+
expect(result).toHaveProperty('handler_params');
|
|
29
|
+
expect(result).toHaveProperty('example');
|
|
30
|
+
});
|
|
31
|
+
it('returns null for unknown code', () => {
|
|
32
|
+
const result = getPlacementDetail('UNKNOWN_PLACEMENT_CODE');
|
|
33
|
+
expect(result).toBeNull();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=placements.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placements.test.js","sourceRoot":"","sources":["../../src/__tests__/placements.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAE1E,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,MAAM,GAAG,aAAa,EAAE,CAAA;QAC9B,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;QAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,CAAC,CAAC,MAAM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@@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { getAppTypes, getCategories } from '../tools/references.js';
|
|
3
|
+
describe('getAppTypes', () => {
|
|
4
|
+
it('returns 4 app types', () => {
|
|
5
|
+
const result = getAppTypes();
|
|
6
|
+
expect(result).toHaveLength(4);
|
|
7
|
+
});
|
|
8
|
+
it('each app type has required fields', () => {
|
|
9
|
+
const result = getAppTypes();
|
|
10
|
+
for (const a of result) {
|
|
11
|
+
expect(a).toHaveProperty('type');
|
|
12
|
+
expect(a).toHaveProperty('title');
|
|
13
|
+
expect(a).toHaveProperty('description');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
it('includes IFRAME and EXTERNAL types', () => {
|
|
17
|
+
const result = getAppTypes();
|
|
18
|
+
const types = result.map(a => a.type);
|
|
19
|
+
expect(types).toContain('IFRAME');
|
|
20
|
+
expect(types).toContain('EXTERNAL');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('getCategories', () => {
|
|
24
|
+
it('returns 6 categories', () => {
|
|
25
|
+
const result = getCategories();
|
|
26
|
+
expect(result).toHaveLength(6);
|
|
27
|
+
});
|
|
28
|
+
it('each category has required fields', () => {
|
|
29
|
+
const result = getCategories();
|
|
30
|
+
for (const c of result) {
|
|
31
|
+
expect(c).toHaveProperty('code');
|
|
32
|
+
expect(c).toHaveProperty('title');
|
|
33
|
+
expect(c).toHaveProperty('description');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
it('includes CRM category', () => {
|
|
37
|
+
const result = getCategories();
|
|
38
|
+
const codes = result.map(c => c.code);
|
|
39
|
+
expect(codes).toContain('CRM');
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=references.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.test.js","sourceRoot":"","sources":["../../src/__tests__/references.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,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C,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG,aAAa,EAAiE,CAAA;QAC7F,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAChC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;YACjC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;QACzC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,MAAM,GAAG,aAAa,EAA6B,CAAA;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QACrC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { getScopes } from '../tools/scopes.js';
|
|
3
|
+
describe('getScopes', () => {
|
|
4
|
+
it('returns all scopes when no filter', () => {
|
|
5
|
+
const result = getScopes();
|
|
6
|
+
expect(result).toHaveLength(35);
|
|
7
|
+
for (const s of result) {
|
|
8
|
+
expect(s).toHaveProperty('scope');
|
|
9
|
+
expect(s).toHaveProperty('description');
|
|
10
|
+
expect(s).toHaveProperty('module');
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
it('filters by module "crm"', () => {
|
|
14
|
+
const result = getScopes('crm');
|
|
15
|
+
expect(result.length).toBeGreaterThan(0);
|
|
16
|
+
for (const s of result) {
|
|
17
|
+
expect(s.module).toBe('crm');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
it('filters by module "tasks"', () => {
|
|
21
|
+
const result = getScopes('tasks');
|
|
22
|
+
expect(result.length).toBeGreaterThan(0);
|
|
23
|
+
for (const s of result) {
|
|
24
|
+
expect(s.module).toBe('tasks');
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
it('returns empty array for unknown module', () => {
|
|
28
|
+
const result = getScopes('nonexistent_module_xyz');
|
|
29
|
+
expect(result).toEqual([]);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=scopes.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.test.js","sourceRoot":"","sources":["../../src/__tests__/scopes.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;QAC1B,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;QAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;YACjC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;YACvC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;QACpC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QAC/B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;QACxC,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;QACjC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;QACxC,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,MAAM,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAA;QAClD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { searchDocs } from '../tools/search.js';
|
|
3
|
+
describe('searchDocs', () => {
|
|
4
|
+
it('returns results for "crm deal"', () => {
|
|
5
|
+
const results = searchDocs('crm deal');
|
|
6
|
+
expect(results.length).toBeGreaterThan(0);
|
|
7
|
+
// every result should have required fields
|
|
8
|
+
for (const r of results) {
|
|
9
|
+
expect(r).toHaveProperty('title');
|
|
10
|
+
expect(r).toHaveProperty('type');
|
|
11
|
+
expect(r).toHaveProperty('summary');
|
|
12
|
+
expect(r).toHaveProperty('ref');
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
it('returns empty array for nonexistent query', () => {
|
|
16
|
+
const results = searchDocs('xyznonexistentterm12345');
|
|
17
|
+
expect(results).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
it('respects limit parameter', () => {
|
|
20
|
+
const results = searchDocs('crm', 3);
|
|
21
|
+
expect(results.length).toBeLessThanOrEqual(3);
|
|
22
|
+
});
|
|
23
|
+
it('caps results at 50 even if higher limit is requested', () => {
|
|
24
|
+
const results = searchDocs('crm', 100);
|
|
25
|
+
expect(results.length).toBeLessThanOrEqual(50);
|
|
26
|
+
});
|
|
27
|
+
it('returns results sorted by relevance (score descending)', () => {
|
|
28
|
+
const results = searchDocs('crm deal');
|
|
29
|
+
// Results with higher score should come first - check no score field is exposed
|
|
30
|
+
for (const r of results) {
|
|
31
|
+
expect(r).not.toHaveProperty('score');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
it('returns correct result types', () => {
|
|
35
|
+
const results = searchDocs('crm');
|
|
36
|
+
const types = new Set(results.map(r => r.type));
|
|
37
|
+
const validTypes = new Set(['placement', 'scope', 'method', 'category', 'app_type']);
|
|
38
|
+
for (const t of types) {
|
|
39
|
+
expect(validTypes.has(t)).toBe(true);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=search.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.test.js","sourceRoot":"","sources":["../../src/__tests__/search.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAA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AAC;YACxB,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QACvC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;QACjC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QAC/C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAA;QACpF,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "IFRAME",
|
|
4
|
+
"title": "Iframe Application",
|
|
5
|
+
"description": "The application is embedded directly inside the Bitrix24 interface as an iframe. The application URL is loaded within a frame on the Bitrix24 portal page, and the app can use the BX24 JavaScript SDK to call REST methods, listen to events, and interact with the portal. This is the most common application type for interactive, user-facing tools. Use this type when your application needs to present a UI inside Bitrix24 and communicate with the portal in real time.",
|
|
6
|
+
"use_cases": [
|
|
7
|
+
"CRM integrations with custom UI tabs",
|
|
8
|
+
"Interactive dashboards embedded in Bitrix24",
|
|
9
|
+
"Custom forms and data-entry tools",
|
|
10
|
+
"Third-party service widgets displayed inside Bitrix24"
|
|
11
|
+
],
|
|
12
|
+
"requirements": [
|
|
13
|
+
"Application must be served over HTTPS",
|
|
14
|
+
"Handler URL must return a valid HTML page",
|
|
15
|
+
"Use BX24.init() to initialise the JS SDK before calling methods"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "EXTERNAL",
|
|
20
|
+
"title": "External Application",
|
|
21
|
+
"description": "The application runs on an external server and communicates with Bitrix24 exclusively via the REST API using server-side requests. Users interact with the application on its own website or interface, not inside Bitrix24. OAuth 2.0 is used for authentication. Use this type for server-side integrations that process data in the background or operate independently of the Bitrix24 UI.",
|
|
22
|
+
"use_cases": [
|
|
23
|
+
"Background data synchronisation between Bitrix24 and third-party systems",
|
|
24
|
+
"Automated pipelines that process CRM data server-side",
|
|
25
|
+
"Reporting and analytics tools with their own UI",
|
|
26
|
+
"Webhook consumers that react to Bitrix24 events"
|
|
27
|
+
],
|
|
28
|
+
"requirements": [
|
|
29
|
+
"Must implement OAuth 2.0 authorisation code flow",
|
|
30
|
+
"Application server must be publicly accessible for webhook callbacks",
|
|
31
|
+
"No BX24 JS SDK available (server-to-server only)"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "LINK",
|
|
36
|
+
"title": "Link Application",
|
|
37
|
+
"description": "A lightweight application type that simply opens an external URL (with optional parameters) when launched from Bitrix24. No iframe embedding occurs; Bitrix24 redirects or opens the link in a new browser tab. Useful for directing users to an external web application or documentation with context passed as query parameters.",
|
|
38
|
+
"use_cases": [
|
|
39
|
+
"Linking to external SaaS tools with pre-filled context (user ID, deal ID)",
|
|
40
|
+
"Deep-linking to third-party portals from Bitrix24",
|
|
41
|
+
"Quick-launch shortcuts to external dashboards or reporting systems"
|
|
42
|
+
],
|
|
43
|
+
"requirements": [
|
|
44
|
+
"Target URL must be accessible to users",
|
|
45
|
+
"Parameters (user ID, portal domain, etc.) are passed as query string arguments"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"type": "SERVER",
|
|
50
|
+
"title": "Server Application",
|
|
51
|
+
"description": "A server-side application that operates entirely via REST API without a user-facing iframe or redirect flow. Typically used for system-level integrations, automation scripts, and backend services that authenticate using application credentials (client_credentials grant) rather than per-user OAuth. Suitable for daemon processes and scheduled jobs that interact with Bitrix24 data.",
|
|
52
|
+
"use_cases": [
|
|
53
|
+
"Scheduled batch jobs that sync data between Bitrix24 and external databases",
|
|
54
|
+
"Event-driven automations triggered by Bitrix24 webhooks",
|
|
55
|
+
"System integrations running as background services",
|
|
56
|
+
"Administrative tools that operate under a service account"
|
|
57
|
+
],
|
|
58
|
+
"requirements": [
|
|
59
|
+
"Must use client_credentials OAuth grant or application-level tokens",
|
|
60
|
+
"No user interaction or browser-based redirect required",
|
|
61
|
+
"Application server must handle incoming webhook events if subscribing to events"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"code": "CRM",
|
|
4
|
+
"title": "CRM",
|
|
5
|
+
"description": "Applications that extend or integrate with Bitrix24 CRM. Includes apps for deal automation, lead enrichment, contact synchronisation, and CRM analytics integrations."
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"code": "TELEPHONY",
|
|
9
|
+
"title": "Telephony",
|
|
10
|
+
"description": "Applications that integrate VoIP, PBX, or call centre systems with Bitrix24 telephony. Includes SIP connectors, call tracking, and click-to-call integrations."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"code": "DATA_MIGRATION",
|
|
14
|
+
"title": "Data Migration",
|
|
15
|
+
"description": "Applications that import or export data between Bitrix24 and external systems. Includes bulk import tools, CRM migration utilities, and data synchronisation connectors."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"code": "SMS_PROVIDER",
|
|
19
|
+
"title": "SMS Provider",
|
|
20
|
+
"description": "Applications that register a custom SMS provider for sending text messages from Bitrix24. Used to integrate external SMS gateways with Bitrix24 CRM notifications and marketing."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"code": "PAYMENT_SYSTEM",
|
|
24
|
+
"title": "Payment System",
|
|
25
|
+
"description": "Applications that integrate external payment gateways with the Bitrix24 online store. Registers a custom payment handler so customers can pay using third-party payment services."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"code": "BUSINESS_APP",
|
|
29
|
+
"title": "Business Application",
|
|
30
|
+
"description": "General-purpose business applications that extend Bitrix24 with custom functionality. Includes productivity tools, HR integrations, document management, and other business process automation."
|
|
31
|
+
}
|
|
32
|
+
]
|