@tailor-platform/sdk 1.2.4 → 1.2.5
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 +19 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +1 -2
- package/dist/cli/lib.mjs +1 -1
- package/dist/config-BmQRlW1j.mjs.map +1 -1
- package/dist/configure/index.d.mts +2 -2
- package/dist/{index-Dkyvjk4D.d.mts → index-LqF60FaW.d.mts} +2 -2
- package/dist/{list-BCSBAjwc.mjs → list-CEdXdOpY.mjs} +71 -88
- package/dist/list-CEdXdOpY.mjs.map +1 -0
- package/dist/{types-BeinUo7W.d.mts → types-DCb7NVBk.d.mts} +9 -9
- package/dist/utils/test/index.d.mts +2 -2
- package/docs/generator/builtin.md +1 -4
- package/docs/generator/custom.md +1 -4
- package/docs/services/executor.md +1 -2
- package/docs/services/resolver.md +1 -4
- package/docs/services/staticwebsite.md +1 -6
- package/docs/services/tailordb.md +1 -4
- package/docs/testing.md +5 -17
- package/package.json +9 -9
- package/dist/list-BCSBAjwc.mjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as zod0 from "zod";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as type_fest0 from "type-fest";
|
|
5
5
|
import { IsAny, NonEmptyObject } from "type-fest";
|
|
6
6
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
|
-
import * as
|
|
7
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
8
8
|
|
|
9
9
|
//#region src/parser/service/tailordb/relation.d.ts
|
|
10
10
|
declare const relationTypes: {
|
|
@@ -1552,12 +1552,12 @@ declare function defineGenerators(...configs: GeneratorConfig[]): (["@tailor-pla
|
|
|
1552
1552
|
id: string;
|
|
1553
1553
|
description: string;
|
|
1554
1554
|
dependencies: ("tailordb" | "resolver" | "executor")[];
|
|
1555
|
-
aggregate:
|
|
1556
|
-
processType?:
|
|
1557
|
-
processResolver?:
|
|
1558
|
-
processExecutor?:
|
|
1559
|
-
processTailorDBNamespace?:
|
|
1560
|
-
processResolverNamespace?:
|
|
1555
|
+
aggregate: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod0.ZodAny>;
|
|
1556
|
+
processType?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1557
|
+
processResolver?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1558
|
+
processExecutor?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1559
|
+
processTailorDBNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1560
|
+
processResolverNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
|
|
1561
1561
|
})[];
|
|
1562
1562
|
//#endregion
|
|
1563
1563
|
//#region src/parser/service/executor/schema.d.ts
|
|
@@ -1696,4 +1696,4 @@ type Executor = z.infer<typeof ExecutorSchema>;
|
|
|
1696
1696
|
type ExecutorInput = z.input<typeof ExecutorSchema>;
|
|
1697
1697
|
//#endregion
|
|
1698
1698
|
export { TenantProviderConfig as $, AuthOwnConfig as A, BuiltinIdP as B, ResolverServiceConfig as C, TailorFieldType as Ct, AuthConfig as D, ExecutorServiceInput as E, output as Et, db as F, OIDC as G, IdProviderConfig as H, AllowedValues as I, SCIMAttributeMapping as J, SAML as K, AllowedValuesOutput as L, TailorDBField as M, TailorDBInstance as N, AuthExternalConfig as O, TailorDBType as P, SCIMResource as Q, ParsedTailorDBType as R, ResolverExternalConfig as S, FieldOutput$1 as St, ExecutorServiceConfig as T, JsonCompatible as Tt, OAuth2ClientGrantType as U, IDToken as V, OAuth2ClientInput as W, SCIMAuthorization as X, SCIMAttributeType as Y, SCIMConfig as Z, StaticWebsiteConfig as _, Resolver as _t, IncomingWebhookTrigger as a, PermissionCondition as at, IdPExternalConfig as b, FieldMetadata as bt, ScheduleTriggerInput as c, unsafeAllowAllGqlPermission as ct, AppConfig as d, AttributeMap as dt, UserAttributeKey as et, defineConfig as f, TailorUser as ft, WorkflowServiceInput as g, QueryType as gt, WorkflowServiceConfig as h, TailorField as ht, GqlOperation as i, ValueOperand as it, defineAuth as j, AuthInvoker as k, WebhookOperation as l, unsafeAllowAllTypePermission as lt, Generator as m, TailorAnyField as mt, ExecutorInput as n, UserAttributeMap as nt, RecordTrigger as o, TailorTypeGqlPermission as ot, defineGenerators as p, unauthenticatedTailorUser as pt, SCIMAttribute as q, FunctionOperation as r, UsernameFieldKey as rt, ResolverExecutedTrigger as s, TailorTypePermission as st, Executor as t, UserAttributeListKey as tt, WorkflowOperation as u, AttributeList as ut, defineStaticWebSite as v, ResolverInput as vt, ResolverServiceInput as w, InferFieldsOutput as wt, defineIdp as x, FieldOptions as xt, IdPConfig as y, ArrayFieldOutput as yt, AuthServiceInput as z };
|
|
1699
|
-
//# sourceMappingURL=types-
|
|
1699
|
+
//# sourceMappingURL=types-DCb7NVBk.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./../../user-defined.d.ts" />
|
|
2
|
-
import { P as TailorDBType, ht as TailorField } from "../../types-
|
|
3
|
-
import { n as output } from "../../index-
|
|
2
|
+
import { P as TailorDBType, ht as TailorField } from "../../types-DCb7NVBk.mjs";
|
|
3
|
+
import { n as output } from "../../index-LqF60FaW.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/test/index.d.ts
|
|
@@ -51,10 +51,7 @@ body: async (context) => {
|
|
|
51
51
|
// In executors
|
|
52
52
|
body: async ({ newRecord }) => {
|
|
53
53
|
const db = getDB("tailordb");
|
|
54
|
-
await db
|
|
55
|
-
.insertInto("AuditLog")
|
|
56
|
-
.values({ userId: newRecord.id, action: "created" })
|
|
57
|
-
.execute();
|
|
54
|
+
await db.insertInto("AuditLog").values({ userId: newRecord.id, action: "created" }).execute();
|
|
58
55
|
};
|
|
59
56
|
|
|
60
57
|
// In workflow jobs
|
package/docs/generator/custom.md
CHANGED
|
@@ -18,10 +18,7 @@ interface CodeGenerator<T, R, E, Ts, Rs> {
|
|
|
18
18
|
source: { filePath: string; exportName: string };
|
|
19
19
|
}): T | Promise<T>;
|
|
20
20
|
|
|
21
|
-
processResolver(args: {
|
|
22
|
-
resolver: Resolver;
|
|
23
|
-
namespace: string;
|
|
24
|
-
}): R | Promise<R>;
|
|
21
|
+
processResolver(args: { resolver: Resolver; namespace: string }): R | Promise<R>;
|
|
25
22
|
|
|
26
23
|
processExecutor(executor: Executor): E | Promise<E>;
|
|
27
24
|
|
|
@@ -297,8 +297,7 @@ export default createExecutor({
|
|
|
297
297
|
name: "order-status-changed",
|
|
298
298
|
trigger: recordUpdatedTrigger({
|
|
299
299
|
type: order,
|
|
300
|
-
condition: ({ oldRecord, newRecord }) =>
|
|
301
|
-
oldRecord.status !== newRecord.status,
|
|
300
|
+
condition: ({ oldRecord, newRecord }) => oldRecord.status !== newRecord.status,
|
|
302
301
|
}),
|
|
303
302
|
operation: {
|
|
304
303
|
kind: "function",
|
|
@@ -127,10 +127,7 @@ createResolver({
|
|
|
127
127
|
.string()
|
|
128
128
|
.validate(
|
|
129
129
|
({ value }) => value.includes("@"),
|
|
130
|
-
[
|
|
131
|
-
({ value }) => value.length <= 255,
|
|
132
|
-
"Email must be 255 characters or less",
|
|
133
|
-
],
|
|
130
|
+
[({ value }) => value.length <= 255, "Email must be 255 characters or less"],
|
|
134
131
|
),
|
|
135
132
|
age: t.int().validate(({ value }) => value >= 0 && value <= 150),
|
|
136
133
|
},
|
|
@@ -90,12 +90,7 @@ const auth = defineAuth("my-auth", {
|
|
|
90
90
|
## Complete Example
|
|
91
91
|
|
|
92
92
|
```typescript
|
|
93
|
-
import {
|
|
94
|
-
defineConfig,
|
|
95
|
-
defineAuth,
|
|
96
|
-
defineIdp,
|
|
97
|
-
defineStaticWebSite,
|
|
98
|
-
} from "@tailor-platform/sdk";
|
|
93
|
+
import { defineConfig, defineAuth, defineIdp, defineStaticWebSite } from "@tailor-platform/sdk";
|
|
99
94
|
import { user } from "./tailordb/user";
|
|
100
95
|
|
|
101
96
|
const website = defineStaticWebSite("my-frontend", {
|
|
@@ -206,10 +206,7 @@ Function arguments include: `value` (field value), `data` (entire record value),
|
|
|
206
206
|
```typescript
|
|
207
207
|
db.string().validate(
|
|
208
208
|
({ value }) => value.length > 5,
|
|
209
|
-
[
|
|
210
|
-
({ value }) => value.length < 10,
|
|
211
|
-
"Value must be shorter than 10 characters",
|
|
212
|
-
],
|
|
209
|
+
[({ value }) => value.length < 10, "Value must be shorter than 10 characters"],
|
|
213
210
|
);
|
|
214
211
|
```
|
|
215
212
|
|
package/docs/testing.md
CHANGED
|
@@ -104,10 +104,7 @@ import { getDB } from "generated/tailordb";
|
|
|
104
104
|
|
|
105
105
|
export interface DbOperations {
|
|
106
106
|
transaction: (fn: (ops: DbOperations) => Promise<unknown>) => Promise<void>;
|
|
107
|
-
getUser: (
|
|
108
|
-
email: string,
|
|
109
|
-
forUpdate: boolean,
|
|
110
|
-
) => Promise<{ email: string; age: number }>;
|
|
107
|
+
getUser: (email: string, forUpdate: boolean) => Promise<{ email: string; age: number }>;
|
|
111
108
|
updateUser: (user: { email: string; age: number }) => Promise<void>;
|
|
112
109
|
}
|
|
113
110
|
|
|
@@ -144,32 +141,23 @@ export default createResolver({
|
|
|
144
141
|
Then test by mocking the interface:
|
|
145
142
|
|
|
146
143
|
```typescript
|
|
147
|
-
import {
|
|
148
|
-
DbOperations,
|
|
149
|
-
decrementUserAge,
|
|
150
|
-
} from "../src/resolver/decrementUserAge";
|
|
144
|
+
import { DbOperations, decrementUserAge } from "../src/resolver/decrementUserAge";
|
|
151
145
|
|
|
152
146
|
describe("decrementUserAge resolver", () => {
|
|
153
147
|
test("basic functionality", async () => {
|
|
154
148
|
// Mock DbOperations implementation
|
|
155
149
|
const dbOperations = {
|
|
156
150
|
transaction: vi.fn(
|
|
157
|
-
async (fn: (ops: DbOperations) => Promise<unknown>) =>
|
|
158
|
-
await fn(dbOperations),
|
|
151
|
+
async (fn: (ops: DbOperations) => Promise<unknown>) => await fn(dbOperations),
|
|
159
152
|
),
|
|
160
|
-
getUser: vi
|
|
161
|
-
.fn()
|
|
162
|
-
.mockResolvedValue({ email: "test@example.com", age: 30 }),
|
|
153
|
+
getUser: vi.fn().mockResolvedValue({ email: "test@example.com", age: 30 }),
|
|
163
154
|
updateUser: vi.fn(),
|
|
164
155
|
} as DbOperations;
|
|
165
156
|
|
|
166
157
|
const result = await decrementUserAge("test@example.com", dbOperations);
|
|
167
158
|
|
|
168
159
|
expect(result).toEqual({ oldAge: 30, newAge: 29 });
|
|
169
|
-
expect(dbOperations.getUser).toHaveBeenCalledExactlyOnceWith(
|
|
170
|
-
"test@example.com",
|
|
171
|
-
true,
|
|
172
|
-
);
|
|
160
|
+
expect(dbOperations.getUser).toHaveBeenCalledExactlyOnceWith("test@example.com", true);
|
|
173
161
|
expect(dbOperations.updateUser).toHaveBeenCalledExactlyOnceWith(
|
|
174
162
|
expect.objectContaining({ age: 29 }),
|
|
175
163
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@bufbuild/protobuf": "2.10.2",
|
|
44
44
|
"@connectrpc/connect": "2.1.1",
|
|
45
45
|
"@connectrpc/connect-node": "2.1.1",
|
|
46
|
-
"@oxc-project/types": "0.
|
|
46
|
+
"@oxc-project/types": "0.107.0",
|
|
47
47
|
"@standard-schema/spec": "1.1.0",
|
|
48
48
|
"@urql/core": "6.0.1",
|
|
49
49
|
"chalk": "5.6.2",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"multiline-ts": "4.0.1",
|
|
60
60
|
"open": "11.0.0",
|
|
61
61
|
"ora": "9.0.0",
|
|
62
|
-
"oxc-parser": "0.
|
|
62
|
+
"oxc-parser": "0.107.0",
|
|
63
63
|
"p-limit": "7.2.0",
|
|
64
64
|
"pkg-types": "2.3.0",
|
|
65
|
-
"rolldown": "1.0.0-beta.
|
|
65
|
+
"rolldown": "1.0.0-beta.59",
|
|
66
66
|
"std-env": "3.10.0",
|
|
67
67
|
"table": "6.9.0",
|
|
68
68
|
"ts-cron-validator": "1.1.5",
|
|
@@ -77,18 +77,18 @@
|
|
|
77
77
|
"@toiroakr/lines-db": "0.6.1",
|
|
78
78
|
"@types/madge": "5.0.3",
|
|
79
79
|
"@types/mime-types": "3.0.1",
|
|
80
|
-
"@types/node": "24.10.
|
|
81
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
80
|
+
"@types/node": "24.10.7",
|
|
81
|
+
"@typescript/native-preview": "7.0.0-dev.20260111.1",
|
|
82
82
|
"@vitest/coverage-v8": "4.0.16",
|
|
83
83
|
"cross-env": "10.1.0",
|
|
84
84
|
"eslint": "9.39.2",
|
|
85
85
|
"eslint-plugin-jsdoc": "62.0.0",
|
|
86
|
-
"eslint-plugin-oxlint": "1.
|
|
86
|
+
"eslint-plugin-oxlint": "1.38.0",
|
|
87
87
|
"globals": "17.0.0",
|
|
88
|
-
"oxlint": "1.
|
|
88
|
+
"oxlint": "1.38.0",
|
|
89
89
|
"oxlint-tsgolint": "0.11.0",
|
|
90
90
|
"sonda": "0.10.1",
|
|
91
|
-
"tsdown": "0.
|
|
91
|
+
"tsdown": "0.19.0",
|
|
92
92
|
"typescript": "5.9.3",
|
|
93
93
|
"typescript-eslint": "8.52.0",
|
|
94
94
|
"vitest": "4.0.16"
|