@sequenceholdings/orm 2.7.0 → 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 +49 -4
- package/dist/authoring.cjs +30 -0
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +7 -1
- package/dist/authoring.d.ts +7 -1
- package/dist/authoring.js +30 -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 +3473 -3342
- 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 +3472 -3343
- 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 +30 -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 +30 -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/dist/authoring.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { b as CellPart } from './constants-Dou1RkTo.cjs';
|
|
|
3
3
|
import { ColumnsSelection } from 'drizzle-orm';
|
|
4
4
|
import { TypedQueryBuilder } from 'drizzle-orm/query-builders/query-builder';
|
|
5
5
|
import { QueryBuilder, PgView, PgTable, AnyPgColumn } from 'drizzle-orm/pg-core';
|
|
6
|
-
export { S as SqlOperationDefinition, d as defineOperation } from './definition-
|
|
6
|
+
export { S as SqlOperationDefinition, d as defineOperation } from './definition-B99BsOAO.cjs';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import './policy-1iZbGnZZ.cjs';
|
|
9
9
|
|
|
@@ -611,6 +611,12 @@ interface SyncedTableConfig {
|
|
|
611
611
|
/** Reflected read-only source as a safe qualified identifier: `<schema>.<table>`. */
|
|
612
612
|
source: string;
|
|
613
613
|
description?: string;
|
|
614
|
+
/**
|
|
615
|
+
* View dependency only: keep the reflected source and its read policy, but
|
|
616
|
+
* exclude direct GraphQL and SQL access. Requires a keyed source contract.
|
|
617
|
+
* Publish the permitted result through a managed view instead.
|
|
618
|
+
*/
|
|
619
|
+
internal?: boolean;
|
|
614
620
|
/**
|
|
615
621
|
* Primary-key property/column names, mutually exclusive with column-level
|
|
616
622
|
* `.primaryKey()`. Explicit `[]` declares a read-only bag with no row identity.
|
package/dist/authoring.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { b as CellPart } from './constants-Dou1RkTo.js';
|
|
|
3
3
|
import { ColumnsSelection } from 'drizzle-orm';
|
|
4
4
|
import { TypedQueryBuilder } from 'drizzle-orm/query-builders/query-builder';
|
|
5
5
|
import { QueryBuilder, PgView, PgTable, AnyPgColumn } from 'drizzle-orm/pg-core';
|
|
6
|
-
export { S as SqlOperationDefinition, d as defineOperation } from './definition-
|
|
6
|
+
export { S as SqlOperationDefinition, d as defineOperation } from './definition-B99BsOAO.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import './policy-1iZbGnZZ.js';
|
|
9
9
|
|
|
@@ -611,6 +611,12 @@ interface SyncedTableConfig {
|
|
|
611
611
|
/** Reflected read-only source as a safe qualified identifier: `<schema>.<table>`. */
|
|
612
612
|
source: string;
|
|
613
613
|
description?: string;
|
|
614
|
+
/**
|
|
615
|
+
* View dependency only: keep the reflected source and its read policy, but
|
|
616
|
+
* exclude direct GraphQL and SQL access. Requires a keyed source contract.
|
|
617
|
+
* Publish the permitted result through a managed view instead.
|
|
618
|
+
*/
|
|
619
|
+
internal?: boolean;
|
|
614
620
|
/**
|
|
615
621
|
* Primary-key property/column names, mutually exclusive with column-level
|
|
616
622
|
* `.primaryKey()`. Explicit `[]` declares a read-only bag with no row identity.
|
package/dist/authoring.js
CHANGED
|
@@ -278,6 +278,22 @@ function toPlatformUser(options) {
|
|
|
278
278
|
function isSeqLink(value) {
|
|
279
279
|
return typeof value === "object" && value !== null && value.kind === LINK_BRAND;
|
|
280
280
|
}
|
|
281
|
+
var TABLE_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
282
|
+
"displayName",
|
|
283
|
+
"description",
|
|
284
|
+
"renamedFrom",
|
|
285
|
+
"primaryKey",
|
|
286
|
+
"indexes",
|
|
287
|
+
"checks",
|
|
288
|
+
"foreignKeys",
|
|
289
|
+
"links",
|
|
290
|
+
"policies",
|
|
291
|
+
"cowMutations",
|
|
292
|
+
"cellMetadata",
|
|
293
|
+
"cellRevisions",
|
|
294
|
+
"materializes",
|
|
295
|
+
"internal"
|
|
296
|
+
]);
|
|
281
297
|
function isSeqTable(value) {
|
|
282
298
|
return typeof value === "object" && value !== null && value.kind === TABLE_BRAND;
|
|
283
299
|
}
|
|
@@ -292,6 +308,11 @@ function assertIdentifier({ value, what, file, pattern = IDENTIFIER_PATTERN }) {
|
|
|
292
308
|
function defineTable(name2, columns, config = {}) {
|
|
293
309
|
const file = activeAuthoringContext()?.currentFile;
|
|
294
310
|
assertIdentifier({ value: name2, what: "table name", file });
|
|
311
|
+
for (const key of Object.keys(config)) {
|
|
312
|
+
if (!TABLE_CONFIG_KEYS.has(key)) {
|
|
313
|
+
throw new OrmDefinitionError(`table "${name2}": unknown defineTable option "${key}"`, file);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
295
316
|
const entries = Object.entries(columns);
|
|
296
317
|
if (entries.length === 0) {
|
|
297
318
|
throw new OrmDefinitionError(`table "${name2}" declares no columns`, file);
|
|
@@ -384,6 +405,7 @@ function defineSyncedTable(name2, columnsOrConfig, maybeConfig) {
|
|
|
384
405
|
if (config.primaryKey !== void 0) tableConfig.primaryKey = config.primaryKey;
|
|
385
406
|
if (config.links !== void 0) tableConfig.links = config.links;
|
|
386
407
|
if (config.policies !== void 0) tableConfig.policies = { read: config.policies.read };
|
|
408
|
+
if (config.internal === true) tableConfig.internal = true;
|
|
387
409
|
const table = {
|
|
388
410
|
kind: TABLE_BRAND,
|
|
389
411
|
tableName: name2,
|
|
@@ -2745,6 +2767,11 @@ function serializeNamespace(input) {
|
|
|
2745
2767
|
enumsByName.set(ref.name, ref);
|
|
2746
2768
|
}
|
|
2747
2769
|
const canonicalTables = tables.map((table) => buildCanonicalTable({ table, relationsByName, enumsByName }));
|
|
2770
|
+
for (const table of tables) {
|
|
2771
|
+
if (table.source !== void 0 && table.config.internal === true && config.exports && Object.hasOwn(config.exports, table.tableName)) {
|
|
2772
|
+
throw new OrmDefinitionError(`internal synced source "${table.tableName}" cannot be exported; export a permitted managed view instead`, table.file);
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2748
2775
|
const canonicalEnums = [...enumsByName.values()].map((ref) => ({
|
|
2749
2776
|
name: ref.name,
|
|
2750
2777
|
values: [...ref.values]
|
|
@@ -3078,6 +3105,9 @@ function buildCanonicalLink({
|
|
|
3078
3105
|
if (!relationsByName.has(targetName)) {
|
|
3079
3106
|
return fail(`targets ${relationKind(target)} "${targetName}" which is not part of this namespace`);
|
|
3080
3107
|
}
|
|
3108
|
+
if (isSeqTable(target) && target.source !== void 0 && target.config.internal === true) {
|
|
3109
|
+
return fail(`targets internal synced source "${targetName}"; expose a permitted managed view instead`);
|
|
3110
|
+
}
|
|
3081
3111
|
if (link.enforce && (!isSeqTable(relation) || !isSeqTable(target))) {
|
|
3082
3112
|
return fail("cannot enforce a PostgreSQL foreign key involving a view");
|
|
3083
3113
|
}
|