@tailor-platform/sdk 1.56.0 → 1.56.1
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 +8 -0
- package/dist/application-CC3oaSay.mjs +4 -0
- package/dist/{application-YHZIkjdy.mjs → application-DuT_ae02.mjs} +31 -1
- package/dist/application-DuT_ae02.mjs.map +1 -0
- package/dist/cli/index.mjs +3 -3
- package/dist/cli/lib.d.mts +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +1 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-BW3v5XYC.d.mts → index-B61gFI9a.d.mts} +7 -2
- package/dist/{runtime-B8F1nklz.mjs → runtime-745lvg7i.mjs} +24 -3
- package/dist/runtime-745lvg7i.mjs.map +1 -0
- package/dist/{types-BinLwXM9.mjs → types-BwGth3a1.mjs} +57 -28
- package/dist/types-BwGth3a1.mjs.map +1 -0
- package/dist/{types-UeXbHFXW.mjs → types-Ccwchyj5.mjs} +1 -1
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-BHdBzgx6.d.mts → workflow.generated-Kz-nQrTf.d.mts} +10 -1
- package/package.json +1 -1
- package/dist/application-C9-t0qQb.mjs +0 -4
- package/dist/application-YHZIkjdy.mjs.map +0 -1
- package/dist/runtime-B8F1nklz.mjs.map +0 -1
- package/dist/types-BinLwXM9.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.56.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1347](https://github.com/tailor-platform/sdk/pull/1347) [`6888110`](https://github.com/tailor-platform/sdk/commit/6888110fa61f9f3fd991e0fb44e86fd37f9536f3) Thanks [@dqn](https://github.com/dqn)! - Fix resolver field builders (`t.*`) leaking metadata between fields. `description()`, `typeName()`, and `validate()` now return a new field instead of mutating the original, so a field instance reused across places (for example shared between a resolver's `input` and `output`, or a record passed to `t.object`) no longer leaks its metadata into the other usages. This matches the existing `db.*` behavior.
|
|
8
|
+
|
|
9
|
+
- [#1346](https://github.com/tailor-platform/sdk/pull/1346) [`0254e3c`](https://github.com/tailor-platform/sdk/commit/0254e3caff0d1eeb7407d8932385bf5bdbaf4356) Thanks [@dqn](https://github.com/dqn)! - Warn when a permission rule is written in object form without an explicit `permit`. Object-format rules (e.g. `read: [{ conditions: [...] }]`) default to `deny`, unlike the array shorthand which defaults to `allow`, so omitting `permit` can silently lock out access you meant to grant. The CLI now flags these rules during generate/deploy so you can set `permit: true` (allow) or `permit: false` (deny) explicitly. Runtime behavior is unchanged. This covers TailorDB record permissions, TailorDB GraphQL permissions, and IdP permissions.
|
|
10
|
+
|
|
3
11
|
## 1.56.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -2560,6 +2560,29 @@ function normalizeActionPermission(permission) {
|
|
|
2560
2560
|
permit: conditionArrayPermit ? "allow" : "deny"
|
|
2561
2561
|
};
|
|
2562
2562
|
}
|
|
2563
|
+
/**
|
|
2564
|
+
* Find object-format permission rules that omit `permit`.
|
|
2565
|
+
*
|
|
2566
|
+
* Object-format rules default to `deny` when `permit` is omitted, whereas the
|
|
2567
|
+
* array shorthand defaults to `allow`. Omitting `permit` on an object rule is
|
|
2568
|
+
* therefore an easy way to accidentally deny access you meant to grant, so the
|
|
2569
|
+
* CLI warns about these locations to nudge authors toward setting `permit`
|
|
2570
|
+
* explicitly.
|
|
2571
|
+
* @param rawPermissions - Raw permissions definition
|
|
2572
|
+
* @returns Dotted locations of offending rules, e.g. `record.read[0]`, `gql[1]`
|
|
2573
|
+
*/
|
|
2574
|
+
function findOmittedPermitRules(rawPermissions) {
|
|
2575
|
+
const locations = [];
|
|
2576
|
+
const record = rawPermissions.record;
|
|
2577
|
+
if (record) for (const action of Object.keys(record)) record[action]?.forEach((rule, index) => {
|
|
2578
|
+
if (isObjectFormat(rule) && rule.permit === void 0) locations.push(`record.${String(action)}[${index}]`);
|
|
2579
|
+
});
|
|
2580
|
+
const gql = rawPermissions.gql;
|
|
2581
|
+
if (gql) gql.forEach((policy, index) => {
|
|
2582
|
+
if (policy.permit === void 0) locations.push(`gql[${index}]`);
|
|
2583
|
+
});
|
|
2584
|
+
return locations;
|
|
2585
|
+
}
|
|
2563
2586
|
|
|
2564
2587
|
//#endregion
|
|
2565
2588
|
//#region src/parser/service/tailordb/relation.ts
|
|
@@ -3431,6 +3454,12 @@ function createTailorDBService(params) {
|
|
|
3431
3454
|
for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) allTypes[typeName] = type;
|
|
3432
3455
|
types = parseTypes(allTypes, namespace, typeSourceInfo);
|
|
3433
3456
|
};
|
|
3457
|
+
const warnOmittedPermit = () => {
|
|
3458
|
+
for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) {
|
|
3459
|
+
const locations = findOmittedPermitRules(type.metadata.permissions ?? {});
|
|
3460
|
+
if (locations.length > 0) logger.warn(`TailorDB type "${typeName}" has permission rule(s) ${locations.join(", ")} in object form without an explicit "permit"; they default to "deny". Set permit: true (allow) or permit: false (deny) to silence this warning.`);
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3434
3463
|
/**
|
|
3435
3464
|
* Process plugins for a type and add generated types to rawTypes
|
|
3436
3465
|
* @param rawType - The raw TailorDB type being processed
|
|
@@ -3523,6 +3552,7 @@ function createTailorDBService(params) {
|
|
|
3523
3552
|
if (pluginManager) for (const typeFile of typeFiles) await loadTypeFile(typeFile, tsconfig);
|
|
3524
3553
|
else await Promise.all(typeFiles.map((typeFile) => loadTypeFile(typeFile, tsconfig)));
|
|
3525
3554
|
doParseTypes();
|
|
3555
|
+
warnOmittedPermit();
|
|
3526
3556
|
return types;
|
|
3527
3557
|
})();
|
|
3528
3558
|
return loadPromise;
|
|
@@ -5806,4 +5836,4 @@ async function loadApplication(params) {
|
|
|
5806
5836
|
|
|
5807
5837
|
//#endregion
|
|
5808
5838
|
export { saveUserTokens as A, deleteUserTokens as C, loadWorkspaceId as D, loadConfigPath as E, readPlatformConfig as O, loadConfig as S, loadAccessToken as T, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, getDistDir as b, createExecutorService as c, buildExecutorArgsExpr as d, buildResolverOperationHookExpr as f, composeFunctionTreeshakeOptions as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, writePlatformConfig as j, resolveTokens as k, ExecutorSchema as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, INVOKER_EXPR as u, resolveBundleLogLevel as v, fetchLatestToken as w, hashFile as x, createBundleCache as y };
|
|
5809
|
-
//# sourceMappingURL=application-
|
|
5839
|
+
//# sourceMappingURL=application-DuT_ae02.mjs.map
|