@tailor-platform/sdk 1.8.0 → 1.9.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#516](https://github.com/tailor-platform/sdk/pull/516) [`425ead7`](https://github.com/tailor-platform/sdk/commit/425ead7f90c408605027537ee0e157b9d35651b6) Thanks [@jackchuka](https://github.com/jackchuka)! - Add support for configuring GraphQL operations on TailorDB types
8
+
9
+ - Add `gqlOperations` option to `.features()` for granular control (true = enabled, false = disabled)
10
+ - Add `"query"` alias for read-only mode: `gqlOperations: "query"` disables all mutations while keeping read enabled
11
+ - Add `gqlOperations` option to `TailorDBServiceConfig` for namespace-level defaults
12
+ - Regenerate proto definitions from latest `tailor-inc/proto`
13
+
3
14
  ## 1.8.0
4
15
 
5
16
  ### Minor Changes
@@ -0,0 +1,4 @@
1
+ import "./chunk-CIV_ash9.mjs";
2
+ import { t as defineApplication } from "./application-_ArEfxmV.mjs";
3
+
4
+ export { defineApplication };
@@ -97534,6 +97534,34 @@ function validatePluralFormUniqueness(types$2, namespace, typeSourceInfo) {
97534
97534
  //#region src/parser/service/common.ts
97535
97535
  const functionSchema = z.custom((val) => typeof val === "function");
97536
97536
 
97537
+ //#endregion
97538
+ //#region src/parser/service/tailordb/gql-operations.ts
97539
+ /**
97540
+ * Normalize GqlOperationsConfig (alias or object) to GqlOperations object.
97541
+ * "query" alias expands to read-only mode: { create: false, update: false, delete: false, read: true }
97542
+ * @param config - The GqlOperationsConfig to normalize
97543
+ * @returns The normalized GqlOperations object
97544
+ */
97545
+ function normalizeGqlOperations(config) {
97546
+ if (config === "query") return {
97547
+ create: false,
97548
+ update: false,
97549
+ delete: false,
97550
+ read: true
97551
+ };
97552
+ return config;
97553
+ }
97554
+ /**
97555
+ * Zod schema for GqlOperations configuration with normalization transform.
97556
+ * Accepts "query" alias or detailed object, normalizes to GqlOperations object.
97557
+ */
97558
+ const GqlOperationsSchema = z.union([z.literal("query"), z.object({
97559
+ create: z.boolean().optional(),
97560
+ update: z.boolean().optional(),
97561
+ delete: z.boolean().optional(),
97562
+ read: z.boolean().optional()
97563
+ })]).transform((val) => normalizeGqlOperations(val));
97564
+
97537
97565
  //#endregion
97538
97566
  //#region src/parser/service/tailordb/schema.ts
97539
97567
  const TailorFieldTypeSchema$1 = z.enum([
@@ -97591,17 +97619,23 @@ const TailorDBFieldSchema = z.lazy(() => z.object({
97591
97619
  metadata: DBFieldMetadataSchema,
97592
97620
  rawRelation: RawRelationConfigSchema.optional()
97593
97621
  }));
97622
+ /**
97623
+ * Schema for TailorDB type settings.
97624
+ * Normalizes gqlOperations from alias ("query") to object format.
97625
+ */
97626
+ const TailorDBTypeSettingsSchema = z.object({
97627
+ pluralForm: z.string().optional(),
97628
+ aggregation: z.boolean().optional(),
97629
+ bulkUpsert: z.boolean().optional(),
97630
+ gqlOperations: GqlOperationsSchema.optional()
97631
+ });
97594
97632
  const TailorDBTypeSchema = z.object({
97595
97633
  name: z.string(),
97596
97634
  fields: z.record(z.string(), TailorDBFieldSchema),
97597
97635
  metadata: z.object({
97598
97636
  name: z.string(),
97599
97637
  description: z.string().optional(),
97600
- settings: z.object({
97601
- pluralForm: z.string().optional(),
97602
- aggregation: z.boolean().optional(),
97603
- bulkUpsert: z.boolean().optional()
97604
- }).optional(),
97638
+ settings: TailorDBTypeSettingsSchema.optional(),
97605
97639
  permissions: z.unknown(),
97606
97640
  files: z.record(z.string(), z.string()),
97607
97641
  indexes: z.record(z.string(), z.object({
@@ -97610,6 +97644,21 @@ const TailorDBTypeSchema = z.object({
97610
97644
  })).optional()
97611
97645
  })
97612
97646
  });
97647
+ const TailorDBMigrationConfigSchema = z.object({
97648
+ directory: z.string(),
97649
+ machineUser: z.string().optional()
97650
+ });
97651
+ /**
97652
+ * Schema for TailorDB service configuration.
97653
+ * Normalizes gqlOperations from alias ("query") to object format.
97654
+ */
97655
+ const TailorDBServiceConfigSchema = z.object({
97656
+ files: z.array(z.string()),
97657
+ ignores: z.array(z.string()).optional(),
97658
+ erdSite: z.string().optional(),
97659
+ migration: TailorDBMigrationConfigSchema.optional(),
97660
+ gqlOperations: GqlOperationsSchema.optional()
97661
+ });
97613
97662
 
97614
97663
  //#endregion
97615
97664
  //#region src/cli/application/tailordb/service.ts
@@ -98188,7 +98237,7 @@ function defineTailorDB(config) {
98188
98237
  for (const [namespace, serviceConfig] of Object.entries(config)) {
98189
98238
  if ("external" in serviceConfig) externalTailorDBNamespaces.push(namespace);
98190
98239
  else {
98191
- const tailorDB = createTailorDBService(namespace, serviceConfig);
98240
+ const tailorDB = createTailorDBService(namespace, TailorDBServiceConfigSchema.parse(serviceConfig));
98192
98241
  tailorDBServices.push(tailorDB);
98193
98242
  }
98194
98243
  subgraphs.push({
@@ -98326,4 +98375,4 @@ function defineApplication(config) {
98326
98375
 
98327
98376
  //#endregion
98328
98377
  export { OAuth2ClientSchema as a, tailorUserMap as c, styles as d, symbols as f, ExecutorSchema as i, loadFilesWithIgnores as l, WorkflowJobSchema as n, ResolverSchema as o, WorkflowSchema as r, stringifyFunction as s, defineApplication as t, logger as u };
98329
- //# sourceMappingURL=application-HIu5peO4.mjs.map
98378
+ //# sourceMappingURL=application-_ArEfxmV.mjs.map