@sequenceholdings/orm 2.7.1 → 2.8.1
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/README.md +18 -4
- package/dist/authoring.cjs +21 -0
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +1 -1
- package/dist/authoring.d.ts +1 -1
- package/dist/authoring.js +21 -0
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.d.cts +71 -71
- package/dist/canonical.d.ts +71 -71
- package/dist/cli.cjs +3460 -3337
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +13 -1
- package/dist/cli.d.ts +13 -1
- package/dist/cli.js +3459 -3338
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs +24 -6
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +12 -3
- package/dist/client.d.ts +12 -3
- package/dist/client.js +24 -6
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +844 -15
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +12 -2
- package/dist/compiler.d.ts +12 -2
- package/dist/compiler.js +844 -17
- package/dist/compiler.js.map +1 -1
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -57
- package/dist/index.d.ts +57 -57
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/ir.d.cts +72 -72
- package/dist/ir.d.ts +72 -72
- package/dist/sdl.cjs +3 -3
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +2 -0
- package/dist/sdl.d.ts +2 -0
- package/dist/sdl.js +3 -3
- package/dist/sdl.js.map +1 -1
- package/package.json +1 -1
- package/templates/orm-namespace/graphql/example/queries.ts +52 -5
- package/templates/orm-namespace/schema/tables.ts +5 -2
- package/templates/orm-namespace/sequence.config.ts +6 -4
- package/dist/{definition-DjfC7Lll.d.cts → definition-B99BsOAO.d.cts} +4 -4
- package/dist/{definition-DjfC7Lll.d.ts → definition-B99BsOAO.d.ts} +4 -4
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Handwritten GraphQL operations. `seq-studio orm apply` compiles every
|
|
3
|
-
* exported document at push time; the wire carries only `{ op
|
|
4
|
-
*
|
|
5
|
-
* generated `schema.graphql` (`seq-studio orm generate`).
|
|
3
|
+
* exported document at push time; the wire carries only `{ op, variables }`
|
|
4
|
+
* (`op` is the operation's hash or its name) — never query text, never SQL.
|
|
5
|
+
* Type names come from the generated `schema.graphql` (`seq-studio orm generate`).
|
|
6
6
|
*
|
|
7
7
|
* Gate an operation with `@requires(capability: "…")` — checked before
|
|
8
8
|
* execution, on top of the table policies that are always compiled in.
|
|
9
|
-
* Check capabilities, not roles: roles are created in Atlas
|
|
10
|
-
*
|
|
9
|
+
* Check capabilities, not roles: roles are created and edited in Atlas
|
|
10
|
+
* (`seq-studio access`), and grant the capabilities your code checks.
|
|
11
|
+
*
|
|
12
|
+
* Optional variables follow GraphQL input rules: leave one out and its field is
|
|
13
|
+
* omitted (the column default applies on insert; the column is left alone on
|
|
14
|
+
* update); pass `null` to write NULL.
|
|
11
15
|
*/
|
|
12
16
|
|
|
13
17
|
export const GetOpenDeals = /* GraphQL */ `
|
|
@@ -55,3 +59,46 @@ export const AddComment = /* GraphQL */ `
|
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
`
|
|
62
|
+
|
|
63
|
+
/** Create, read, update, and delete one deal by primary key. The table's write policy governs every write. */
|
|
64
|
+
export const CreateDeal = /* GraphQL */ `
|
|
65
|
+
mutation CreateDeal($title: String!, $status: DealStatus, $amount: numeric) {
|
|
66
|
+
insertDealsOne(object: { title: $title, status: $status, amount: $amount }) {
|
|
67
|
+
id
|
|
68
|
+
title
|
|
69
|
+
status
|
|
70
|
+
amount
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
|
|
75
|
+
export const GetDeal = /* GraphQL */ `
|
|
76
|
+
query GetDeal($id: uuid!) {
|
|
77
|
+
dealsByPk(id: $id) {
|
|
78
|
+
id
|
|
79
|
+
title
|
|
80
|
+
status
|
|
81
|
+
amount
|
|
82
|
+
createdAt
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
export const UpdateDeal = /* GraphQL */ `
|
|
88
|
+
mutation UpdateDeal($id: uuid!, $title: String, $status: DealStatus, $amount: numeric) {
|
|
89
|
+
updateDealsByPk(pkColumns: { id: $id }, _set: { title: $title, status: $status, amount: $amount }) {
|
|
90
|
+
id
|
|
91
|
+
title
|
|
92
|
+
status
|
|
93
|
+
amount
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`
|
|
97
|
+
|
|
98
|
+
export const DeleteDeal = /* GraphQL */ `
|
|
99
|
+
mutation DeleteDeal($id: uuid!) {
|
|
100
|
+
deleteDealsByPk(id: $id) {
|
|
101
|
+
id
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
* Every table carries its own row-level policies. The policy DSL:
|
|
12
12
|
* - `claim('sub')` / `claim('org')` — the caller's identity claims
|
|
13
13
|
* - `capability('x')` — boolean grant, resolved per caller (check
|
|
14
|
-
* capabilities, not roles: roles are created in Atlas
|
|
14
|
+
* capabilities, not roles: roles are created and edited in Atlas with
|
|
15
|
+
* `seq-studio access`, and grant the capabilities declared in code)
|
|
15
16
|
* - `exists(link, <predicate>)` — traverse a declared link
|
|
16
17
|
* - variants: `default` applies to everyone; each variant WIDENS access
|
|
17
18
|
* when its `when` guard matches (permissive union — grants only ever
|
|
@@ -47,7 +48,9 @@ export const deals: SeqTable = defineTable(
|
|
|
47
48
|
{ when: "capability('deals-admin')", allow: true },
|
|
48
49
|
],
|
|
49
50
|
},
|
|
50
|
-
|
|
51
|
+
// Equalities to claims pin those columns: inserts stamp them from the
|
|
52
|
+
// caller, so CreateDeal never takes an org or author.
|
|
53
|
+
write: "author_sub = claim('sub') and org = claim('org')",
|
|
51
54
|
},
|
|
52
55
|
},
|
|
53
56
|
)
|
|
@@ -3,10 +3,12 @@ import { defineNamespace } from '@sequenceholdings/orm/authoring'
|
|
|
3
3
|
/**
|
|
4
4
|
* The namespace config — exactly one per directory.
|
|
5
5
|
*
|
|
6
|
-
* Capabilities are
|
|
7
|
-
* contract your policies check with `capability('…')`.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Capabilities are code: DECLARE them here (verbatim custom-roles grammar) —
|
|
7
|
+
* the contract your policies and `@requires` check with `capability('…')`.
|
|
8
|
+
* Roles are data: create and edit the roles that bundle these capabilities in
|
|
9
|
+
* Atlas (`seq-studio access`, or the namespace's Roles tab), and grant who
|
|
10
|
+
* holds them there too. Don't define roles here — `definitions` is a
|
|
11
|
+
* deprecated one-time seed that later applies never update.
|
|
10
12
|
*/
|
|
11
13
|
export default defineNamespace({
|
|
12
14
|
// Rename me: the namespace becomes your Postgres schema (orm_<namespace>).
|
|
@@ -17,12 +17,12 @@ declare const fixed: z.ZodObject<{
|
|
|
17
17
|
bigint: "bigint";
|
|
18
18
|
boolean: "boolean";
|
|
19
19
|
date: "date";
|
|
20
|
-
text: "text";
|
|
21
|
-
timestamptz: "timestamptz";
|
|
22
20
|
uuid: "uuid";
|
|
21
|
+
text: "text";
|
|
23
22
|
integer: "integer";
|
|
24
23
|
numeric: "numeric";
|
|
25
24
|
double: "double";
|
|
25
|
+
timestamptz: "timestamptz";
|
|
26
26
|
}>;
|
|
27
27
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
28
28
|
}, z.core.$strict>>>;
|
|
@@ -59,12 +59,12 @@ declare const sqlOperationDefinitionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
59
59
|
bigint: "bigint";
|
|
60
60
|
boolean: "boolean";
|
|
61
61
|
date: "date";
|
|
62
|
-
text: "text";
|
|
63
|
-
timestamptz: "timestamptz";
|
|
64
62
|
uuid: "uuid";
|
|
63
|
+
text: "text";
|
|
65
64
|
integer: "integer";
|
|
66
65
|
numeric: "numeric";
|
|
67
66
|
double: "double";
|
|
67
|
+
timestamptz: "timestamptz";
|
|
68
68
|
}>;
|
|
69
69
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
70
70
|
}, z.core.$strict>>>;
|
|
@@ -17,12 +17,12 @@ declare const fixed: z.ZodObject<{
|
|
|
17
17
|
bigint: "bigint";
|
|
18
18
|
boolean: "boolean";
|
|
19
19
|
date: "date";
|
|
20
|
-
text: "text";
|
|
21
|
-
timestamptz: "timestamptz";
|
|
22
20
|
uuid: "uuid";
|
|
21
|
+
text: "text";
|
|
23
22
|
integer: "integer";
|
|
24
23
|
numeric: "numeric";
|
|
25
24
|
double: "double";
|
|
25
|
+
timestamptz: "timestamptz";
|
|
26
26
|
}>;
|
|
27
27
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
28
28
|
}, z.core.$strict>>>;
|
|
@@ -59,12 +59,12 @@ declare const sqlOperationDefinitionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
59
59
|
bigint: "bigint";
|
|
60
60
|
boolean: "boolean";
|
|
61
61
|
date: "date";
|
|
62
|
-
text: "text";
|
|
63
|
-
timestamptz: "timestamptz";
|
|
64
62
|
uuid: "uuid";
|
|
63
|
+
text: "text";
|
|
65
64
|
integer: "integer";
|
|
66
65
|
numeric: "numeric";
|
|
67
66
|
double: "double";
|
|
67
|
+
timestamptz: "timestamptz";
|
|
68
68
|
}>;
|
|
69
69
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
70
70
|
}, z.core.$strict>>>;
|