@tailor-platform/sdk 1.25.3 → 1.26.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 +56 -0
- package/dist/{application-DegTCDd8.mjs → application-CxH6Yp54.mjs} +1 -1
- package/dist/{application-91Th6tm6.mjs → application-D9xahQRQ.mjs} +2066 -1968
- package/dist/application-D9xahQRQ.mjs.map +1 -0
- package/dist/cli/index.mjs +152 -3
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +350 -8
- package/dist/cli/lib.mjs +4 -24
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{env-uBeVwE9B.d.mts → env-CSsVESbH.d.mts} +2 -2
- package/dist/{index-Bu12qy3m.d.mts → index-BJg0DTbR.d.mts} +4 -4
- package/dist/{index-CT53egux.d.mts → index-BKy-OC5C.d.mts} +2 -2
- package/dist/{index-cZilKprY.d.mts → index-BtYPY8ya.d.mts} +2 -2
- package/dist/{index-BD-K97-C.d.mts → index-DgRShBpu.d.mts} +2 -2
- package/dist/{index-D1J5SfyK.d.mts → index-DkJbItB-.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/{plugin-zY5wvV82.d.mts → plugin-B1hNwcCC.d.mts} +15 -3
- package/dist/{query-BpppEOzu.mjs → query-B8ml6ClT.mjs} +455 -360
- package/dist/query-B8ml6ClT.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-v1LXRuB6.d.mts → workflow.generated-Bm4b8hEk.d.mts} +2 -2
- package/docs/cli/setup.md +82 -0
- package/docs/cli-reference.md +8 -0
- package/docs/services/auth.md +33 -0
- package/package.json +10 -10
- package/postinstall.mjs +14 -39
- package/dist/application-91Th6tm6.mjs.map +0 -1
- package/dist/query-BpppEOzu.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-
|
|
1
|
+
import { H as TailorDBType, nt as TailorField } from "../../plugin-B1hNwcCC.mjs";
|
|
2
|
+
import { G as WORKFLOW_TEST_ENV_KEY, n as output } from "../../index-BJg0DTbR.mjs";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/test/mock.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as BuiltinIdP, S as TailorDBServiceInput, T as AuthConfig } from "./plugin-B1hNwcCC.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/types/idp.generated.d.ts
|
|
4
4
|
/**
|
|
@@ -191,4 +191,4 @@ type RetryPolicy = {
|
|
|
191
191
|
};
|
|
192
192
|
//#endregion
|
|
193
193
|
export { IdPGqlOperations as _, ResolverExternalConfig as a, WorkflowServiceConfig as c, defineStaticWebSite as d, SecretsConfig as f, IdpDefinitionBrand as g, IdPExternalConfig as h, ExecutorServiceInput as i, WorkflowServiceInput as l, IdPConfig as m, AppConfig as n, ResolverServiceConfig as o, defineSecretManager as p, ExecutorServiceConfig as r, ResolverServiceInput as s, RetryPolicy as t, StaticWebsiteConfig as u, IdPGqlOperationsInput as v, IdPInput as y };
|
|
194
|
-
//# sourceMappingURL=workflow.generated-
|
|
194
|
+
//# sourceMappingURL=workflow.generated-Bm4b8hEk.d.mts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Setup Commands
|
|
2
|
+
|
|
3
|
+
Commands for setting up project infrastructure.
|
|
4
|
+
|
|
5
|
+
<!-- politty:command:setup:heading:start -->
|
|
6
|
+
|
|
7
|
+
## setup
|
|
8
|
+
|
|
9
|
+
<!-- politty:command:setup:heading:end -->
|
|
10
|
+
|
|
11
|
+
<!-- politty:command:setup:description:start -->
|
|
12
|
+
|
|
13
|
+
Set up project infrastructure.
|
|
14
|
+
|
|
15
|
+
<!-- politty:command:setup:description:end -->
|
|
16
|
+
|
|
17
|
+
<!-- politty:command:setup:usage:start -->
|
|
18
|
+
|
|
19
|
+
**Usage**
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
tailor-sdk setup [command]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<!-- politty:command:setup:usage:end -->
|
|
26
|
+
|
|
27
|
+
<!-- politty:command:setup:subcommands:start -->
|
|
28
|
+
|
|
29
|
+
**Commands**
|
|
30
|
+
|
|
31
|
+
| Command | Description |
|
|
32
|
+
| ------------------------------- | ------------------------------------------------------- |
|
|
33
|
+
| [`setup github`](#setup-github) | Generate GitHub Actions workflow for deployment. (beta) |
|
|
34
|
+
|
|
35
|
+
<!-- politty:command:setup:subcommands:end -->
|
|
36
|
+
|
|
37
|
+
<!-- politty:command:setup:global-options-link:start -->
|
|
38
|
+
|
|
39
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
40
|
+
|
|
41
|
+
<!-- politty:command:setup:global-options-link:end -->
|
|
42
|
+
<!-- politty:command:setup github:heading:start -->
|
|
43
|
+
|
|
44
|
+
### setup github
|
|
45
|
+
|
|
46
|
+
<!-- politty:command:setup github:heading:end -->
|
|
47
|
+
|
|
48
|
+
<!-- politty:command:setup github:description:start -->
|
|
49
|
+
|
|
50
|
+
Generate GitHub Actions workflow for deployment. (beta)
|
|
51
|
+
|
|
52
|
+
<!-- politty:command:setup github:description:end -->
|
|
53
|
+
|
|
54
|
+
<!-- politty:command:setup github:usage:start -->
|
|
55
|
+
|
|
56
|
+
**Usage**
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
tailor-sdk setup github [options]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
<!-- politty:command:setup github:usage:end -->
|
|
63
|
+
|
|
64
|
+
<!-- politty:command:setup github:options:start -->
|
|
65
|
+
|
|
66
|
+
**Options**
|
|
67
|
+
|
|
68
|
+
| Option | Alias | Description | Required | Default |
|
|
69
|
+
| --------------------------------------- | ----- | ----------------------------------- | -------- | ------- |
|
|
70
|
+
| `--workspace-name <WORKSPACE_NAME>` | `-n` | Workspace name | Yes | - |
|
|
71
|
+
| `--workspace-region <WORKSPACE_REGION>` | `-r` | Workspace region | Yes | - |
|
|
72
|
+
| `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID | Yes | - |
|
|
73
|
+
| `--folder-id <FOLDER_ID>` | `-f` | Folder ID | Yes | - |
|
|
74
|
+
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
|
75
|
+
|
|
76
|
+
<!-- politty:command:setup github:options:end -->
|
|
77
|
+
|
|
78
|
+
<!-- politty:command:setup github:global-options-link:start -->
|
|
79
|
+
|
|
80
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
81
|
+
|
|
82
|
+
<!-- politty:command:setup github:global-options-link:end -->
|
package/docs/cli-reference.md
CHANGED
|
@@ -203,6 +203,14 @@ Commands for managing and deploying static websites.
|
|
|
203
203
|
| [staticwebsite list](./cli/staticwebsite.md#staticwebsite-list) | List static websites in a workspace |
|
|
204
204
|
| [staticwebsite get](./cli/staticwebsite.md#staticwebsite-get) | Get details of a static website |
|
|
205
205
|
|
|
206
|
+
### [Setup Commands](./cli/setup.md)
|
|
207
|
+
|
|
208
|
+
Commands for setting up project infrastructure.
|
|
209
|
+
|
|
210
|
+
| Command | Description |
|
|
211
|
+
| ------------------------------------------- | ----------------------------------------------- |
|
|
212
|
+
| [setup github](./cli/setup.md#setup-github) | Generate GitHub Actions workflow for deployment |
|
|
213
|
+
|
|
206
214
|
### [Completion](./cli/completion.md)
|
|
207
215
|
|
|
208
216
|
Generate shell completion scripts for bash, zsh, and fish.
|
package/docs/services/auth.md
CHANGED
|
@@ -341,6 +341,39 @@ idProvider: idp.provider("my-provider", "my-client"),
|
|
|
341
341
|
|
|
342
342
|
See [IdP](./idp.md) for configuring identity providers.
|
|
343
343
|
|
|
344
|
+
## Before Login Hook
|
|
345
|
+
|
|
346
|
+
Run custom logic before a user logs in. This is useful for JIT (Just-In-Time) user provisioning — automatically creating or updating user records when a user authenticates for the first time.
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { defineAuth } from "@tailor-platform/sdk";
|
|
350
|
+
import { user } from "./tailordb/user";
|
|
351
|
+
|
|
352
|
+
export const auth = defineAuth("my-auth", {
|
|
353
|
+
userProfile: {
|
|
354
|
+
type: user,
|
|
355
|
+
usernameField: "email",
|
|
356
|
+
},
|
|
357
|
+
machineUsers: {
|
|
358
|
+
"hook-invoker": {
|
|
359
|
+
attributes: { role: "ADMIN" },
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
hooks: {
|
|
363
|
+
beforeLogin: {
|
|
364
|
+
handler: async ({ claims, idpConfigName }) => {
|
|
365
|
+
// Provision or update user based on IdP claims
|
|
366
|
+
},
|
|
367
|
+
invoker: "hook-invoker",
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
**handler**: An async function that receives `{ claims, idpConfigName }` and is called before each login. `claims` contains the token claims from the identity provider, and `idpConfigName` is the name of the IdP configuration used for authentication.
|
|
374
|
+
|
|
375
|
+
**invoker**: The machine user whose permissions are used to execute the hook. Must reference a machine user defined in the same auth configuration.
|
|
376
|
+
|
|
344
377
|
## CLI Commands
|
|
345
378
|
|
|
346
379
|
Manage Auth resources using the CLI:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"pgsql-ast-parser": "12.0.2",
|
|
115
115
|
"pkg-types": "2.3.0",
|
|
116
116
|
"politty": "0.4.9",
|
|
117
|
-
"rolldown": "1.0.0-rc.
|
|
117
|
+
"rolldown": "1.0.0-rc.9",
|
|
118
118
|
"serve": "14.2.6",
|
|
119
119
|
"std-env": "3.10.0",
|
|
120
120
|
"table": "6.9.0",
|
|
@@ -130,19 +130,19 @@
|
|
|
130
130
|
"@tailor-platform/function-types": "0.8.2",
|
|
131
131
|
"@types/madge": "5.0.3",
|
|
132
132
|
"@types/mime-types": "3.0.1",
|
|
133
|
-
"@types/node": "24.
|
|
133
|
+
"@types/node": "24.12.0",
|
|
134
134
|
"@typescript/native-preview": "7.0.0-dev.20260308.1",
|
|
135
|
-
"@vitest/coverage-v8": "4.0
|
|
135
|
+
"@vitest/coverage-v8": "4.1.0",
|
|
136
136
|
"eslint": "9.39.4",
|
|
137
|
-
"eslint-plugin-jsdoc": "62.
|
|
137
|
+
"eslint-plugin-jsdoc": "62.8.0",
|
|
138
138
|
"eslint-plugin-oxlint": "1.39.0",
|
|
139
139
|
"oxlint": "1.39.0",
|
|
140
|
-
"oxlint-tsgolint": "0.
|
|
141
|
-
"sonda": "0.
|
|
142
|
-
"tsdown": "0.21.
|
|
140
|
+
"oxlint-tsgolint": "0.16.0",
|
|
141
|
+
"sonda": "0.11.1",
|
|
142
|
+
"tsdown": "0.21.2",
|
|
143
143
|
"typescript": "5.9.3",
|
|
144
|
-
"typescript-eslint": "8.
|
|
145
|
-
"vitest": "4.0
|
|
144
|
+
"typescript-eslint": "8.57.0",
|
|
145
|
+
"vitest": "4.1.0",
|
|
146
146
|
"zinfer": "0.1.7"
|
|
147
147
|
},
|
|
148
148
|
"scripts": {
|
package/postinstall.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
6
|
import { register } from "node:module";
|
|
@@ -26,48 +26,23 @@ async function install() {
|
|
|
26
26
|
? resolve(cwd, process.env.TAILOR_PLATFORM_SDK_CONFIG_PATH)
|
|
27
27
|
: findUpSync(DEFAULT_CONFIG_FILENAME, { cwd });
|
|
28
28
|
|
|
29
|
-
if (configPath
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
process.chdir(configDir);
|
|
33
|
-
register("tsx", import.meta.url, { data: {} });
|
|
34
|
-
|
|
35
|
-
const { generateUserTypes, loadConfig } = await import(
|
|
36
|
-
pathToFileURL(resolve(__dirname, "dist", "cli", "lib.mjs")).href
|
|
37
|
-
);
|
|
38
|
-
const { config } = await loadConfig(configPath);
|
|
39
|
-
await generateUserTypes({ config, configPath });
|
|
40
|
-
return;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.warn("⚠️ Failed to generate types from config:", error.message);
|
|
43
|
-
// Fall through to create empty type definition
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Create empty type definition file as fallback (in cwd, next to where config would be)
|
|
48
|
-
const pluginTypesPath = resolve(cwd, "tailor.d.ts");
|
|
49
|
-
const initialContent = `// This file is auto-generated by @tailor-platform/sdk
|
|
50
|
-
// Do not edit this file manually
|
|
51
|
-
// Regenerated automatically when running 'tailor-sdk apply' or 'tailor-sdk generate'
|
|
52
|
-
|
|
53
|
-
declare module "@tailor-platform/sdk" {
|
|
54
|
-
interface AttributeMap {}
|
|
55
|
-
interface AttributeList {
|
|
56
|
-
__tuple: string[];
|
|
29
|
+
if (!configPath || !existsSync(configPath)) {
|
|
30
|
+
console.log("⚠️ No tailor.config.ts found, skipping type generation");
|
|
31
|
+
return;
|
|
57
32
|
}
|
|
58
|
-
interface Env {}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export {};
|
|
62
|
-
`;
|
|
63
33
|
|
|
64
34
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
35
|
+
const configDir = dirname(configPath);
|
|
36
|
+
process.chdir(configDir);
|
|
37
|
+
register("tsx", import.meta.url, { data: {} });
|
|
38
|
+
|
|
39
|
+
const { generateUserTypes, loadConfig } = await import(
|
|
40
|
+
pathToFileURL(resolve(__dirname, "dist", "cli", "lib.mjs")).href
|
|
41
|
+
);
|
|
42
|
+
const { config } = await loadConfig(configPath);
|
|
43
|
+
await generateUserTypes({ config, configPath });
|
|
68
44
|
} catch (error) {
|
|
69
|
-
console.
|
|
70
|
-
// Don't exit with error - this shouldn't break the installation
|
|
45
|
+
console.warn("⚠️ Failed to generate types from config:", error.message);
|
|
71
46
|
}
|
|
72
47
|
}
|
|
73
48
|
|