@tailor-platform/create-sdk 2.0.0-next.1 → 2.0.0-next.3
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 +94 -0
- package/package.json +8 -7
- package/templates/executor/.oxlintrc.json +1 -1
- package/templates/executor/__dot__gitignore +1 -1
- package/templates/executor/package.json +9 -8
- package/templates/executor/src/generated/db.ts +3 -3
- package/templates/executor/tailor.d.ts +4 -2
- package/templates/generators/.oxlintrc.json +1 -1
- package/templates/generators/__dot__gitignore +1 -1
- package/templates/generators/package.json +9 -8
- package/templates/generators/src/generated/db.ts +3 -3
- package/templates/generators/src/generated/files.ts +4 -4
- package/templates/generators/src/resolver/getProduct.test.ts +4 -3
- package/templates/generators/src/seed/data/Order.schema.ts +2 -2
- package/templates/generators/src/seed/data/Product.schema.ts +2 -2
- package/templates/generators/src/seed/data/User.schema.ts +2 -2
- package/templates/generators/src/seed/exec.mjs +1 -1
- package/templates/generators/tailor.d.ts +4 -2
- package/templates/hello-world/.oxlintrc.json +1 -1
- package/templates/hello-world/README.md +6 -6
- package/templates/hello-world/__dot__gitignore +1 -1
- package/templates/hello-world/package.json +8 -7
- package/templates/hello-world/src/generated/kysely-tailordb.ts +1 -1
- package/templates/hello-world/tailor.d.ts +4 -2
- package/templates/inventory-management/.oxlintrc.json +1 -1
- package/templates/inventory-management/README.md +8 -8
- package/templates/inventory-management/__dot__gitignore +1 -1
- package/templates/inventory-management/package.json +8 -7
- package/templates/inventory-management/src/executor/checkInventory.ts +1 -1
- package/templates/inventory-management/src/generated/kysely-tailordb.ts +8 -8
- package/templates/inventory-management/src/resolver/registerOrder.ts +2 -2
- package/templates/inventory-management/tailor.d.ts +4 -2
- package/templates/multi-application/.oxlintrc.json +1 -1
- package/templates/multi-application/README.md +2 -2
- package/templates/multi-application/__dot__gitignore +1 -1
- package/templates/multi-application/apps/admin/db/adminNote.ts +1 -1
- package/templates/multi-application/package.json +8 -7
- package/templates/resolver/.oxlintrc.json +1 -1
- package/templates/resolver/README.md +2 -2
- package/templates/resolver/__dot__gitignore +1 -1
- package/templates/resolver/package.json +9 -8
- package/templates/resolver/src/generated/db.ts +1 -1
- package/templates/resolver/src/resolver/add.test.ts +4 -3
- package/templates/resolver/src/resolver/incrementUserAge.test.ts +4 -3
- package/templates/resolver/src/resolver/showEnv.test.ts +2 -2
- package/templates/resolver/src/resolver/showUserInfo.test.ts +12 -9
- package/templates/resolver/src/resolver/showUserInfo.ts +3 -3
- package/templates/resolver/src/resolver/upsertUsers.test.ts +2 -2
- package/templates/resolver/tailor.d.ts +4 -2
- package/templates/static-web-site/.oxlintrc.json +1 -1
- package/templates/static-web-site/__dot__gitignore +1 -1
- package/templates/static-web-site/package.json +8 -7
- package/templates/static-web-site/tailor.d.ts +4 -2
- package/templates/tailordb/.oxlintrc.json +1 -1
- package/templates/tailordb/__dot__gitignore +1 -1
- package/templates/tailordb/package.json +9 -8
- package/templates/tailordb/src/generated/db.ts +3 -3
- package/templates/tailordb/tailor.d.ts +4 -2
- package/templates/workflow/.oxlintrc.json +1 -1
- package/templates/workflow/__dot__gitignore +1 -1
- package/templates/workflow/e2e/globalSetup.ts +1 -1
- package/templates/workflow/e2e/workflow.test.ts +1 -1
- package/templates/workflow/package.json +10 -9
- package/templates/workflow/src/generated/db.ts +2 -2
- package/templates/workflow/src/resolver/resolveApproval.test.ts +4 -3
- package/templates/workflow/src/workflow/approval.test.ts +8 -2
- package/templates/workflow/src/workflow/approval.ts +2 -2
- package/templates/workflow/src/workflow/order-fulfillment.test.ts +20 -8
- package/templates/workflow/tailor.d.ts +4 -2
|
@@ -19,7 +19,7 @@ export interface Namespace {
|
|
|
19
19
|
amount: number;
|
|
20
20
|
status: "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED";
|
|
21
21
|
createdAt: Generated<Timestamp>;
|
|
22
|
-
updatedAt: Timestamp
|
|
22
|
+
updatedAt: Generated<Timestamp>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
User: {
|
|
@@ -28,7 +28,7 @@ export interface Namespace {
|
|
|
28
28
|
email: string;
|
|
29
29
|
age: number;
|
|
30
30
|
createdAt: Generated<Timestamp>;
|
|
31
|
-
updatedAt: Timestamp
|
|
31
|
+
updatedAt: Generated<Timestamp>;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
2
|
import { mockWorkflow } from "@tailor-platform/sdk/vitest";
|
|
3
|
-
import { unauthenticatedTailorUser } from "@tailor-platform/sdk/test";
|
|
4
3
|
import resolver from "./resolveApproval";
|
|
5
4
|
|
|
6
5
|
describe("resolveApproval resolver", () => {
|
|
@@ -16,7 +15,8 @@ describe("resolveApproval resolver", () => {
|
|
|
16
15
|
|
|
17
16
|
const result = await resolver.body({
|
|
18
17
|
input: { executionId: "exec-1", approved: true },
|
|
19
|
-
|
|
18
|
+
caller: null,
|
|
19
|
+
invoker: null,
|
|
20
20
|
env: {},
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -33,7 +33,8 @@ describe("resolveApproval resolver", () => {
|
|
|
33
33
|
|
|
34
34
|
const result = await resolver.body({
|
|
35
35
|
input: { executionId: "exec-2", approved: false },
|
|
36
|
-
|
|
36
|
+
caller: null,
|
|
37
|
+
invoker: null,
|
|
37
38
|
env: {},
|
|
38
39
|
});
|
|
39
40
|
|
|
@@ -7,7 +7,10 @@ describe("approval workflow", () => {
|
|
|
7
7
|
using wf = mockWorkflow();
|
|
8
8
|
wf.setWaitHandler((_key, _payload) => ({ approved: true }));
|
|
9
9
|
|
|
10
|
-
const result = await processWithApproval.body(
|
|
10
|
+
const result = await processWithApproval.body(
|
|
11
|
+
{ orderId: "order-1" },
|
|
12
|
+
{ env: {}, invoker: null },
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
expect(result).toEqual({ orderId: "order-1", status: "approved" });
|
|
13
16
|
expect(wf.waitCalls).toEqual([
|
|
@@ -22,7 +25,10 @@ describe("approval workflow", () => {
|
|
|
22
25
|
using wf = mockWorkflow();
|
|
23
26
|
wf.setWaitHandler({ approved: false });
|
|
24
27
|
|
|
25
|
-
const result = await processWithApproval.body(
|
|
28
|
+
const result = await processWithApproval.body(
|
|
29
|
+
{ orderId: "order-2" },
|
|
30
|
+
{ env: {}, invoker: null },
|
|
31
|
+
);
|
|
26
32
|
|
|
27
33
|
expect(result).toEqual({ orderId: "order-2", status: "rejected" });
|
|
28
34
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createWorkflow, createWorkflowJob
|
|
1
|
+
import { createWaitPoints, createWorkflow, createWorkflowJob } from "@tailor-platform/sdk";
|
|
2
2
|
|
|
3
|
-
export const { approval } =
|
|
3
|
+
export const { approval } = createWaitPoints((define) => ({
|
|
4
4
|
/** Approval for order processing */
|
|
5
5
|
approval: define<{ message: string; orderId: string }, { approved: boolean }>(),
|
|
6
6
|
}));
|
|
@@ -10,18 +10,24 @@ import workflow, {
|
|
|
10
10
|
describe("order fulfillment workflow", () => {
|
|
11
11
|
describe("individual job tests with .body()", () => {
|
|
12
12
|
test("validateOrder accepts valid order", () => {
|
|
13
|
-
const result = validateOrder.body(
|
|
13
|
+
const result = validateOrder.body(
|
|
14
|
+
{ orderId: "order-1", amount: 100 },
|
|
15
|
+
{ env: {}, invoker: null },
|
|
16
|
+
);
|
|
14
17
|
expect(result).toEqual({ valid: true, orderId: "order-1" });
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
test("validateOrder rejects zero amount", () => {
|
|
18
|
-
expect(() =>
|
|
19
|
-
"
|
|
20
|
-
);
|
|
21
|
+
expect(() =>
|
|
22
|
+
validateOrder.body({ orderId: "order-1", amount: 0 }, { env: {}, invoker: null }),
|
|
23
|
+
).toThrow("Order amount must be positive");
|
|
21
24
|
});
|
|
22
25
|
|
|
23
26
|
test("processPayment returns transaction", () => {
|
|
24
|
-
const result = processPayment.body(
|
|
27
|
+
const result = processPayment.body(
|
|
28
|
+
{ orderId: "order-1", amount: 100 },
|
|
29
|
+
{ env: {}, invoker: null },
|
|
30
|
+
);
|
|
25
31
|
expect(result).toEqual({
|
|
26
32
|
transactionId: "txn-order-1",
|
|
27
33
|
amount: 100,
|
|
@@ -32,7 +38,7 @@ describe("order fulfillment workflow", () => {
|
|
|
32
38
|
test("sendConfirmation returns confirmation", () => {
|
|
33
39
|
const result = sendConfirmation.body(
|
|
34
40
|
{ orderId: "order-1", transactionId: "txn-1" },
|
|
35
|
-
{ env: {} },
|
|
41
|
+
{ env: {}, invoker: null },
|
|
36
42
|
);
|
|
37
43
|
expect(result).toEqual({
|
|
38
44
|
orderId: "order-1",
|
|
@@ -59,7 +65,10 @@ describe("order fulfillment workflow", () => {
|
|
|
59
65
|
confirmed: true,
|
|
60
66
|
});
|
|
61
67
|
|
|
62
|
-
const result = await fulfillOrder.body(
|
|
68
|
+
const result = await fulfillOrder.body(
|
|
69
|
+
{ orderId: "order-1", amount: 100 },
|
|
70
|
+
{ env: {}, invoker: null },
|
|
71
|
+
);
|
|
63
72
|
|
|
64
73
|
expect(validateOrder.trigger).toHaveBeenCalledWith({
|
|
65
74
|
orderId: "order-1",
|
|
@@ -97,7 +106,10 @@ describe("order fulfillment workflow", () => {
|
|
|
97
106
|
confirmed: true,
|
|
98
107
|
});
|
|
99
108
|
|
|
100
|
-
const result = await workflow.mainJob.body(
|
|
109
|
+
const result = await workflow.mainJob.body(
|
|
110
|
+
{ orderId: "order-2", amount: 200 },
|
|
111
|
+
{ env: {}, invoker: null },
|
|
112
|
+
);
|
|
101
113
|
|
|
102
114
|
expect(result).toEqual({
|
|
103
115
|
orderId: "order-2",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is auto-generated by @tailor-platform/sdk
|
|
2
2
|
// Do not edit this file manually
|
|
3
|
-
// Regenerated automatically when running 'tailor
|
|
3
|
+
// Regenerated automatically when running 'tailor deploy' or 'tailor generate'
|
|
4
4
|
|
|
5
5
|
declare module "@tailor-platform/sdk" {
|
|
6
|
-
interface
|
|
6
|
+
interface Attributes {
|
|
7
7
|
role: string;
|
|
8
8
|
}
|
|
9
9
|
interface AttributeList {
|
|
@@ -14,6 +14,8 @@ declare module "@tailor-platform/sdk" {
|
|
|
14
14
|
admin: true;
|
|
15
15
|
}
|
|
16
16
|
interface IdpNameRegistry {}
|
|
17
|
+
interface ConnectionNameRegistry {}
|
|
18
|
+
interface AIGatewayNameRegistry {}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export {};
|