@tailor-platform/sdk 1.53.0 → 1.54.2
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 +88 -0
- package/dist/{actor-DwAh0Dij.d.mts → actor-Cjae_LGD.d.mts} +2 -2
- package/dist/{application-DF74unzA.mjs → application-BfGje3iZ.mjs} +12 -5
- package/dist/application-BfGje3iZ.mjs.map +1 -0
- package/dist/application-BsipSxp3.mjs +4 -0
- package/dist/cli/index.mjs +2 -2
- package/dist/cli/lib.d.mts +8 -7
- package/dist/cli/lib.mjs +2 -2
- package/dist/configure/index.d.mts +3 -3
- package/dist/idp-Ch95ag8h.mjs.map +1 -1
- package/dist/{idp-CbxR6A_0.d.mts → idp-Di9N4FSJ.d.mts} +1 -2
- package/dist/{index-UySZfxON.d.mts → index-BTLgs0DP.d.mts} +4 -4
- package/dist/{index-BL5LQnBX.d.mts → index-Cf1Lo_XT.d.mts} +2 -2
- package/dist/{index-BIbKrme4.d.mts → index-CyyoHrPK.d.mts} +2 -2
- package/dist/{index-ECerapTN.d.mts → index-DTSQthwF.d.mts} +2 -2
- package/dist/{index-BCJtNXKo.d.mts → index-DrYHpTja.d.mts} +2 -2
- package/dist/{index-DW6gAGmC.d.mts → index-qQYMbkT-.d.mts} +2 -2
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/runtime/globals.d.mts +2 -2
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/index.d.mts +2 -2
- package/dist/{runtime-D-3AE1x-.mjs → runtime-DLFzjgEo.mjs} +35 -23
- package/dist/runtime-DLFzjgEo.mjs.map +1 -0
- package/dist/{tailor-db-field-Y_zEoGu1.d.mts → tailor-db-field-D0qg8s4U.d.mts} +4 -2
- package/dist/utils/test/index.d.mts +3 -3
- package/dist/vitest/index.d.mts +41 -5
- package/dist/vitest/index.mjs +124 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/{workflow.generated-BIY41La-.d.mts → workflow.generated-dBixCwUo.d.mts} +2 -2
- package/docs/configuration.md +10 -0
- package/docs/services/auth.md +3 -2
- package/docs/services/idp.md +6 -0
- package/docs/services/tailordb-migration.md +18 -1
- package/docs/testing.md +53 -0
- package/package.json +5 -5
- package/dist/application-Cmz1Y7X_.mjs +0 -4
- package/dist/application-DF74unzA.mjs.map +0 -1
- package/dist/runtime-D-3AE1x-.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.54.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1303](https://github.com/tailor-platform/sdk/pull/1303) [`0881adf`](https://github.com/tailor-platform/sdk/commit/0881adf42f99ae812bb861d537e33b9b0e7192af) Thanks [@toiroakr](https://github.com/toiroakr)! - fix(deploy): stop reporting persistent TailorDB type diffs on every `deploy`. Fields without a `description` are emitted as an empty string by the platform but omitted by the local manifest; the comparison now treats an empty-string `description` as unset (same handling as empty `expr`), so unchanged types are no longer flagged as updates on repeated applies.
|
|
8
|
+
|
|
9
|
+
## 1.54.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1292](https://github.com/tailor-platform/sdk/pull/1292) [`0976bac`](https://github.com/tailor-platform/sdk/commit/0976bac530ecf4f7214f6f69796e98a7bedb3e38) Thanks [@dqn](https://github.com/dqn)! - Update generated shell completions so saved completion files can refresh
|
|
14
|
+
themselves after future SDK upgrades.
|
|
15
|
+
|
|
16
|
+
Existing `eval "$(tailor-sdk completion bash)"` and
|
|
17
|
+
`eval "$(tailor-sdk completion zsh)"` setups do not need to change because they
|
|
18
|
+
regenerate completions on every shell startup.
|
|
19
|
+
|
|
20
|
+
If you saved a static completion file generated by an older SDK version,
|
|
21
|
+
regenerate that file once:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# bash
|
|
25
|
+
mkdir -p ~/.local/share/bash-completion/completions
|
|
26
|
+
tailor-sdk completion bash > ~/.local/share/bash-completion/completions/tailor-sdk
|
|
27
|
+
|
|
28
|
+
# zsh fpath
|
|
29
|
+
mkdir -p ~/.zsh/completions
|
|
30
|
+
tailor-sdk completion zsh > ~/.zsh/completions/_tailor-sdk
|
|
31
|
+
|
|
32
|
+
# fish
|
|
33
|
+
tailor-sdk completion fish --install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
After that one-time regeneration, saved completion files can self-refresh when
|
|
37
|
+
the `tailor-sdk` binary changes. Open a new shell, or reload your shell
|
|
38
|
+
configuration, after regenerating.
|
|
39
|
+
|
|
40
|
+
- [#1294](https://github.com/tailor-platform/sdk/pull/1294) [`fd1c5cf`](https://github.com/tailor-platform/sdk/commit/fd1c5cf7f2b1512df4a2798521119658cb6a2088) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix IdP services and OAuth2 clients always being reported as changed on consecutive deployments when a description is omitted
|
|
41
|
+
|
|
42
|
+
- [#1281](https://github.com/tailor-platform/sdk/pull/1281) [`9711826`](https://github.com/tailor-platform/sdk/commit/971182600b5866cc44194865ae1a308871a8c377) Thanks [@toiroakr](https://github.com/toiroakr)! - fix(cli): `remove` no longer deletes an application matched by name alone. Removal now verifies ownership via `sdk-app-id`/`sdk-name` labels (`isOwnedByApp`), consistent with every other resource type, so a same-named application owned by another user in a shared workspace is left untouched.
|
|
43
|
+
|
|
44
|
+
- [#1299](https://github.com/tailor-platform/sdk/pull/1299) [`c10681f`](https://github.com/tailor-platform/sdk/commit/c10681fc33211ec7a92a9ea9e61e00ebf0a69862) Thanks [@k1LoW](https://github.com/k1LoW)! - fix(runtime): remove non-existent `updatedAt` field from `idp.User`. The IDP service does not return this field, so the declaration was misleading consumers into expecting an optional timestamp that was always `undefined`.
|
|
45
|
+
|
|
46
|
+
## 1.54.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- [#1268](https://github.com/tailor-platform/sdk/pull/1268) [`e6b2a23`](https://github.com/tailor-platform/sdk/commit/e6b2a23b99e101cb878d9570e18d9d2fcbc07ac0) Thanks [@toiroakr](https://github.com/toiroakr)! - feat(auth): expose `env` in the `beforeLogin` hook handler
|
|
51
|
+
|
|
52
|
+
The `beforeLogin` auth hook handler now receives `env` alongside `claims` and `idpConfigName`, exposing the variables defined in `defineConfig({ env })` (the same values available via `context.env` in resolvers). This lets hooks branch on environment-specific configuration at runtime without relying on `process.env`, which is unavailable in the platform runtime.
|
|
53
|
+
|
|
54
|
+
- [#1277](https://github.com/tailor-platform/sdk/pull/1277) [`8d05f86`](https://github.com/tailor-platform/sdk/commit/8d05f864bc714f12783f66453791912dae8246a3) Thanks [@remiposo](https://github.com/remiposo)! - Add `createKyselyMock` to `@tailor-platform/sdk/vitest` for unit-testing code that runs Kysely queries. It returns a real Kysely instance whose execution is mocked. You stage the rows each query returns, run your code, then assert what it did — the SQL and parameters of each query, how many `selects`/`inserts`/`updates`/`deletes` ran, and the value your code returned.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { createKyselyMock } from "@tailor-platform/sdk/vitest";
|
|
58
|
+
import type { Namespace } from "./generated/db";
|
|
59
|
+
|
|
60
|
+
const mock = createKyselyMock<Namespace["main-db"]>();
|
|
61
|
+
mock.enqueueResults([{ age: 30 }]); // the next query returns this row
|
|
62
|
+
|
|
63
|
+
const { age } = await mock.db
|
|
64
|
+
.selectFrom("User")
|
|
65
|
+
.select("age")
|
|
66
|
+
.where("email", "=", "a@b.com")
|
|
67
|
+
.executeTakeFirstOrThrow();
|
|
68
|
+
await mock.db
|
|
69
|
+
.updateTable("User")
|
|
70
|
+
.set({ age: age + 1 })
|
|
71
|
+
.where("email", "=", "a@b.com")
|
|
72
|
+
.execute();
|
|
73
|
+
|
|
74
|
+
expect(mock.updates).toHaveLength(1);
|
|
75
|
+
expect(mock.updates[0].parameters).toEqual([31, "a@b.com"]); // the actual bound values
|
|
76
|
+
expect(mock.updates[0].sql).toContain('update "User"'); // the compiled SQL
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- [#1269](https://github.com/tailor-platform/sdk/pull/1269) [`a230ba6`](https://github.com/tailor-platform/sdk/commit/a230ba6a1b6861f60e6edac82ae59d333f1f3604) Thanks [@toiroakr](https://github.com/toiroakr)! - feat(migration): expose `env` in migration scripts
|
|
80
|
+
|
|
81
|
+
The migration `main` function now receives an optional second argument `{ env }: MigrationContext` exposing the variables defined in `defineConfig({ env })` — the same values available via `context.env` in resolvers and `{ env }` in workflow jobs. The values are injected at bundle time and the `MigrationContext` type is exported from the generated `./db`. Existing `main(trx)` scripts continue to work unchanged.
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- [#1285](https://github.com/tailor-platform/sdk/pull/1285) [`239b146`](https://github.com/tailor-platform/sdk/commit/239b1466ab4fb91d416d7cecb606703b5f9a9a33) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @inquirer
|
|
86
|
+
|
|
87
|
+
- [#1288](https://github.com/tailor-platform/sdk/pull/1288) [`02027b1`](https://github.com/tailor-platform/sdk/commit/02027b1d71120ca50e06dea1060d03c39bec41f7) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @clack/prompts to v1.5.0
|
|
88
|
+
|
|
89
|
+
- [#1291](https://github.com/tailor-platform/sdk/pull/1291) [`6f52e3e`](https://github.com/tailor-platform/sdk/commit/6f52e3e8b385ab00e010fd5bbc4f8bd5f15167be) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency date-fns to v4.4.0
|
|
90
|
+
|
|
3
91
|
## 1.53.0
|
|
4
92
|
|
|
5
93
|
### Minor Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-
|
|
1
|
+
import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-D0qg8s4U.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/types/actor.d.ts
|
|
4
4
|
/** User type enum values from the Tailor Platform server. */
|
|
@@ -21,4 +21,4 @@ type TailorActor = {
|
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
23
|
export { TailorActor as t };
|
|
24
|
-
//# sourceMappingURL=actor-
|
|
24
|
+
//# sourceMappingURL=actor-Cjae_LGD.d.mts.map
|
|
@@ -2192,7 +2192,7 @@ function createTriggerTransformPlugin(triggerContext) {
|
|
|
2192
2192
|
* @returns Map of function name to bundled code
|
|
2193
2193
|
*/
|
|
2194
2194
|
async function bundleAuthHooks(options) {
|
|
2195
|
-
const { configPath, authName, handlerAccessPath, triggerContext, cache, inlineSourcemap } = options;
|
|
2195
|
+
const { configPath, authName, handlerAccessPath, env = {}, triggerContext, cache, inlineSourcemap } = options;
|
|
2196
2196
|
logger.newline();
|
|
2197
2197
|
logger.log(`Bundling auth hook for ${styles.info(`"${authName}"`)}`);
|
|
2198
2198
|
const outputDir = path.resolve(getDistDir(), "auth-hooks");
|
|
@@ -2206,6 +2206,8 @@ async function bundleAuthHooks(options) {
|
|
|
2206
2206
|
}
|
|
2207
2207
|
const functionName = `auth-hook--${authName}--before-login`;
|
|
2208
2208
|
const absoluteConfigPath = path.resolve(configPath);
|
|
2209
|
+
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
2210
|
+
const sortedEnvPrefix = JSON.stringify(Object.fromEntries(Object.entries(env).sort(([a], [b]) => a.localeCompare(b))));
|
|
2209
2211
|
const code = await withCache({
|
|
2210
2212
|
cache,
|
|
2211
2213
|
kind: "auth-hook",
|
|
@@ -2213,16 +2215,20 @@ async function bundleAuthHooks(options) {
|
|
|
2213
2215
|
sourceFile: absoluteConfigPath,
|
|
2214
2216
|
contextHash: computeBundlerContextHash({
|
|
2215
2217
|
sourceFile: absoluteConfigPath,
|
|
2216
|
-
serializedTriggerContext
|
|
2218
|
+
serializedTriggerContext,
|
|
2217
2219
|
tsconfig,
|
|
2218
|
-
inlineSourcemap
|
|
2220
|
+
inlineSourcemap,
|
|
2221
|
+
prefix: sortedEnvPrefix
|
|
2219
2222
|
}),
|
|
2220
2223
|
async build(cachePlugins) {
|
|
2221
2224
|
const entryPath = path.join(outputDir, `${functionName}.entry.js`);
|
|
2222
2225
|
const entryContent = multiline`
|
|
2223
2226
|
import _config from "${absoluteConfigPath}";
|
|
2224
2227
|
const __auth_hook_function = _config.${handlerAccessPath};
|
|
2225
|
-
export
|
|
2228
|
+
export async function main(args) {
|
|
2229
|
+
const env = ${JSON.stringify(env)};
|
|
2230
|
+
return await __auth_hook_function({ ...args, env });
|
|
2231
|
+
}
|
|
2226
2232
|
`;
|
|
2227
2233
|
fs$1.writeFileSync(entryPath, entryContent);
|
|
2228
2234
|
const triggerPlugin = createTriggerTransformPlugin(triggerContext);
|
|
@@ -5348,6 +5354,7 @@ async function loadApplication(params) {
|
|
|
5348
5354
|
configPath: config.path,
|
|
5349
5355
|
authName,
|
|
5350
5356
|
handlerAccessPath: `auth.hooks.beforeLogin.handler`,
|
|
5357
|
+
env: config.env ?? {},
|
|
5351
5358
|
triggerContext,
|
|
5352
5359
|
cache: bundleCache,
|
|
5353
5360
|
inlineSourcemap
|
|
@@ -5381,4 +5388,4 @@ async function loadApplication(params) {
|
|
|
5381
5388
|
|
|
5382
5389
|
//#endregion
|
|
5383
5390
|
export { loadConfigPath as C, saveUserTokens as D, resolveTokens as E, writePlatformConfig as O, loadAccessToken as S, readPlatformConfig as T, getDistDir as _, WorkflowJobSchema as a, deleteUserTokens as b, ExecutorSchema as c, buildResolverOperationHookExpr as d, OAuth2ClientSchema as f, createBundleCache as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, INVOKER_EXPR as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, createExecutorService as s, defineApplication as t, buildExecutorArgsExpr as u, hashFile as v, loadWorkspaceId as w, fetchLatestToken as x, loadConfig as y };
|
|
5384
|
-
//# sourceMappingURL=application-
|
|
5391
|
+
//# sourceMappingURL=application-BfGje3iZ.mjs.map
|