@tailor-platform/sdk 1.56.0 → 1.57.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 +20 -0
- package/README.md +0 -23
- package/dist/{application-YHZIkjdy.mjs → application-CdkoGX27.mjs} +37 -4
- package/dist/application-CdkoGX27.mjs.map +1 -0
- package/dist/application-x_mURdR0.mjs +4 -0
- package/dist/cli/erd-viewer-assets/app.js +1181 -0
- package/dist/cli/erd-viewer-assets/index.html +73 -0
- package/dist/cli/erd-viewer-assets/serve.json +13 -0
- package/dist/cli/erd-viewer-assets/styles.css +789 -0
- package/dist/cli/index.mjs +686 -345
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +7 -2
- package/dist/cli/lib.mjs +2 -2
- package/dist/client-DLPEPJ_s.mjs.map +1 -1
- 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-1YuaoNr8.mjs} +57 -63
- package/dist/runtime-1YuaoNr8.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/docs/cli/tailordb.md +31 -26
- package/docs/cli-reference.md +2 -2
- package/package.json +1 -3
- 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,25 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.57.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1319](https://github.com/tailor-platform/sdk/pull/1319) [`77754c2`](https://github.com/tailor-platform/sdk/commit/77754c264f3a18ccea2fb2ee2a144da4768b09a9) Thanks [@dqn](https://github.com/dqn)! - Replace the Liam-based `tailordb erd` beta commands with a TailorDB-specific ERD viewer generated from local TailorDB schema. `tailordb erd export` writes a single self-contained `index.html` under `<output>/<namespace>/dist` (CSS, JS, and the schema are inlined as separately extractable blocks), `tailordb erd serve` runs a built-in local server with watch reload and `--port` / `--open`, and `tailordb erd deploy` uploads the generated viewer while keeping the existing `erdSite` requirement.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1309](https://github.com/tailor-platform/sdk/pull/1309) [`9e4c726`](https://github.com/tailor-platform/sdk/commit/9e4c726c1a84ac70ba7bc74aaf4765173562ed0e) Thanks [@toiroakr](https://github.com/toiroakr)! - fix(cli): track auth connection ownership via platform labels
|
|
12
|
+
|
|
13
|
+
`deploy` now tags auth connections with SDK ownership labels and uses them to decide which connections to manage, matching every other auth resource. Connections that are not labeled by the SDK are treated as unowned: they are surfaced in the unmanaged-resource confirmation prompt rather than silently deleted, and once you confirm adoption the SDK label is written even when the connection is otherwise unchanged, so later deploys recognize it as owned. Auth connection deletions are also shown in the deletion confirmation prompt.
|
|
14
|
+
|
|
15
|
+
## 1.56.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#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.
|
|
20
|
+
|
|
21
|
+
- [#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.
|
|
22
|
+
|
|
3
23
|
## 1.56.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -97,26 +97,3 @@ See [Create Tailor Platform SDK](https://github.com/tailor-platform/sdk/tree/mai
|
|
|
97
97
|
|
|
98
98
|
- Node.js 22 or later (or Bun)
|
|
99
99
|
- A Tailor Platform account ([request access](https://www.tailor.tech/demo))
|
|
100
|
-
|
|
101
|
-
## Dependabot Noise
|
|
102
|
-
|
|
103
|
-
Installing `@tailor-platform/sdk` pulls in a few transitive advisories that are **not exploitable in practice**. They are listed here so you can triage reports from `npm audit` / `pnpm audit` / Dependabot without diffing our lockfile.
|
|
104
|
-
|
|
105
|
-
### valibot ReDoS ([GHSA-vqpr-j7v3-hqw9](https://github.com/advisories/GHSA-vqpr-j7v3-hqw9))
|
|
106
|
-
|
|
107
|
-
- **Why it shows up**: `@liam-hq/cli@0.7.24` pins `valibot@1.1.0`, which falls in the vulnerable range (`< 1.2.0`).
|
|
108
|
-
- **Why it's safe here**: `@liam-hq/cli` is invoked only by `tailor-sdk tailordb erd export` as a child process, against developer-controlled schema files. The vulnerable code path (`v.emoji()` on attacker-controlled strings) is never reached.
|
|
109
|
-
- **If you want to silence it**: add an override to your project so `valibot` resolves to `>=1.2.0`. `@toiroakr/lines-db` declares `valibot` as an optional peer with range `>=1.0.0`, so forcing `1.2.0+` is safe.
|
|
110
|
-
|
|
111
|
-
```jsonc
|
|
112
|
-
// pnpm (package.json)
|
|
113
|
-
"pnpm": { "overrides": { "valibot": ">=1.2.0" } }
|
|
114
|
-
|
|
115
|
-
// npm (package.json)
|
|
116
|
-
"overrides": { "valibot": ">=1.2.0" }
|
|
117
|
-
|
|
118
|
-
// yarn (package.json)
|
|
119
|
-
"resolutions": { "valibot": ">=1.2.0" }
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
This fix has to live in your project's `package.json` — overrides in a published package do not propagate to consumers.
|
|
@@ -606,15 +606,18 @@ const GeneratorConfigSchema = CodeGeneratorSchema.brand("CodeGenerator");
|
|
|
606
606
|
/**
|
|
607
607
|
* Load Tailor configuration file and associated generators and plugins.
|
|
608
608
|
* @param configPath - Optional explicit config path
|
|
609
|
+
* @param options - Optional module import behavior.
|
|
609
610
|
* @returns Loaded config, generators, plugins, and config path
|
|
610
611
|
*/
|
|
611
|
-
async function loadConfig(configPath) {
|
|
612
|
+
async function loadConfig(configPath, options = {}) {
|
|
612
613
|
installCliTailordbStub();
|
|
613
614
|
const foundPath = loadConfigPath(configPath);
|
|
614
615
|
if (!foundPath) throw new Error("Configuration file not found: tailor.config.ts not found in current or parent directories");
|
|
615
616
|
const resolvedPath = path.resolve(process.cwd(), foundPath);
|
|
616
617
|
if (!fs$1.existsSync(resolvedPath)) throw new Error(`Configuration file not found: ${configPath}`);
|
|
617
|
-
const
|
|
618
|
+
const configUrl = pathToFileURL(resolvedPath);
|
|
619
|
+
if (options.importNonce) configUrl.searchParams.set("tailorImportNonce", options.importNonce);
|
|
620
|
+
const configModule = await import(configUrl.href);
|
|
618
621
|
if (!configModule || !configModule.default) throw new Error("Invalid Tailor config module: default export not found");
|
|
619
622
|
const validated = AppConfigSchema.safeParse(configModule.default);
|
|
620
623
|
if (!validated.success) {
|
|
@@ -2560,6 +2563,29 @@ function normalizeActionPermission(permission) {
|
|
|
2560
2563
|
permit: conditionArrayPermit ? "allow" : "deny"
|
|
2561
2564
|
};
|
|
2562
2565
|
}
|
|
2566
|
+
/**
|
|
2567
|
+
* Find object-format permission rules that omit `permit`.
|
|
2568
|
+
*
|
|
2569
|
+
* Object-format rules default to `deny` when `permit` is omitted, whereas the
|
|
2570
|
+
* array shorthand defaults to `allow`. Omitting `permit` on an object rule is
|
|
2571
|
+
* therefore an easy way to accidentally deny access you meant to grant, so the
|
|
2572
|
+
* CLI warns about these locations to nudge authors toward setting `permit`
|
|
2573
|
+
* explicitly.
|
|
2574
|
+
* @param rawPermissions - Raw permissions definition
|
|
2575
|
+
* @returns Dotted locations of offending rules, e.g. `record.read[0]`, `gql[1]`
|
|
2576
|
+
*/
|
|
2577
|
+
function findOmittedPermitRules(rawPermissions) {
|
|
2578
|
+
const locations = [];
|
|
2579
|
+
const record = rawPermissions.record;
|
|
2580
|
+
if (record) for (const action of Object.keys(record)) record[action]?.forEach((rule, index) => {
|
|
2581
|
+
if (isObjectFormat(rule) && rule.permit === void 0) locations.push(`record.${String(action)}[${index}]`);
|
|
2582
|
+
});
|
|
2583
|
+
const gql = rawPermissions.gql;
|
|
2584
|
+
if (gql) gql.forEach((policy, index) => {
|
|
2585
|
+
if (policy.permit === void 0) locations.push(`gql[${index}]`);
|
|
2586
|
+
});
|
|
2587
|
+
return locations;
|
|
2588
|
+
}
|
|
2563
2589
|
|
|
2564
2590
|
//#endregion
|
|
2565
2591
|
//#region src/parser/service/tailordb/relation.ts
|
|
@@ -3431,6 +3457,12 @@ function createTailorDBService(params) {
|
|
|
3431
3457
|
for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) allTypes[typeName] = type;
|
|
3432
3458
|
types = parseTypes(allTypes, namespace, typeSourceInfo);
|
|
3433
3459
|
};
|
|
3460
|
+
const warnOmittedPermit = () => {
|
|
3461
|
+
for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) {
|
|
3462
|
+
const locations = findOmittedPermitRules(type.metadata.permissions ?? {});
|
|
3463
|
+
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.`);
|
|
3464
|
+
}
|
|
3465
|
+
};
|
|
3434
3466
|
/**
|
|
3435
3467
|
* Process plugins for a type and add generated types to rawTypes
|
|
3436
3468
|
* @param rawType - The raw TailorDB type being processed
|
|
@@ -3523,6 +3555,7 @@ function createTailorDBService(params) {
|
|
|
3523
3555
|
if (pluginManager) for (const typeFile of typeFiles) await loadTypeFile(typeFile, tsconfig);
|
|
3524
3556
|
else await Promise.all(typeFiles.map((typeFile) => loadTypeFile(typeFile, tsconfig)));
|
|
3525
3557
|
doParseTypes();
|
|
3558
|
+
warnOmittedPermit();
|
|
3526
3559
|
return types;
|
|
3527
3560
|
})();
|
|
3528
3561
|
return loadPromise;
|
|
@@ -5805,5 +5838,5 @@ async function loadApplication(params) {
|
|
|
5805
5838
|
}
|
|
5806
5839
|
|
|
5807
5840
|
//#endregion
|
|
5808
|
-
export {
|
|
5809
|
-
//# sourceMappingURL=application-
|
|
5841
|
+
export { resolveTokens as A, loadConfig as C, loadConfigPath as D, loadAccessToken as E, writePlatformConfig as M, loadWorkspaceId as O, hashFile as S, fetchLatestToken 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, saveUserTokens as j, readPlatformConfig 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, deleteUserTokens as w, hashContent as x, createBundleCache as y };
|
|
5842
|
+
//# sourceMappingURL=application-CdkoGX27.mjs.map
|