@tailor-platform/sdk 1.15.1 → 1.16.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/CHANGELOG.md +24 -0
- package/dist/application-CNpRSiWJ.mjs +4 -0
- package/dist/{application-B0TR65qY.mjs → application-DQ2F9UmJ.mjs} +22 -6
- package/dist/application-DQ2F9UmJ.mjs.map +1 -0
- package/dist/cli/index.mjs +136 -2
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +20 -3
- package/dist/cli/lib.mjs +2 -2
- package/dist/configure/index.d.mts +3 -3
- package/dist/{index-Bs9AsQb2.d.mts → index-1V_2bvT4.d.mts} +11 -11
- package/dist/{index-DomkP6gz.d.mts → index-Ds8lbSJb.d.mts} +2 -2
- package/dist/plugin/index.d.mts +1 -1
- package/dist/schema-DRYB-nzA.mjs.map +1 -1
- package/dist/{types-Db1oxr0U.d.mts → types-_sYDzqHG.d.mts} +96 -52
- package/dist/types-b-ig8nW_.mjs.map +1 -1
- package/dist/{update-CnSKzwg6.mjs → update-C5jgLxpK.mjs} +48 -24
- package/dist/update-C5jgLxpK.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/docs/cli/function.md +64 -0
- package/docs/cli-reference.md +8 -0
- package/package.json +1 -1
- package/dist/application-B0TR65qY.mjs.map +0 -1
- package/dist/application-BmaRd-Tl.mjs +0 -4
- package/dist/update-CnSKzwg6.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#602](https://github.com/tailor-platform/sdk/pull/602) [`4174110`](https://github.com/tailor-platform/sdk/commit/4174110ae1d1410801de98f9df2020c1ee0a4ef8) Thanks [@remiposo](https://github.com/remiposo)! - Add `hasAny` / `not hasAny` permission operators for array-to-array comparison
|
|
8
|
+
|
|
9
|
+
New permission operators that check whether two arrays share any common elements.
|
|
10
|
+
|
|
11
|
+
Usage examples:
|
|
12
|
+
|
|
13
|
+
- `[{ user: "roles" }, "hasAny", { record: "allowedRoles" }]` — allow access when the user's roles overlap with the record's allowed roles
|
|
14
|
+
- `[{ user: "tags" }, "not hasAny", ["blocked", "suspended"]]` — deny access when the user's tags share any element with the blocked list
|
|
15
|
+
- `[["admin", "editor"], "hasAny", { user: "roles" }]` — both operands can be string arrays
|
|
16
|
+
|
|
17
|
+
Unlike `in` / `not in` (scalar vs array), `hasAny` / `not hasAny` compares two arrays and checks for intersection.
|
|
18
|
+
|
|
19
|
+
## 1.15.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#597](https://github.com/tailor-platform/sdk/pull/597) [`8d4f911`](https://github.com/tailor-platform/sdk/commit/8d4f9111645df049d91808c7083a054bb0ad656a) Thanks [@riku99](https://github.com/riku99)! - Show clear error when record/oldRecord/newRecord operand is used in gqlPermission
|
|
24
|
+
|
|
25
|
+
- [#609](https://github.com/tailor-platform/sdk/pull/609) [`50f0aee`](https://github.com/tailor-platform/sdk/commit/50f0aee0f17a05afde5bbce2a9f1b42f03cee0e5) Thanks [@riku99](https://github.com/riku99)! - Add `function logs` CLI command to list and view function execution logs
|
|
26
|
+
|
|
3
27
|
## 1.15.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -336,7 +336,9 @@ const operatorMap = {
|
|
|
336
336
|
"=": "eq",
|
|
337
337
|
"!=": "ne",
|
|
338
338
|
in: "in",
|
|
339
|
-
"not in": "nin"
|
|
339
|
+
"not in": "nin",
|
|
340
|
+
hasAny: "hasAny",
|
|
341
|
+
"not hasAny": "nhasAny"
|
|
340
342
|
};
|
|
341
343
|
function normalizeOperand(operand) {
|
|
342
344
|
if (typeof operand === "object" && "user" in operand) return { user: operand.user === "id" ? "_id" : operand.user };
|
|
@@ -97634,13 +97636,21 @@ const TailorDBTypeSettingsSchema = z.object({
|
|
|
97634
97636
|
bulkUpsert: z.boolean().optional(),
|
|
97635
97637
|
gqlOperations: GqlOperationsSchema.optional()
|
|
97636
97638
|
});
|
|
97639
|
+
const GQL_PERMISSION_INVALID_OPERAND_MESSAGE = "operand is not supported in gqlPermission. Use permission() for record-level conditions.";
|
|
97637
97640
|
const GqlPermissionOperandSchema = z.union([
|
|
97638
|
-
z.object({ user: z.string() }),
|
|
97641
|
+
z.object({ user: z.string() }).strict(),
|
|
97639
97642
|
z.string(),
|
|
97640
97643
|
z.boolean(),
|
|
97641
97644
|
z.array(z.string()),
|
|
97642
97645
|
z.array(z.boolean())
|
|
97643
|
-
])
|
|
97646
|
+
], { error: (issue) => {
|
|
97647
|
+
if (typeof issue.input === "object" && issue.input !== null) {
|
|
97648
|
+
const keys$1 = Object.keys(issue.input);
|
|
97649
|
+
if (keys$1.length === 1) return `"${keys$1[0]}" ${GQL_PERMISSION_INVALID_OPERAND_MESSAGE}`;
|
|
97650
|
+
return "Operand object must have exactly 1 key";
|
|
97651
|
+
}
|
|
97652
|
+
return "Invalid operand in gqlPermission";
|
|
97653
|
+
} });
|
|
97644
97654
|
const RecordPermissionOperandSchema = z.union([
|
|
97645
97655
|
GqlPermissionOperandSchema,
|
|
97646
97656
|
z.object({ record: z.string() }),
|
|
@@ -97651,7 +97661,9 @@ const PermissionOperatorSchema = z.enum([
|
|
|
97651
97661
|
"=",
|
|
97652
97662
|
"!=",
|
|
97653
97663
|
"in",
|
|
97654
|
-
"not in"
|
|
97664
|
+
"not in",
|
|
97665
|
+
"hasAny",
|
|
97666
|
+
"not hasAny"
|
|
97655
97667
|
]);
|
|
97656
97668
|
const RecordPermissionConditionSchema = z.tuple([
|
|
97657
97669
|
RecordPermissionOperandSchema,
|
|
@@ -97814,7 +97826,11 @@ function createTailorDBService(params) {
|
|
|
97814
97826
|
for (const exportName of Object.keys(module$1)) {
|
|
97815
97827
|
const exportedValue = module$1[exportName];
|
|
97816
97828
|
const result = TailorDBTypeSchema.safeParse(exportedValue);
|
|
97817
|
-
if (!result.success)
|
|
97829
|
+
if (!result.success) {
|
|
97830
|
+
const gqlPermissionIssue = result.error.issues.find((i$1) => i$1.message.includes(GQL_PERMISSION_INVALID_OPERAND_MESSAGE));
|
|
97831
|
+
if (gqlPermissionIssue) throw new Error(gqlPermissionIssue.message);
|
|
97832
|
+
continue;
|
|
97833
|
+
}
|
|
97818
97834
|
const relativePath = path$20.relative(process.cwd(), typeFile);
|
|
97819
97835
|
logger.log(`Type: ${styles.successBright(`"${result.data.name}"`)} loaded from ${styles.path(relativePath)}`);
|
|
97820
97836
|
rawTypes[typeFile][result.data.name] = result.data;
|
|
@@ -98579,4 +98595,4 @@ function defineApplication(params) {
|
|
|
98579
98595
|
|
|
98580
98596
|
//#endregion
|
|
98581
98597
|
export { ExecutorSchema as a, functionSchema as c, loadFilesWithIgnores as d, logger as f, createExecutorService as i, stringifyFunction as l, symbols as m, WorkflowJobSchema as n, OAuth2ClientSchema as o, styles as p, WorkflowSchema as r, ResolverSchema as s, defineApplication as t, tailorUserMap as u };
|
|
98582
|
-
//# sourceMappingURL=application-
|
|
98598
|
+
//# sourceMappingURL=application-DQ2F9UmJ.mjs.map
|