mcp-creatio 0.6.4 → 0.6.7
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/README.md +31 -11
- package/dist/creatio/auth/headers.d.ts +7 -0
- package/dist/creatio/auth/headers.d.ts.map +1 -1
- package/dist/creatio/auth/headers.js +16 -0
- package/dist/creatio/auth/headers.js.map +1 -1
- package/dist/creatio/auth/providers/legacy-provider.d.ts +2 -0
- package/dist/creatio/auth/providers/legacy-provider.d.ts.map +1 -1
- package/dist/creatio/auth/providers/legacy-provider.js +14 -7
- package/dist/creatio/auth/providers/legacy-provider.js.map +1 -1
- package/dist/creatio/auth/providers/oauth2-bearer-provider.d.ts +8 -7
- package/dist/creatio/auth/providers/oauth2-bearer-provider.d.ts.map +1 -1
- package/dist/creatio/auth/providers/oauth2-bearer-provider.js +19 -14
- package/dist/creatio/auth/providers/oauth2-bearer-provider.js.map +1 -1
- package/dist/creatio/services/dataservice/data-service-schema.d.ts.map +1 -1
- package/dist/creatio/services/dataservice/data-service-schema.js +16 -15
- package/dist/creatio/services/dataservice/data-service-schema.js.map +1 -1
- package/dist/creatio/services/odata/metadata-store.d.ts +10 -17
- package/dist/creatio/services/odata/metadata-store.d.ts.map +1 -1
- package/dist/creatio/services/odata/metadata-store.js +47 -75
- package/dist/creatio/services/odata/metadata-store.js.map +1 -1
- package/dist/creatio/services/versioned-ttl-cache.d.ts +33 -0
- package/dist/creatio/services/versioned-ttl-cache.d.ts.map +1 -0
- package/dist/creatio/services/versioned-ttl-cache.js +95 -0
- package/dist/creatio/services/versioned-ttl-cache.js.map +1 -0
- package/dist/server/bearer/bearer-edge.d.ts +4 -1
- package/dist/server/bearer/bearer-edge.d.ts.map +1 -1
- package/dist/server/bearer/bearer-edge.js +41 -15
- package/dist/server/bearer/bearer-edge.js.map +1 -1
- package/dist/server/http/health.d.ts +19 -0
- package/dist/server/http/health.d.ts.map +1 -0
- package/dist/server/http/health.js +41 -0
- package/dist/server/http/health.js.map +1 -0
- package/dist/server/http/http-server.d.ts +1 -0
- package/dist/server/http/http-server.d.ts.map +1 -1
- package/dist/server/http/http-server.js +9 -0
- package/dist/server/http/http-server.js.map +1 -1
- package/dist/server/http/index.d.ts +1 -0
- package/dist/server/http/index.d.ts.map +1 -1
- package/dist/server/http/index.js +1 -0
- package/dist/server/http/index.js.map +1 -1
- package/dist/server/http/mcp-handlers.d.ts.map +1 -1
- package/dist/server/http/mcp-handlers.js +12 -10
- package/dist/server/http/mcp-handlers.js.map +1 -1
- package/dist/server/mcp/server.d.ts +37 -28
- package/dist/server/mcp/server.d.ts.map +1 -1
- package/dist/server/mcp/server.js +96 -73
- package/dist/server/mcp/server.js.map +1 -1
- package/dist/server/mcp/tenant-tool-registry.d.ts +66 -0
- package/dist/server/mcp/tenant-tool-registry.d.ts.map +1 -0
- package/dist/server/mcp/tenant-tool-registry.js +113 -0
- package/dist/server/mcp/tenant-tool-registry.js.map +1 -0
- package/dist/utils/context.d.ts +21 -6
- package/dist/utils/context.d.ts.map +1 -1
- package/dist/utils/context.js +6 -6
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/network.d.ts +2 -0
- package/dist/utils/network.d.ts.map +1 -1
- package/dist/utils/network.js +11 -0
- package/dist/utils/network.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TenantToolRegistry = exports.TenantToolState = exports.DEFAULT_TENANT_KEY = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tenant bucket for every single-tenant auth mode (legacy / client-credentials / delegated /
|
|
6
|
+
* broker) and any gateway request that does NOT override the base URL. In those modes there is
|
|
7
|
+
* exactly one Creatio instance, so one shared bucket is correct and the behaviour is identical to
|
|
8
|
+
* the pre-multitenant server. Only a gateway request carrying `X-Creatio-Base-Url` gets its own
|
|
9
|
+
* per-instance bucket — that is where cross-tenant isolation actually matters.
|
|
10
|
+
*/
|
|
11
|
+
exports.DEFAULT_TENANT_KEY = '__default__';
|
|
12
|
+
/**
|
|
13
|
+
* Per-tenant capability + dynamic-tool state — one entry per effective Creatio base URL. Each
|
|
14
|
+
* tenant carries its OWN optional-capability probe verdicts, the tools those capabilities
|
|
15
|
+
* registered, and the live session servers to push late-discovered tools into. Keeping all of this
|
|
16
|
+
* per-tenant is what stops tenant A's capability verdict (DataForge on/off) or A's published tools
|
|
17
|
+
* from leaking to tenant B on a shared multi-tenant (gateway) deployment — the previous design
|
|
18
|
+
* probed once from the first caller and applied that verdict to everyone.
|
|
19
|
+
*/
|
|
20
|
+
class TenantToolState {
|
|
21
|
+
capabilities = new Map();
|
|
22
|
+
cooldownUntil = new Map();
|
|
23
|
+
dynamicTools = new Map();
|
|
24
|
+
sessionServers = new Set();
|
|
25
|
+
probeComplete = false;
|
|
26
|
+
probeInFlight = false;
|
|
27
|
+
lastAccessMs;
|
|
28
|
+
constructor(now) {
|
|
29
|
+
this.lastAccessMs = now;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.TenantToolState = TenantToolState;
|
|
33
|
+
/**
|
|
34
|
+
* Holds {@link TenantToolState} per tenant with TTL + LRU eviction — the tool-surface analog of a
|
|
35
|
+
* tenant client pool. A tenant with live session servers is NEVER evicted (its dynamic tools back
|
|
36
|
+
* those live sessions); only idle, session-less tenants are pruned, so memory stays bounded as the
|
|
37
|
+
* number of distinct Creatio instances seen by a gateway deployment grows.
|
|
38
|
+
*/
|
|
39
|
+
class TenantToolRegistry {
|
|
40
|
+
_maxTenants;
|
|
41
|
+
_ttlMs;
|
|
42
|
+
_tenants = new Map();
|
|
43
|
+
get size() {
|
|
44
|
+
return this._tenants.size;
|
|
45
|
+
}
|
|
46
|
+
constructor(options = {}) {
|
|
47
|
+
this._maxTenants = options.maxTenants ?? 100;
|
|
48
|
+
this._ttlMs = options.ttlMs ?? 30 * 60_000;
|
|
49
|
+
}
|
|
50
|
+
/** Evict idle, session-less tenants past the TTL, then enforce the LRU cap (still only over
|
|
51
|
+
* session-less tenants — an active tenant whose dynamic tools back a live session is kept). */
|
|
52
|
+
_prune(now) {
|
|
53
|
+
for (const [key, state] of this._tenants) {
|
|
54
|
+
if (state.sessionServers.size === 0 && now - state.lastAccessMs > this._ttlMs) {
|
|
55
|
+
this._tenants.delete(key);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (this._tenants.size <= this._maxTenants) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const evictable = Array.from(this._tenants.entries())
|
|
62
|
+
.filter(([, state]) => state.sessionServers.size === 0)
|
|
63
|
+
.sort((a, b) => a[1].lastAccessMs - b[1].lastAccessMs);
|
|
64
|
+
let over = this._tenants.size - this._maxTenants;
|
|
65
|
+
for (const [key] of evictable) {
|
|
66
|
+
if (over <= 0) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
this._tenants.delete(key);
|
|
70
|
+
over--;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** The state for a tenant, creating it on first use. Touches recency, then prunes stale peers —
|
|
74
|
+
* pruning AFTER the insert/touch so the cap is enforced on the resulting set (never left over
|
|
75
|
+
* by one) and the just-accessed tenant is the most-recently-used, so never the one evicted. */
|
|
76
|
+
getState(tenantKey, now = Date.now()) {
|
|
77
|
+
const existing = this._tenants.get(tenantKey);
|
|
78
|
+
if (existing) {
|
|
79
|
+
existing.lastAccessMs = now;
|
|
80
|
+
this._prune(now);
|
|
81
|
+
return existing;
|
|
82
|
+
}
|
|
83
|
+
const state = new TenantToolState(now);
|
|
84
|
+
this._tenants.set(tenantKey, state);
|
|
85
|
+
this._prune(now);
|
|
86
|
+
return state;
|
|
87
|
+
}
|
|
88
|
+
/** The tenant state owning a given session server (to release it when its transport closes). */
|
|
89
|
+
findBySession(mcp) {
|
|
90
|
+
for (const state of this._tenants.values()) {
|
|
91
|
+
if (state.sessionServers.has(mcp)) {
|
|
92
|
+
return state;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
/** Every live session server across all tenants (process shutdown). */
|
|
98
|
+
allSessionServers() {
|
|
99
|
+
const servers = [];
|
|
100
|
+
for (const state of this._tenants.values()) {
|
|
101
|
+
for (const mcp of state.sessionServers) {
|
|
102
|
+
servers.push(mcp);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return servers;
|
|
106
|
+
}
|
|
107
|
+
/** Drop all tenant state (process shutdown). */
|
|
108
|
+
clear() {
|
|
109
|
+
this._tenants.clear();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.TenantToolRegistry = TenantToolRegistry;
|
|
113
|
+
//# sourceMappingURL=tenant-tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant-tool-registry.js","sourceRoot":"","sources":["../../../src/server/mcp/tenant-tool-registry.ts"],"names":[],"mappings":";;;AAIA;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,aAAa,CAAC;AAQhD;;;;;;;GAOG;AACH,MAAa,eAAe;IACX,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC1C,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,YAAY,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9C,cAAc,GAAG,IAAI,GAAG,EAAa,CAAC;IAC/C,aAAa,GAAG,KAAK,CAAC;IACtB,aAAa,GAAG,KAAK,CAAC;IACtB,YAAY,CAAS;IAE5B,YAAY,GAAW;QACtB,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;IACzB,CAAC;CACD;AAZD,0CAYC;AASD;;;;;GAKG;AACH,MAAa,kBAAkB;IACb,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;IAE/D,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3B,C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AAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACD;AA/ED,gDA+EC"}
|
package/dist/utils/context.d.ts
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Creatio credential supplied per-request by an external party in the stateless passthrough modes
|
|
3
|
+
* (delegated / gateway): the MCP stores nothing and just forwards it, letting Creatio validate.
|
|
4
|
+
* `bearer` is an OAuth access token; `cookie` is a Forms-auth session (the raw Cookie header) plus
|
|
5
|
+
* its BPMCSRF anti-forgery token. The union is open to more shapes (e.g. basic) without touching
|
|
6
|
+
* the callers that only branch on `kind`.
|
|
7
|
+
*/
|
|
8
|
+
export type InjectedCredential = {
|
|
9
|
+
kind: 'bearer';
|
|
10
|
+
token: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'cookie';
|
|
13
|
+
cookie: string;
|
|
14
|
+
bpmcsrf?: string | undefined;
|
|
15
|
+
};
|
|
1
16
|
export type RequestContext = {
|
|
2
17
|
userKey?: string | undefined;
|
|
3
18
|
sessionId?: string | undefined;
|
|
4
19
|
/**
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
*
|
|
20
|
+
* The credential the client (delegated) or gateway supplied for this request; the bearer auth
|
|
21
|
+
* provider forwards it straight to Creatio. Absent for legacy / client-credentials (those
|
|
22
|
+
* self-authenticate with one configured identity) and for broker (the MCP owns the token).
|
|
8
23
|
*/
|
|
9
|
-
|
|
24
|
+
credential?: InjectedCredential | undefined;
|
|
10
25
|
/** Optional per-request Creatio instance override (gateway multi-tenant), from X-Creatio-Base-Url. */
|
|
11
26
|
baseUrlOverride?: string | undefined;
|
|
12
27
|
};
|
|
@@ -14,8 +29,8 @@ export declare function runWithContext<T>(ctx: Partial<RequestContext>, fn: () =
|
|
|
14
29
|
export declare function getRequestContext(): RequestContext | undefined;
|
|
15
30
|
export declare function getUserKey(): string | undefined;
|
|
16
31
|
export declare function getSessionId(): string | undefined;
|
|
17
|
-
/** The
|
|
18
|
-
export declare function
|
|
32
|
+
/** The per-request injected Creatio credential (stateless delegated/gateway passthrough), if any. */
|
|
33
|
+
export declare function getInjectedCredential(): InjectedCredential | undefined;
|
|
19
34
|
/** The per-request Creatio base-URL override (gateway multi-tenant), if any. */
|
|
20
35
|
export declare function getBaseUrlOverride(): string | undefined;
|
|
21
36
|
export declare function getEffectiveUserKey(): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC3B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC5C,sGAAsG;IACtG,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,CAAC;AAMF,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAehG;AAED,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAE9D;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAE/C;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED,qGAAqG;AACrG,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,SAAS,CAEtE;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAEvD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAYxD"}
|
package/dist/utils/context.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.runWithContext = runWithContext;
|
|
|
4
4
|
exports.getRequestContext = getRequestContext;
|
|
5
5
|
exports.getUserKey = getUserKey;
|
|
6
6
|
exports.getSessionId = getSessionId;
|
|
7
|
-
exports.
|
|
7
|
+
exports.getInjectedCredential = getInjectedCredential;
|
|
8
8
|
exports.getBaseUrlOverride = getBaseUrlOverride;
|
|
9
9
|
exports.getEffectiveUserKey = getEffectiveUserKey;
|
|
10
10
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
@@ -19,8 +19,8 @@ function runWithContext(ctx, fn) {
|
|
|
19
19
|
if (typeof ctx.sessionId === 'string') {
|
|
20
20
|
store.sessionId = ctx.sessionId;
|
|
21
21
|
}
|
|
22
|
-
if (
|
|
23
|
-
store.
|
|
22
|
+
if (ctx.credential) {
|
|
23
|
+
store.credential = ctx.credential;
|
|
24
24
|
}
|
|
25
25
|
if (typeof ctx.baseUrlOverride === 'string') {
|
|
26
26
|
store.baseUrlOverride = ctx.baseUrlOverride;
|
|
@@ -36,9 +36,9 @@ function getUserKey() {
|
|
|
36
36
|
function getSessionId() {
|
|
37
37
|
return als.getStore()?.sessionId;
|
|
38
38
|
}
|
|
39
|
-
/** The
|
|
40
|
-
function
|
|
41
|
-
return als.getStore()?.
|
|
39
|
+
/** The per-request injected Creatio credential (stateless delegated/gateway passthrough), if any. */
|
|
40
|
+
function getInjectedCredential() {
|
|
41
|
+
return als.getStore()?.credential;
|
|
42
42
|
}
|
|
43
43
|
/** The per-request Creatio base-URL override (gateway multi-tenant), if any. */
|
|
44
44
|
function getBaseUrlOverride() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/utils/context.ts"],"names":[],"mappings":";;AAgCA,wCAeC;AAED,8CAEC;AAED,gCAEC;AAED,oCAEC;AAGD,sDAEC;AAGD,gDAEC;AAED,kDAYC;AAnFD,uDAAqD;AAErD,0CAA6C;AA0B7C,MAAM,GAAG,GAAG,IAAI,oCAAiB,EAAkB,CAAC;AAEpD,MAAM,cAAc,GAAG,yBAAc,CAAC,QAAQ,CAAC;AAE/C,SAAgB,cAAc,CAAI,GAA4B,EAAE,EAAoB;IACnF,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC7B,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;QACvC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IACjC,CAAC;IACD,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IACnC,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC7C,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,SAAgB,iBAAiB;IAChC,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACvB,CAAC;AAED,SAAgB,UAAU;IACzB,OAAO,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC;AAChC,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,GAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC;AAClC,CAAC;AAED,qGAAqG;AACrG,SAAgB,qBAAqB;IACpC,OAAO,GAAG,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC;AACnC,CAAC;AAED,gFAAgF;AAChF,SAAgB,kBAAkB;IACjC,OAAO,GAAG,CAAC,QAAQ,EAAE,EAAE,eAAe,CAAC;AACxC,CAAC;AAED,SAAgB,mBAAmB;IAClC,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC3B,IAAI,GAAG,EAAE,OAAO,EAAE,CAAC;QAClB,OAAO,GAAG,CAAC,OAAO,CAAC;IACpB,CAAC;IACD,IAAI,GAAG,EAAE,SAAS,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACtB,OAAO,OAAO,CAAC,OAAO,CAAC;QACxB,CAAC;IACF,CAAC;IACD,OAAO,GAAG,EAAE,SAAS,CAAC;AACvB,CAAC"}
|
package/dist/utils/network.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { CookieKV } from '../types';
|
|
|
2
2
|
import type express from 'express';
|
|
3
3
|
export declare function getClientIp(req: express.Request): string | undefined;
|
|
4
4
|
export declare function parseSetCookie(setCookie: string[]): CookieKV[];
|
|
5
|
+
/** Extract the BPMCSRF anti-forgery token from a raw `Cookie` header value (Creatio Forms auth). */
|
|
6
|
+
export declare function extractBpmcsrf(cookieHeader: string): string | undefined;
|
|
5
7
|
export declare function getUserKeyFromRequest(req: express.Request): string | undefined;
|
|
6
8
|
export declare function getSessionIdFromRequest(req: any): any;
|
|
7
9
|
//# sourceMappingURL=network.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/utils/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAkBpE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAa9D;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAc9E;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,OAS/C"}
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/utils/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAkBpE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAa9D;AAED,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQvE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAc9E;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,OAS/C"}
|
package/dist/utils/network.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getClientIp = getClientIp;
|
|
4
4
|
exports.parseSetCookie = parseSetCookie;
|
|
5
|
+
exports.extractBpmcsrf = extractBpmcsrf;
|
|
5
6
|
exports.getUserKeyFromRequest = getUserKeyFromRequest;
|
|
6
7
|
exports.getSessionIdFromRequest = getSessionIdFromRequest;
|
|
7
8
|
function getClientIp(req) {
|
|
@@ -37,6 +38,16 @@ function parseSetCookie(setCookie) {
|
|
|
37
38
|
}
|
|
38
39
|
return out;
|
|
39
40
|
}
|
|
41
|
+
/** Extract the BPMCSRF anti-forgery token from a raw `Cookie` header value (Creatio Forms auth). */
|
|
42
|
+
function extractBpmcsrf(cookieHeader) {
|
|
43
|
+
for (const part of cookieHeader.split(';')) {
|
|
44
|
+
const trimmed = part.trim();
|
|
45
|
+
if (trimmed.startsWith('BPMCSRF=')) {
|
|
46
|
+
return trimmed.slice('BPMCSRF='.length);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
40
51
|
function getUserKeyFromRequest(req) {
|
|
41
52
|
const fromHeader = req.headers['x-user-key'];
|
|
42
53
|
if (typeof fromHeader === 'string' && fromHeader) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/utils/network.ts"],"names":[],"mappings":";;AAIA,kCAkBC;AAED,wCAaC;AAED,sDAcC;AAED,0DASC;
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/utils/network.ts"],"names":[],"mappings":";;AAIA,kCAkBC;AAED,wCAaC;AAGD,wCAQC;AAED,sDAcC;AAED,0DASC;AAvED,SAAgB,WAAW,CAAC,GAAoB;IAC/C,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAkC,CAAC;IAClF,IAAI,SAAS,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,MAAM,KA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