@erxes/plugin-sdk 0.1.0-v2.7 → 0.1.0-v2.9

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.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * A list's filter bar (erxes-ui's `ListFilter`) as SQL, the way core compiles its own lists:
3
+ *
4
+ * const FIELDS = {
5
+ * 'subject.name': { type: 'text', expr: tickets.name },
6
+ * 'subject.assigneeIds': { type: 'member', expr: tickets.assigneeIds, array: true },
7
+ * 'subject.tagIds': { type: 'tags', expr: tickets.tagIds },
8
+ * 'subject.createdAt': { type: 'date', expr: tickets.createdAt },
9
+ * } satisfies FilterFields;
10
+ *
11
+ * input: z.object({ filter: FilterParam.optional() }),
12
+ * .where(compileFilter(FIELDS, input.filter, { me: member.userId }))
13
+ *
14
+ * A rule on a path `fields` lacks, or with an operator or value its field can't take, throws
15
+ * core's 400 `INVALID_FILTER`.
16
+ */
17
+ import { ConditionGroup, ConditionRule } from "@erxes/core-contract";
18
+ import { ORPCError } from "@orpc/client";
19
+ import { z } from "zod";
20
+ import { Column, SQL } from "drizzle-orm";
21
+ /** A filter that doesn't fit its fields: core's 400 `INVALID_FILTER`. */
22
+ export declare const invalidFilter: (message: string) => ORPCError<"INVALID_FILTER", unknown>;
23
+ /** One field a list can be filtered by, as `ListFilter`'s field `type` says it compares. */
24
+ export interface FilterColumn {
25
+ type: 'text' | 'number' | 'date' | 'boolean' | 'select' | 'member' | 'tags';
26
+ /** The value as SQL: a column, or an expression over the list's table. */
27
+ expr: Column | SQL;
28
+ /** Named in errors; the path when absent. */
29
+ label?: string;
30
+ /** A `text[]` column, such as members or tag ids: "is" means "has". `tags` always is one. */
31
+ array?: boolean;
32
+ /** Only a day, no time: dates compare as dates, so an index on them applies. */
33
+ dateOnly?: boolean;
34
+ /** Text with a trigram index: "is" is an ILIKE without wildcards, so the index serves it. */
35
+ trigram?: boolean;
36
+ /** "Anniversary within" reads this month * 100 + day expression (a stored birthday's). */
37
+ monthDay?: SQL;
38
+ }
39
+ /** The fields a list can be filtered by, keyed by the rules' paths (`subject.<name>`). */
40
+ export type FilterFields = Record<string, FilterColumn>;
41
+ /** "Me" in a member rule: the member asking, if a member is. */
42
+ export interface FilterContext {
43
+ me?: string | null;
44
+ }
45
+ /** A list's `filter` query parameter: the condition group as JSON. */
46
+ export declare const FilterParam: z.ZodType<ConditionGroup, string>;
47
+ /** A text array parameter (a JS array in a template becomes a list of parameters, not one array). */
48
+ export declare const textArray: (values: string[]) => SQL<unknown>;
49
+ /** A LIKE pattern's text, where `%`, `_` and `\` match themselves. */
50
+ export declare const escapeLike: (value: string) => string;
51
+ export declare const text: (value: unknown) => string;
52
+ export declare const list: (value: unknown) => string[];
53
+ export declare const number: (value: unknown) => number;
54
+ /** Negative ops on a relation or a custom field: "none where …" rather than "one where not …". */
55
+ export declare const NEGATIVE: Partial<Record<ConditionRule['op'], ConditionRule['op']>>;
56
+ export declare const COMPARE: Partial<Record<ConditionRule['op'], string>>;
57
+ /** Date rules. Day-only values compare with days, so an index on them applies. */
58
+ export declare const compileDate: (x: SQL | Column, op: ConditionRule['op'], value: unknown, dateOnly: boolean, monthDay?: SQL) => SQL | undefined;
59
+ /** A rule's list of values, lower-cased, as a `text[]` parameter. */
60
+ export declare const lowerList: (value: unknown) => SQL<unknown>;
61
+ /** One rule on one field, or `INVALID_FILTER` when the field can't take its operator or value. */
62
+ export declare const compileColumn: (field: FilterColumn, path: string, rule: ConditionRule, context?: FilterContext) => SQL;
63
+ /** A condition group as SQL, each rule through `compileRule`: all of its rules, or any. */
64
+ export declare const compileGroup: (group: ConditionGroup, compileRule: (rule: ConditionRule) => SQL, depth?: number) => SQL | undefined;
65
+ /** A list's filter as one SQL condition on its table, or undefined when it has no rules. */
66
+ export declare const compileFilter: (fields: FilterFields, filter: ConditionGroup | null | undefined, context?: FilterContext) => SQL<unknown> | undefined;
package/dist/filter.js ADDED
@@ -0,0 +1,195 @@
1
+ import { ERRORS, RecordFilter } from "@erxes/core-contract";
2
+ import { ORPCError } from "@orpc/client";
3
+ import { z } from "zod";
4
+ import { and, inArray, not, or, sql } from "drizzle-orm";
5
+ // src/filter.ts
6
+ /**
7
+ * A list's filter bar (erxes-ui's `ListFilter`) as SQL, the way core compiles its own lists:
8
+ *
9
+ * const FIELDS = {
10
+ * 'subject.name': { type: 'text', expr: tickets.name },
11
+ * 'subject.assigneeIds': { type: 'member', expr: tickets.assigneeIds, array: true },
12
+ * 'subject.tagIds': { type: 'tags', expr: tickets.tagIds },
13
+ * 'subject.createdAt': { type: 'date', expr: tickets.createdAt },
14
+ * } satisfies FilterFields;
15
+ *
16
+ * input: z.object({ filter: FilterParam.optional() }),
17
+ * .where(compileFilter(FIELDS, input.filter, { me: member.userId }))
18
+ *
19
+ * A rule on a path `fields` lacks, or with an operator or value its field can't take, throws
20
+ * core's 400 `INVALID_FILTER`.
21
+ */
22
+ /** A filter that doesn't fit its fields: core's 400 `INVALID_FILTER`. */
23
+ const invalidFilter = (message) => new ORPCError("INVALID_FILTER", {
24
+ status: ERRORS.INVALID_FILTER.status,
25
+ message
26
+ });
27
+ /** A list's `filter` query parameter: the condition group as JSON. */
28
+ const FilterParam = z.string().transform((text, context) => {
29
+ try {
30
+ return JSON.parse(text);
31
+ } catch {
32
+ context.addIssue({
33
+ code: "custom",
34
+ message: "filter is not JSON"
35
+ });
36
+ return z.NEVER;
37
+ }
38
+ }).pipe(RecordFilter);
39
+ /** A text array parameter (a JS array in a template becomes a list of parameters, not one array). */
40
+ const textArray = (values) => sql`array[${sql.join(values.map((value) => sql`${value}`), sql`, `)}]::text[]`;
41
+ /** A LIKE pattern's text, where `%`, `_` and `\` match themselves. */
42
+ const escapeLike = (value) => value.replace(/[\\%_]/g, (char) => `\\${char}`);
43
+ const text = (value) => {
44
+ if (typeof value !== "string" && typeof value !== "number") throw invalidFilter("A text value is needed");
45
+ return String(value);
46
+ };
47
+ const list = (value) => {
48
+ if (!Array.isArray(value) || !value.length) throw invalidFilter("Choose at least one value");
49
+ return value.map(text);
50
+ };
51
+ const number = (value) => {
52
+ const n = typeof value === "number" ? value : Number(value);
53
+ if (!Number.isFinite(n)) throw invalidFilter("A number is needed");
54
+ return n;
55
+ };
56
+ /** `{ amount, unit }` of the relative date rules; anything else has no amount. */
57
+ const Span = z.object({
58
+ amount: z.unknown(),
59
+ unit: z.unknown()
60
+ }).partial();
61
+ const spanOf = (value) => Span.safeParse(value).data ?? {};
62
+ const interval = (value) => {
63
+ const { amount, unit } = spanOf(value);
64
+ const n = number(amount);
65
+ if (n < 0 || n > 3650) throw invalidFilter("Between 0 and 3650");
66
+ return unit === "months" ? sql`make_interval(months => ${n}::int)` : unit === "weeks" ? sql`make_interval(weeks => ${n}::int)` : sql`make_interval(days => ${n}::int)`;
67
+ };
68
+ /** Negative ops on a relation or a custom field: "none where …" rather than "one where not …". */
69
+ const NEGATIVE = {
70
+ neq: "eq",
71
+ not_contains: "contains",
72
+ not_in: "in",
73
+ not_exists: "exists"
74
+ };
75
+ const COMPARE = {
76
+ eq: "=",
77
+ neq: "<>",
78
+ gt: ">",
79
+ gte: ">=",
80
+ lt: "<",
81
+ lte: "<="
82
+ };
83
+ /** Month * 100 + day, as the stored birthday and the value index compute it. */
84
+ const monthDayOf = (day) => sql`((extract(month from ${day}) * 100 + extract(day from ${day}))::smallint)`;
85
+ /** "Within the next n days, any year", over a month-day expression; the window may run past 31 December. */
86
+ const anniversary = (monthDay, value) => {
87
+ const days = number(spanOf(value).amount);
88
+ if (days < 0 || days > 366) throw invalidFilter("Between 0 and 366 days");
89
+ const from = monthDayOf(sql`current_date`);
90
+ const to = monthDayOf(sql`(current_date + ${days}::int)`);
91
+ return sql`(case when ${to} >= ${from} then ${monthDay} between ${from} and ${to} else (${monthDay} >= ${from} or ${monthDay} <= ${to}) end)`;
92
+ };
93
+ /** Date rules. Day-only values compare with days, so an index on them applies. */
94
+ const compileDate = (x, op, value, dateOnly, monthDay) => {
95
+ const today = dateOnly ? sql`current_date` : sql`now()`;
96
+ const shift = (sign) => dateOnly ? sql`(current_date ${sql.raw(sign)} ${interval(value)})::date` : sql`now() ${sql.raw(sign)} ${interval(value)}`;
97
+ const cast = sql.raw(dateOnly ? "date" : "timestamptz");
98
+ const start = () => sql`${text(value)}::date::${cast}`;
99
+ const end = () => sql`(${text(value)}::date + 1)::${cast}`;
100
+ const on = () => dateOnly ? sql`${x} = ${start()}` : sql`(${x} >= ${start()} and ${x} < ${end()})`;
101
+ switch (op) {
102
+ case "eq": return on();
103
+ case "neq": return sql`(${x} is null or not ${on()})`;
104
+ case "lt": return sql`${x} < ${start()}`;
105
+ case "gte": return sql`${x} >= ${start()}`;
106
+ case "lte": return dateOnly ? sql`${x} <= ${start()}` : sql`${x} < ${end()}`;
107
+ case "gt": return dateOnly ? sql`${x} > ${start()}` : sql`${x} >= ${end()}`;
108
+ case "within_last": return sql`(${x} <= ${today} and ${x} >= ${shift("-")})`;
109
+ case "more_than_ago": return sql`${x} < ${shift("-")}`;
110
+ case "within_next": return sql`(${x} >= ${today} and ${x} <= ${shift("+")})`;
111
+ case "anniversary_within": return sql`(${x} is not null and ${anniversary(monthDay ?? monthDayOf(x), value)})`;
112
+ default: return;
113
+ }
114
+ };
115
+ /** A `text[]` column: "is" and "contains" mean it has the value, "is any of" that it has one of them. */
116
+ const compileArray = (x, values, rule) => {
117
+ switch (rule.op) {
118
+ case "eq":
119
+ case "contains": return sql`${x} @> ${textArray(values(rule.value))}`;
120
+ case "neq":
121
+ case "not_contains": return sql`not (${x} @> ${textArray(values(rule.value))})`;
122
+ case "in": return sql`${x} && ${textArray(list(rule.value).flatMap(values))}`;
123
+ case "not_in": return sql`not (${x} && ${textArray(list(rule.value).flatMap(values))})`;
124
+ default: return;
125
+ }
126
+ };
127
+ /** A member id; "me" is the member asking. */
128
+ const memberId = (value, { me }) => {
129
+ if (value !== "me") return text(value);
130
+ if (!me) throw invalidFilter("“me” is a member; this caller is not one");
131
+ return me;
132
+ };
133
+ const compileMember = (x, rule, context) => {
134
+ const id = (value) => memberId(value, context);
135
+ switch (rule.op) {
136
+ case "eq": return sql`${x} = ${id(rule.value)}`;
137
+ case "neq": return sql`(${x} is null or ${x} <> ${id(rule.value)})`;
138
+ case "in": return inArray(sql`${x}`, list(rule.value).map(id));
139
+ case "not_in": return sql`(${x} is null or not ${inArray(sql`${x}`, list(rule.value).map(id))})`;
140
+ default: return;
141
+ }
142
+ };
143
+ /** A rule's list of values, lower-cased, as a `text[]` parameter. */
144
+ const lowerList = (value) => textArray(list(value).map((item) => item.toLowerCase()));
145
+ const compileText = (field, rule) => {
146
+ const x = field.expr;
147
+ const is = (value) => field.trigram ? sql`${x} ilike ${escapeLike(value)}` : sql`lower(${x}) = lower(${value})`;
148
+ switch (rule.op) {
149
+ case "eq": return is(text(rule.value));
150
+ case "neq": return sql`(${x} is null or not ${is(text(rule.value))})`;
151
+ case "contains": return sql`${x} ilike ${`%${escapeLike(text(rule.value))}%`}`;
152
+ case "not_contains": return sql`(${x} is null or ${x} not ilike ${`%${escapeLike(text(rule.value))}%`})`;
153
+ case "starts_with": return sql`${x} ilike ${`${escapeLike(text(rule.value))}%`}`;
154
+ case "in": return sql`lower(${x}) = any(${lowerList(rule.value)})`;
155
+ case "not_in": return sql`(${x} is null or not (lower(${x}) = any(${lowerList(rule.value)})))`;
156
+ default: return;
157
+ }
158
+ };
159
+ const compileNumber = (x, rule) => {
160
+ if (rule.op === "neq") return sql`(${x} is null or ${x} <> ${number(rule.value)})`;
161
+ const compare = COMPARE[rule.op];
162
+ return compare ? sql`${x} ${sql.raw(compare)} ${number(rule.value)}` : void 0;
163
+ };
164
+ const compileBoolean = (x, rule) => {
165
+ if (rule.op !== "eq") return void 0;
166
+ return rule.value === true || rule.value === "true" ? sql`${x} is true` : sql`${x} is not true`;
167
+ };
168
+ const isArray = (field) => field.array === true || field.type === "tags";
169
+ /** One rule on one field, or `INVALID_FILTER` when the field can't take its operator or value. */
170
+ const compileColumn = (field, path, rule, context = {}) => {
171
+ const x = field.expr;
172
+ const { op } = rule;
173
+ if (op === "exists") return isArray(field) ? sql`cardinality(${x}) > 0` : field.type === "text" ? sql`coalesce(${x}, '') <> ''` : sql`${x} is not null`;
174
+ if (op === "not_exists") return not(compileColumn(field, path, {
175
+ ...rule,
176
+ op: "exists"
177
+ }, context));
178
+ const compiled = isArray(field) ? compileArray(x, (value) => [field.type === "member" ? memberId(value, context) : text(value)], rule) : field.type === "number" ? compileNumber(x, rule) : field.type === "date" ? compileDate(x, op, rule.value, Boolean(field.dateOnly), field.monthDay) : field.type === "member" ? compileMember(x, rule, context) : field.type === "boolean" ? compileBoolean(x, rule) : field.type === "select" || field.type === "text" ? compileText(field, rule) : void 0;
179
+ if (!compiled) throw invalidFilter(`“${field.label ?? path}” can't use “${op}”`);
180
+ return compiled;
181
+ };
182
+ /** A condition group as SQL, each rule through `compileRule`: all of its rules, or any. */
183
+ const compileGroup = (group, compileRule, depth = 1) => {
184
+ if (depth > 3) throw invalidFilter("At most three levels of groups");
185
+ const parts = group.rules.map((rule) => "match" in rule ? compileGroup(rule, compileRule, depth + 1) : compileRule(rule)).filter((part) => Boolean(part));
186
+ if (!parts.length) return void 0;
187
+ return group.match === "all" ? and(...parts) : or(...parts);
188
+ };
189
+ /** A list's filter as one SQL condition on its table, or undefined when it has no rules. */
190
+ const compileFilter = (fields, filter, context = {}) => filter ? compileGroup(filter, (rule) => {
191
+ const field = fields[rule.path];
192
+ if (!field) throw invalidFilter(`Unknown field: ${rule.path}`);
193
+ return compileColumn(field, rule.path, rule, context);
194
+ }) : void 0;
195
+ export { COMPARE, FilterParam, NEGATIVE, compileColumn, compileDate, compileFilter, compileGroup, escapeLike, invalidFilter, list, lowerList, number, text, textArray };
package/dist/index.d.ts CHANGED
@@ -78,6 +78,21 @@
78
78
  * res.sendStatus(204);
