@tailor-platform/sdk 1.63.0 → 2.0.0-next.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 +40 -0
- package/dist/{application-BezXGbrU.mjs → application-76hhIhnJ.mjs} +42 -5
- package/dist/application-76hhIhnJ.mjs.map +1 -0
- package/dist/application-av2raLs6.mjs +4 -0
- package/dist/cli/index.mjs +63 -19
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +17 -24
- package/dist/cli/lib.mjs +2 -2
- package/dist/{runtime-CW3jcQCc.mjs → runtime-C7qTBDD2.mjs} +491 -96
- package/dist/runtime-C7qTBDD2.mjs.map +1 -0
- package/docs/cli/auth.md +4 -4
- package/docs/cli/function.md +8 -8
- package/docs/cli/query.md +1 -1
- package/docs/cli/workflow.md +10 -10
- package/docs/cli/workspace.md +14 -10
- package/docs/cli-reference.md +1 -1
- package/docs/services/idp.md +96 -0
- package/docs/services/tailordb-migration.md +17 -6
- package/package.json +10 -10
- package/dist/application-BezXGbrU.mjs.map +0 -1
- package/dist/application-DSXntqnV.mjs +0 -4
- package/dist/runtime-CW3jcQCc.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.0-next.0
|
|
4
|
+
### Major Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#1451](https://github.com/tailor-platform/sdk/pull/1451) [`3e6d582`](https://github.com/tailor-platform/sdk/commit/3e6d582a37d83a42302339cc4aea1d3dd11e8a81) Thanks [@tailor-platform-pr-trigger](https://github.com/apps/tailor-platform-pr-trigger)! - Start the v2 release line. v2 introduces breaking changes to the SDK API and CLI; run `tailor-sdk upgrade` to apply the bundled codemods when migrating. Prereleases are published to the `next` dist-tag — install with `@tailor-platform/sdk@next`.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- [#1449](https://github.com/tailor-platform/sdk/pull/1449) [`016aff6`](https://github.com/tailor-platform/sdk/commit/016aff6aab31c334c57a5e5244453f2dd559c008) Thanks [@k1LoW](https://github.com/k1LoW)! - Document the `userAuthPolicy`, `gqlOperations`, and `lang` options of `defineIdp()` in the IdP service guide, including the password policy fields, allowed email domains, Google/Microsoft social login, the read-only `"query"` shortcut, and the cross-field validation constraints.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
- [#1450](https://github.com/tailor-platform/sdk/pull/1450) [`162ba62`](https://github.com/tailor-platform/sdk/commit/162ba629e0d511593718f289b93788d5d56778da) Thanks [@toiroakr](https://github.com/toiroakr)! - Update OpenTelemetry runtime dependencies to 2.8.0 to resolve a moderate security advisory (GHSA-8988-4f7v-96qf) in `@opentelemetry/core`
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- [#1432](https://github.com/tailor-platform/sdk/pull/1432) [`3a854a3`](https://github.com/tailor-platform/sdk/commit/3a854a3a10b938ce3cf6fe7527de4ab56ecf48d5) Thanks [@toiroakr](https://github.com/toiroakr)! - Roll back a migration's pre-migration schema changes when its data migration (`migrate.ts`) fails during `apply`. A failed migration now leaves the workspace at its prior checkpoint and prior schema instead of half-applied, so subsequent deploys are no longer blocked by opaque "Remote schema drift detected" errors.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
- [#1422](https://github.com/tailor-platform/sdk/pull/1422) [`f3f8427`](https://github.com/tailor-platform/sdk/commit/f3f84277fe1942601d0fcbb8a64c2c26823b5624) Thanks [@dqn](https://github.com/dqn)! - Internal cleanup of proto field optionality handling. No behavior change.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
- [#1421](https://github.com/tailor-platform/sdk/pull/1421) [`b933f47`](https://github.com/tailor-platform/sdk/commit/b933f474d65f8dfed56f3991aae3a52589368b10) Thanks [@dqn](https://github.com/dqn)! - Corrupted or hand-edited TailorDB migration snapshot/diff files now fail with a clear validation error when loaded, instead of causing undefined behavior later.
|
|
32
|
+
|
|
33
|
+
## 1.64.0
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- [#1419](https://github.com/tailor-platform/sdk/pull/1419) [`d9b5755`](https://github.com/tailor-platform/sdk/commit/d9b57557d812f107fc02721680aecf2ea5ba24ad) Thanks [@dqn](https://github.com/dqn)! - Add default machine user to CLI profiles. Use `tailor-sdk profile create <name> --machine-user <name>` or `tailor-sdk profile update <name> --machine-user <name>` to store a default machine user on a profile. Commands that require a machine user (`query`, `workflow start`, `function test-run`, `machineuser token`) now fall back to the active profile's default when no machine user is given via the command line (`--machine-user`, or the `NAME` argument for `machineuser token`) or the `TAILOR_PLATFORM_MACHINE_USER_NAME` environment variable. Pass an empty string to `profile update --machine-user ""` to clear the stored default. Profiles also support `--machine-user-override deny`, which locks the machine user to the stored default: any explicit machine user supplied on the command line or via `TAILOR_PLATFORM_MACHINE_USER_NAME` that differs from the profile's value causes commands to fail immediately with error code `PROFILE_MACHINE_USER_OVERRIDE_DENIED`. Use `--machine-user-override allow` (the default) to restore the previous behavior.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- [#1414](https://github.com/tailor-platform/sdk/pull/1414) [`1d04806`](https://github.com/tailor-platform/sdk/commit/1d04806e331377d847ac55ac3b9c1dcbb887a1f7) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update oxc
|
|
42
|
+
|
|
3
43
|
## 1.63.0
|
|
4
44
|
|
|
5
45
|
### Minor Changes
|
|
@@ -10,6 +10,7 @@ import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-BH
|
|
|
10
10
|
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D1e0Vwkd.mjs";
|
|
11
11
|
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-BH2FbrPV.mjs";
|
|
12
12
|
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
13
|
+
import { t as createCLIError } from "./errors-EsY4XO6O.mjs";
|
|
13
14
|
import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-CWzF8rry.mjs";
|
|
14
15
|
import { builtinModules, createRequire } from "node:module";
|
|
15
16
|
import { z } from "zod";
|
|
@@ -216,7 +217,9 @@ async function deleteKeyringTokens(account) {
|
|
|
216
217
|
const pfProfileSchema = z.object({
|
|
217
218
|
user: z.string(),
|
|
218
219
|
workspace_id: z.string(),
|
|
219
|
-
readonly: z.boolean().optional()
|
|
220
|
+
readonly: z.boolean().optional(),
|
|
221
|
+
machine_user: z.string().optional(),
|
|
222
|
+
machine_user_override: z.enum(["allow", "deny"]).optional()
|
|
220
223
|
});
|
|
221
224
|
const pfUserSchemaV1 = z.object({
|
|
222
225
|
access_token: z.string(),
|
|
@@ -441,6 +444,40 @@ async function loadWorkspaceId(opts) {
|
|
|
441
444
|
`);
|
|
442
445
|
}
|
|
443
446
|
/**
|
|
447
|
+
* Load machine user name from command options, environment variables, or platform config.
|
|
448
|
+
* In CLI context, env fallback is also handled by politty's arg env option.
|
|
449
|
+
* Priority: opts/machineUser > env/TAILOR_PLATFORM_MACHINE_USER_NAME > opts/profile (profile default) > undefined.
|
|
450
|
+
* An explicitly empty `opts.machineUser` is rejected with a CLIError (`MACHINE_USER_NAME_EMPTY`) rather than falling back to the env var or profile default.
|
|
451
|
+
* When the active profile has `machine_user_override: "deny"`, an explicit value that differs from the profile's machine user throws a CLIError with code `PROFILE_MACHINE_USER_OVERRIDE_DENIED`.
|
|
452
|
+
* @param opts - Machine user and profile options
|
|
453
|
+
* @returns Resolved machine user name, or undefined if not set
|
|
454
|
+
*/
|
|
455
|
+
async function loadMachineUserName(opts) {
|
|
456
|
+
if (opts?.machineUser === "") throw createCLIError({
|
|
457
|
+
code: "MACHINE_USER_NAME_EMPTY",
|
|
458
|
+
message: "Machine user name cannot be empty.",
|
|
459
|
+
suggestion: "Pass a non-empty machine user name, or omit the option to use the environment variable or profile default."
|
|
460
|
+
});
|
|
461
|
+
const explicit = opts?.machineUser || process.env.TAILOR_PLATFORM_MACHINE_USER_NAME || void 0;
|
|
462
|
+
const profile = opts?.profile || process.env.TAILOR_PLATFORM_PROFILE;
|
|
463
|
+
if (!profile) return explicit;
|
|
464
|
+
const entry = (await readPlatformConfig()).profiles[profile];
|
|
465
|
+
if (!entry) {
|
|
466
|
+
if (explicit) return explicit;
|
|
467
|
+
throw new Error(`Profile "${profile}" not found`);
|
|
468
|
+
}
|
|
469
|
+
if (entry.machine_user && entry.machine_user_override === "deny") {
|
|
470
|
+
if (explicit && explicit !== entry.machine_user) throw createCLIError({
|
|
471
|
+
code: "PROFILE_MACHINE_USER_OVERRIDE_DENIED",
|
|
472
|
+
message: `Profile "${profile}" denies overriding the machine user.`,
|
|
473
|
+
details: `This profile fixes the machine user to "${entry.machine_user}" for application-data commands.`,
|
|
474
|
+
suggestion: `Omit the machine user option, unset TAILOR_PLATFORM_MACHINE_USER_NAME, or run 'tailor-sdk profile update ${profile} --machine-user-override allow'.`
|
|
475
|
+
});
|
|
476
|
+
return entry.machine_user;
|
|
477
|
+
}
|
|
478
|
+
return explicit || entry.machine_user;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
444
481
|
* Load access token from environment variables, command options, or platform config.
|
|
445
482
|
* In CLI context, profile env fallback is also handled by politty's arg env option.
|
|
446
483
|
* Priority: env/TAILOR_PLATFORM_TOKEN > env/TAILOR_TOKEN (deprecated) > opts/profile > env/profile > config/currentUser > error
|
|
@@ -2484,7 +2521,7 @@ function normalizeGqlPermission(permission) {
|
|
|
2484
2521
|
}
|
|
2485
2522
|
function normalizeGqlPolicy(policy) {
|
|
2486
2523
|
return {
|
|
2487
|
-
conditions:
|
|
2524
|
+
conditions: normalizeConditions(policy.conditions),
|
|
2488
2525
|
actions: policy.actions === "all" ? ["all"] : policy.actions,
|
|
2489
2526
|
permit: policy.permit ? "allow" : "deny",
|
|
2490
2527
|
description: policy.description
|
|
@@ -2557,7 +2594,7 @@ function normalizeActionPermission(permission) {
|
|
|
2557
2594
|
function findOmittedPermitRules(rawPermissions) {
|
|
2558
2595
|
const locations = [];
|
|
2559
2596
|
const record = rawPermissions.record;
|
|
2560
|
-
if (record) for (const action of Object.keys(record)) record[action]
|
|
2597
|
+
if (record) for (const action of Object.keys(record)) record[action].forEach((rule, index) => {
|
|
2561
2598
|
if (isObjectFormat(rule) && rule.permit === void 0) locations.push(`record.${String(action)}[${index}]`);
|
|
2562
2599
|
});
|
|
2563
2600
|
const gql = rawPermissions.gql;
|
|
@@ -5553,5 +5590,5 @@ async function loadApplication(params) {
|
|
|
5553
5590
|
}
|
|
5554
5591
|
|
|
5555
5592
|
//#endregion
|
|
5556
|
-
export {
|
|
5557
|
-
//# sourceMappingURL=application-
|
|
5593
|
+
export { readPlatformConfig as A, loadConfig as C, loadConfigPath as D, loadAccessToken as E, saveUserTokens as M, writePlatformConfig as N, loadMachineUserName as O, hashFile as S, fetchLatestToken as T, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, getDistDir as b, INVOKER_EXPR as c, assertUniqueLocalTailorDBTypeNames as d, assertUniqueTailorDBTypeNamesWithExternal as f, composeFunctionTreeshakeOptions as g, platformBundleDefinePlugin as h, resolveInlineSourcemap as i, resolveTokens as j, loadWorkspaceId as k, buildExecutorArgsExpr as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, buildResolverOperationHookExpr as u, resolveBundleLogLevel as v, deleteUserTokens as w, hashContent as x, createBundleCache as y };
|
|
5594
|
+
//# sourceMappingURL=application-76hhIhnJ.mjs.map
|