79
79
  * });
80
80
  *
81
+ * A timeline whose records not every member may read declares `recordAccess: true`; core asks the
82
+ * plugin before a member reads or notes on one, and anything but `{ allowed: true }` within 5 s is no:
83
+ *
84
+ * timelines: [{ type: 'frontline.ticket', label: 'Ticket', recordAccess: true }],
85
+ * app.post('/api/timelines/access', express.text({ type: '*\/*' }), async (req, res) => {
86
+ * const check = await verifyCoreAccessCheck(req.headers.authorization, req.body, { coreUrl, plugin: 'frontline' });
87
+ * res.json({ allowed: await canRead(check.orgId, check.userId, check.id) }); // check.type too
88
+ * });
89
+ *
90
+ * List filters (erxes-ui's `ListFilter`): `@erxes/plugin-sdk/filter` compiles the bar's condition
91
+ * group to SQL on a map of paths to columns, with core's operators and its 400 `INVALID_FILTER`:
92
+ *
93
+ * const FIELDS = { 'subject.name': { type: 'text', expr: tickets.name } } satisfies FilterFields;
94
+ * .where(compileFilter(FIELDS, input.filter, { me: member.userId })) // filter: FilterParam
95
+ *
81
96
  * The client secret is only ever sent to `POST /plugins/token`; API calls use
82
97
  * 15-minute tokens, fetched and renewed here. Plugins on core's database can
83
98
  * also call `core_publish_event()`, `core_record_audit()` and
@@ -85,5 +100,5 @@
85
100
  */
86
101
  import { CoreClient, CoreClientOptions, CoreTokenError, createCoreClient } from "./client.js";
87
102
  import { JobInput, enqueueJob } from "./jobs.js";
88
- import { CoreCall, CustomerSignIn, DeliveredEvent, ErxesSignIn, PluginMember, bearerOf, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession } from "./verify.js";
89
- export { CoreCall, CoreClient, CoreClientOptions, CoreTokenError, CustomerSignIn, DeliveredEvent, ErxesSignIn, JobInput, PluginMember, bearerOf, createCoreClient, enqueueJob, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession };
103
+ import { CoreCall, CustomerSignIn, DeliveredEvent, ErxesSignIn, PluginMember, bearerOf, verifyCoreAccessCheck, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession } from "./verify.js";
104
+ export { CoreCall, CoreClient, CoreClientOptions, CoreTokenError, CustomerSignIn, DeliveredEvent, ErxesSignIn, JobInput, PluginMember, bearerOf, createCoreClient, enqueueJob, verifyCoreAccessCheck, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { CoreTokenError, createCoreClient } from "./client.js";
2
2
  import { enqueueJob } from "./jobs.js";
3
- import { DeliveredEvent, bearerOf, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession } from "./verify.js";
4
- export { CoreTokenError, DeliveredEvent, bearerOf, createCoreClient, enqueueJob, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession };
3
+ import { DeliveredEvent, bearerOf, verifyCoreAccessCheck, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession } from "./verify.js";
4
+ export { CoreTokenError, DeliveredEvent, bearerOf, createCoreClient, enqueueJob, verifyCoreAccessCheck, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession };
package/dist/verify.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PluginAccess, PluginJobDelivery, PluginTier } from "@erxes/core-contract";
1
+ import { PluginAccess, PluginJobDelivery, PluginTier, RecordAccessCheck } from "@erxes/core-contract";
2
2
  import { z } from "zod";
3
3
  /** The signed-in member a plugin UI calls the plugin's API for. */
4
4
  export interface PluginMember {
@@ -135,4 +135,11 @@ export declare const verifyCoreEvent: (authorization: string | undefined | null,
135
135
  * `Idempotency-Key` header is its `jobId`.
136
136
  */
137
137
  export declare const verifyCoreJob: (authorization: string | undefined | null, rawBody: string, options: VerifyOptions) => Promise<PluginJobDelivery>;
138
+ /**
139
+ * Verifies core's question for a timeline with `recordAccess` (`POST <api.url>/timelines/access`)
140
+ * and returns it: may `userId` read record `id` of timeline `type`? The token is core's, for this
141
+ * plugin, unexpired, and signs this exact body (pass the raw body text). Answer
142
+ * `{ "allowed": true }` or `{ "allowed": false }` within 5 seconds; anything else is no.
143
+ */
144
+ export declare const verifyCoreAccessCheck: (authorization: string | undefined | null, rawBody: string, options: VerifyOptions) => Promise<RecordAccessCheck>;
138
145
  export {};
package/dist/verify.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CORE_API_PREFIX, CoreEvent, PluginAccess, PluginJobDelivery, PluginTier } from "@erxes/core-contract";
1
+ import { CORE_API_PREFIX, CoreEvent, PluginAccess, PluginJobDelivery, PluginTier, RecordAccessCheck } from "@erxes/core-contract";
2
2
  import { z } from "zod";
3
3
  import { createRemoteJWKSet, jwtVerify } from "jose";
4
4
  // src/verify.ts
@@ -174,4 +174,24 @@ const verifyCoreJob = async (authorization, rawBody, options) => {
174
174
  if (job.jobId !== claims.job || job.orgId !== claims.org) throw new Error("the job does not match the token");
175
175
  return job;
176
176
  };
177
- export { DeliveredEvent, bearerOf, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession };
177
+ const AccessClaims = z.object({
178
+ sha: z.string(),
179
+ access: z.string(),
180
+ org: z.string()
181
+ });
182
+ /**
183
+ * Verifies core's question for a timeline with `recordAccess` (`POST <api.url>/timelines/access`)
184
+ * and returns it: may `userId` read record `id` of timeline `type`? The token is core's, for this
185
+ * plugin, unexpired, and signs this exact body (pass the raw body text). Answer
186
+ * `{ "allowed": true }` or `{ "allowed": false }` within 5 seconds; anything else is no.
187
+ */
188
+ const verifyCoreAccessCheck = async (authorization, rawBody, options) => {
189
+ const token = bearerOf(authorization);
190
+ if (!token) throw new Error("no core token");
191
+ const claims = await verifyCoreToken(token, options, "erxes-core-access+jwt", AccessClaims);
192
+ if (claims.sha !== await sha256(rawBody)) throw new Error("the body does not match the token");
193
+ const check = RecordAccessCheck.parse(JSON.parse(rawBody));
194
+ if (check.orgId !== claims.org) throw new Error("the check does not match the token");
195
+ return check;
196
+ };
197
+ export { DeliveredEvent, bearerOf, verifyCoreAccessCheck, verifyCoreCall, verifyCoreEvent, verifyCoreJob, verifyCustomerToken, verifyErxesAccessToken, verifyPluginSession };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erxes/plugin-sdk",
3
- "version": "0.1.0-v2.7",
3
+ "version": "0.1.0-v2.9",
4
4
  "private": false,
5
5
  "description": "For erxes plugin servers: a typed core client with automatic plugin tokens, verification of members' plugin session tokens and of core's deliveries, and plugin jobs",
6
6
  "license": "AGPL-3.0-only",
@@ -17,6 +17,7 @@
17
17
  "exports": {
18
18
  ".": "./dist/index.js",
19
19
  "./client": "./dist/client.js",
20
+ "./filter": "./dist/filter.js",
20
21
  "./jobs": "./dist/jobs.js",
21
22
  "./verify": "./dist/verify.js",
22
23
  "./package.json": "./package.json"
@@ -32,7 +33,7 @@
32
33
  "@orpc/openapi-client": "1.16.2",
33
34
  "jose": "^6.2.17",
34
35
  "zod": "^4.6.7",
35
- "@erxes/core-contract": "0.1.0-v2.8"
36
+ "@erxes/core-contract": "0.1.0-v2.10"
36
37
  },
37
38
  "devDependencies": {
38
39
  "drizzle-orm": "0.45.4"