@contello/client 3.0.2 → 3.1.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/dist/index.cjs CHANGED
@@ -303,6 +303,55 @@ function buildRpc(operations, subscribe) {
303
303
  return rpc;
304
304
  }
305
305
  //#endregion
306
+ //#region src/source-mutation.ts
307
+ const cache$1 = /* @__PURE__ */ new WeakMap();
308
+ /**
309
+ * A create/update answers with the entity itself, so it selects the source's own fragment — the
310
+ * write comes back in the same shape a read does and needs no follow-up fetch. A delete answers
311
+ * with an id, either wrapped in a response object or, for routes, as a bare scalar.
312
+ */
313
+ function createSelection$1(source, binding) {
314
+ const declarations = binding.arguments.map((argument) => `$${argument.name}: ${argument.type}`).join(", ");
315
+ const args = binding.arguments.map((argument) => `${argument.name}: $${argument.name}`).join(", ");
316
+ const selection = {
317
+ entity: ` { ...${source.fragment} }`,
318
+ idObject: " { id }",
319
+ idScalar: ""
320
+ }[binding.result];
321
+ const operation = `mutation(${declarations}) { result: ${binding.field}(${args})${selection} }`;
322
+ return binding.result === "entity" ? `${source.document}\n${operation}` : operation;
323
+ }
324
+ function getSourceMutation(source, kind) {
325
+ return source.mutations?.[kind];
326
+ }
327
+ /** The mutation document for one write operation of a source. Cached per source + kind. */
328
+ function createSourceMutation(source, kind) {
329
+ const binding = getSourceMutation(source, kind);
330
+ if (!binding) throw new Error(`@contello/client: source "${source.__model}" has no ${kind} mutation — the schema exposes none for this model`);
331
+ const cached = cache$1.get(source);
332
+ if (cached?.[kind] !== void 0) return cached[kind];
333
+ const doc = createSelection$1(source, binding);
334
+ const entry = cached ?? {};
335
+ entry[kind] = doc;
336
+ cache$1.set(source, entry);
337
+ return doc;
338
+ }
339
+ /**
340
+ * Variables for a write: one per bound argument, the input nested under the envelope field when
341
+ * the argument is a one-field wrapper, and everything encoded on the way out (LocalDate /
342
+ * LocalDateTime structs become wire strings) — every caller goes through here, so no write path
343
+ * can skip the encoding.
344
+ */
345
+ function createSourceMutationVariables(binding, values) {
346
+ const variables = {};
347
+ for (const argument of binding.arguments) variables[argument.name] = argument.from === "id" ? values.id : argument.envelope ? { [argument.envelope]: values.input } : values.input;
348
+ return transformVariables(variables);
349
+ }
350
+ /** Pulls the id out of whatever shape the mutation answered with. */
351
+ function readSourceMutationId(binding, result) {
352
+ return binding.result === "idScalar" ? result : result.id;
353
+ }
354
+ //#endregion
306
355
  //#region src/source-subscription.ts
307
356
  const cache = /* @__PURE__ */ new WeakMap();
308
357
  function createSelection(source) {
@@ -324,12 +373,45 @@ function createSourceSubscription(source) {
324
373
  }
325
374
  //#endregion
326
375
  //#region src/sources.ts
376
+ const WRITE_KINDS = [
377
+ "create",
378
+ "update",
379
+ "delete"
380
+ ];
327
381
  function createSources(sources, subscribe) {
328
382
  const out = {};
329
383
  for (const [name, source] of Object.entries(sources)) {
330
384
  const def = source;
331
385
  const accessor = createSourceAccessor(name, def, createSourceSubscription(def), subscribe);
332
- if (accessor) out[name] = accessor;
386
+ if (accessor) out[name] = {
387
+ ...accessor,
388
+ ...createSourceWriters(name, def, subscribe)
389
+ };
390
+ }
391
+ return out;
392
+ }
393
+ /**
394
+ * Write accessors for the mutations the generator bound to this source. A create/update answers
395
+ * with the entity in the source's fragment shape, a delete with the id it removed. Nothing is
396
+ * cached here — `@contello/store` collections take the same payload into their cache.
397
+ */
398
+ function createSourceWriters(name, def, subscribe) {
399
+ const out = {};
400
+ for (const kind of WRITE_KINDS) {
401
+ const binding = def.mutations?.[kind];
402
+ if (!binding) continue;
403
+ const doc = createSourceMutation(def, kind);
404
+ out[kind] = (input) => {
405
+ const variables = createSourceMutationVariables(binding, kind === "delete" ? {
406
+ input,
407
+ id: input.id
408
+ } : { input });
409
+ return wrap(`source:${name}:${kind}`, async () => {
410
+ const response = await (0, _entwico_dash_async.firstAsync)(subscribe(doc, variables));
411
+ if (response?.result === void 0 || response.result === null) throw new Error(`@contello/client: ${kind} on source "${name}" returned no entity`);
412
+ return kind === "delete" ? readSourceMutationId(binding, response.result) : response.result;
413
+ }, (0, _contello_opentelemetry.graphqlOperationAttributes)(doc, variables));
414
+ };
333
415
  }
334
416
  return out;
335
417
  }
@@ -731,6 +813,75 @@ function createContelloClient(options) {
731
813
  return new ContelloClient(options);
732
814
  }
733
815
  //#endregion
816
+ //#region src/built-in-mutations.ts
817
+ /**
818
+ * Write bindings for the built-in sources. Unlike entity mutations these are not derived — their
819
+ * field and argument names are fixed parts of every Contello schema — but the generator still
820
+ * checks each one against the introspected schema before emitting it, so a server without them
821
+ * (or with a different shape) simply yields a read-only source.
822
+ *
823
+ * Routes are the odd ones: `updateContelloRoute` is keyed by the `path` inside its input rather
824
+ * than by an id, and it replaces the route rather than patching it. `deleteContelloRoute` takes a
825
+ * bare `id` and answers with a bare id string.
826
+ *
827
+ * Assets have no `create` — an asset comes into being through `client.upload()`, not a mutation.
828
+ */
829
+ const BUILT_IN_MUTATIONS = {
830
+ route: {
831
+ create: {
832
+ field: "createContelloRoute",
833
+ arguments: [{
834
+ name: "route",
835
+ type: "ContelloRouteInput!",
836
+ from: "input"
837
+ }],
838
+ result: "entity"
839
+ },
840
+ update: {
841
+ field: "updateContelloRoute",
842
+ arguments: [{
843
+ name: "route",
844
+ type: "ContelloRouteInput!",
845
+ from: "input"
846
+ }],
847
+ result: "entity"
848
+ },
849
+ delete: {
850
+ field: "deleteContelloRoute",
851
+ arguments: [{
852
+ name: "id",
853
+ type: "String",
854
+ from: "id"
855
+ }],
856
+ result: "idScalar"
857
+ }
858
+ },
859
+ asset: {
860
+ update: {
861
+ field: "updateContelloAsset",
862
+ arguments: [{
863
+ name: "request",
864
+ type: "ContelloAssetUpdateInput!",
865
+ from: "input"
866
+ }],
867
+ result: "entity"
868
+ },
869
+ delete: {
870
+ field: "deleteContelloAsset",
871
+ arguments: [{
872
+ name: "id",
873
+ type: "String!",
874
+ from: "id"
875
+ }],
876
+ result: "idObject"
877
+ }
878
+ }
879
+ };
880
+ //#endregion
881
+ exports.BUILT_IN_MUTATIONS = BUILT_IN_MUTATIONS;
734
882
  exports.ContelloClient = ContelloClient;
735
883
  exports.createContelloClient = createContelloClient;
884
+ exports.createSourceMutation = createSourceMutation;
885
+ exports.createSourceMutationVariables = createSourceMutationVariables;
736
886
  exports.createSourceSubscription = createSourceSubscription;
887
+ exports.readSourceMutationId = readSourceMutationId;
package/dist/index.d.cts CHANGED
@@ -41,13 +41,62 @@ type Rpc<T extends OperationMap> = { [K in keyof T]: RpcMethod<T[K]> };
41
41
  * - `i18nMessage` — built-in: `contelloI18nMessagesBatch`, requires `{ collection }` and optional `{ ids }` filter
42
42
  */
43
43
  type SourceCardinality = 'entity' | 'singleton' | 'route' | 'asset' | 'i18nMessage';
44
- type SourceDef<TModel extends string = string, TCardinality extends SourceCardinality = SourceCardinality, TResult = unknown> = {
44
+ /**
45
+ * One argument of a write mutation and what fills it. Entity mutations take a single input
46
+ * object; the built-ins vary — `createContelloRoute` takes `route:`, `deleteContelloRoute`
47
+ * takes a bare `id:`.
48
+ */
49
+ type SourceMutationArgument = {
50
+ /** the GQL argument name — `request`, `route`, `id` */name: string; /** the rendered GQL type, including nullability — `CreateCategoryRequestInput!`, `String` */
51
+ type: string; /** `input` takes the caller's input, `id` the id passed to a delete */
52
+ from: 'input' | 'id';
53
+ /**
54
+ * the single field of a one-field envelope argument (`CreateCategoryRequestInput { entity }`).
55
+ * When set, the accessor takes the inner input and the runtime nests it under this key.
56
+ */
57
+ envelope?: string | undefined;
58
+ };
59
+ /**
60
+ * What a write mutation answers with:
61
+ * - `entity` — the entity itself, selected through the source's fragment
62
+ * - `idObject` — an object carrying `id` (`ContelloEntityDeleteResponse`)
63
+ * - `idScalar` — a bare id (`deleteContelloRoute: String!`)
64
+ */
65
+ type SourceMutationResult = 'entity' | 'idObject' | 'idScalar';
66
+ /**
67
+ * How one write operation of a source binds to a Mutation field. Emitted by the generator
68
+ * from introspection — the runtime never derives field or argument names by string munging.
69
+ */
70
+ type SourceMutationBinding = {
71
+ /** the mutation field — `createCategory` */field: string;
72
+ arguments: SourceMutationArgument[];
73
+ result: SourceMutationResult;
74
+ };
75
+ /** Mutation bindings of a source. Absent operations are simply missing (singletons have no `create`). */
76
+ type SourceMutations = {
77
+ create?: SourceMutationBinding | undefined;
78
+ update?: SourceMutationBinding | undefined;
79
+ delete?: SourceMutationBinding | undefined;
80
+ };
81
+ /**
82
+ * Phantom shape carrying the input types of a source's write operations. A key is present
83
+ * only when the schema exposes the matching mutation, so `client.sources.x.create` exists
84
+ * exactly when `createX` does.
85
+ */
86
+ type SourceWrites = {
87
+ create?: unknown;
88
+ update?: unknown;
89
+ delete?: unknown;
90
+ };
91
+ type SourceDef<TModel extends string = string, TCardinality extends SourceCardinality = SourceCardinality, TResult = unknown, TWrites = unknown> = {
45
92
  /** the GQL fragment text — bundled with transitive deps if any */document: string; /** the fragment name to spread inside the source subscription — e.g. `Category` */
46
93
  fragment: string; /** the subscription field this fragment is bound to — `categoriesBatch`, `config`, etc */
47
- subscription: string;
94
+ subscription: string; /** write bindings — present only for sources whose model exposes entity mutations */
95
+ mutations?: SourceMutations | undefined;
48
96
  __model: TModel;
49
97
  __cardinality: TCardinality; /** phantom type — exists only at the type level */
50
- __result?: TResult | undefined;
98
+ __result?: TResult | undefined; /** phantom type — exists only at the type level */
99
+ __writes?: TWrites | undefined;
51
100
  };
52
101
  type SourceMap = Record<string, SourceDef>;
53
102
  /**
@@ -72,10 +121,33 @@ type SourceFetcherFor<S> = S extends SourceDef<string, 'singleton', infer R> ? (
72
121
  collection: string;
73
122
  ids?: string[] | undefined;
74
123
  }) => Promise<R[]> : never;
124
+ /** Extracts the phantom write-input shape of a SourceDef. */
125
+ type WritesOf<S> = S extends SourceDef<string, SourceCardinality, any, infer W> ? W : unknown;
126
+ /** Extracts the phantom result shape of a SourceDef — what its fragment selects. */
127
+ type ResultOf<S> = S extends SourceDef<string, SourceCardinality, infer R, any> ? R : unknown;
128
+ /**
129
+ * Per-source write accessors. Each method exists only when the generator found the matching
130
+ * mutation. A `create`/`update` selects the source's own fragment, so it answers with the entity
131
+ * in exactly the shape `fetch` yields; a `delete` answers with the id it removed. Nothing is
132
+ * cached here — that is the job of the collection that owns the source in `@contello/store`.
133
+ */
134
+ type SourceWritersFor<S> = (WritesOf<S> extends {
135
+ create: infer TCreate;
136
+ } ? {
137
+ create: (input: TCreate) => Promise<ResultOf<S>>;
138
+ } : Record<never, never>) & (WritesOf<S> extends {
139
+ update: infer TUpdate;
140
+ } ? {
141
+ update: (input: TUpdate) => Promise<ResultOf<S>>;
142
+ } : Record<never, never>) & (WritesOf<S> extends {
143
+ delete: infer TDelete;
144
+ } ? {
145
+ delete: (input: TDelete) => Promise<string>;
146
+ } : Record<never, never>);
75
147
  /** Per-source runtime accessor: `client.sources.category.fetch()` → `Promise<CategoryFragment[]>` etc. */
76
148
  type SourceAccessors<TSources extends SourceMap> = { [K in keyof TSources]: {
77
149
  fetch: SourceFetcherFor<TSources[K]>;
78
- } };
150
+ } & SourceWritersFor<TSources[K]> };
79
151
  //#endregion
80
152
  //#region src/upload.d.ts
81
153
  type UploadMetadata = {
@@ -162,5 +234,39 @@ type LocalDate = {
162
234
  //#region src/source-subscription.d.ts
163
235
  declare function createSourceSubscription(source: SourceDef): string;
164
236
  //#endregion
165
- export { type ConnectionContext, type ConnectionEvents, ContelloClient, type ContelloClientOptions, type DownloadResult, type HttpAgentOptions, type LocalDate, type LocalDateTime, type OperationDef, type OperationKind, type OperationMap, type ProxyResult, type Rpc, type Schema, type SourceAccessors, type SourceCardinality, type SourceDef, type SourceMap, type UploadData, type UploadMetadata, type UploadOptions, createContelloClient, createSourceSubscription };
237
+ //#region src/source-mutation.d.ts
238
+ type SourceMutationKind = keyof SourceMutations;
239
+ /** What a write takes: the caller's input, and the id for a delete. */
240
+ type SourceMutationValues = {
241
+ input?: unknown;
242
+ id?: string | undefined;
243
+ };
244
+ /** The mutation document for one write operation of a source. Cached per source + kind. */
245
+ declare function createSourceMutation(source: SourceDef, kind: SourceMutationKind): string;
246
+ /**
247
+ * Variables for a write: one per bound argument, the input nested under the envelope field when
248
+ * the argument is a one-field wrapper, and everything encoded on the way out (LocalDate /
249
+ * LocalDateTime structs become wire strings) — every caller goes through here, so no write path
250
+ * can skip the encoding.
251
+ */
252
+ declare function createSourceMutationVariables(binding: SourceMutationBinding, values: SourceMutationValues): Record<string, unknown>;
253
+ /** Pulls the id out of whatever shape the mutation answered with. */
254
+ declare function readSourceMutationId(binding: SourceMutationBinding, result: unknown): string;
255
+ //#endregion
256
+ //#region src/built-in-mutations.d.ts
257
+ /**
258
+ * Write bindings for the built-in sources. Unlike entity mutations these are not derived — their
259
+ * field and argument names are fixed parts of every Contello schema — but the generator still
260
+ * checks each one against the introspected schema before emitting it, so a server without them
261
+ * (or with a different shape) simply yields a read-only source.
262
+ *
263
+ * Routes are the odd ones: `updateContelloRoute` is keyed by the `path` inside its input rather
264
+ * than by an id, and it replaces the route rather than patching it. `deleteContelloRoute` takes a
265
+ * bare `id` and answers with a bare id string.
266
+ *
267
+ * Assets have no `create` — an asset comes into being through `client.upload()`, not a mutation.
268
+ */
269
+ declare const BUILT_IN_MUTATIONS: Partial<Record<SourceCardinality, SourceMutations>>;
270
+ //#endregion
271
+ export { BUILT_IN_MUTATIONS, type ConnectionContext, type ConnectionEvents, ContelloClient, type ContelloClientOptions, type DownloadResult, type HttpAgentOptions, type LocalDate, type LocalDateTime, type OperationDef, type OperationKind, type OperationMap, type ProxyResult, type Rpc, type Schema, type SourceAccessors, type SourceCardinality, type SourceDef, type SourceMap, type SourceMutationArgument, type SourceMutationBinding, type SourceMutationKind, type SourceMutationResult, type SourceMutationValues, type SourceMutations, type SourceWrites, type UploadData, type UploadMetadata, type UploadOptions, createContelloClient, createSourceMutation, createSourceMutationVariables, createSourceSubscription, readSourceMutationId };
166
272
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/http.ts","../src/types.ts","../src/upload.ts","../src/client.ts","../src/scalars.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GU,SAAA;EACV,IAAA;EACA,KAAA;EACA,GAAA;AAAA;;;iBCcc,wBAAA,CAAyB,MAAiB,EAAT,SAAS"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/http.ts","../src/types.ts","../src/upload.ts","../src/client.ts","../src/scalars.ts","../src/source-subscription.ts","../src/source-mutation.ts","../src/built-in-mutations.ts"],"mappings":";;;KAiCY,gBAAA;EACV,UAAA;EACA,OAAA;EACA,oBAAA;EACA,gBAAA;AAAA;AAAA,KAcU,cAAA;EACV,QAAA;EACA,IAAA;EACA,KAAA,IAAS,OAAA,CAAQ,UAAA;EACjB,MAAA,IAAU,cAAA,CAAe,UAAA;AAAA;AAAA,KAiCf,WAAA;EACV,MAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,IAAU,cAAA,CAAe,UAAA;AAAA;;;KC3Ff,aAAA;AAAA,KAEA,YAAA,iCAEG,MAAA,iCACC,aAAA,GAAgB,aAAA;EAE9B,QAAA;EACA,IAAA,EAAM,KAAA,EDyBI;ECvBV,QAAA,GAAW,OAAA;EAEX,WAAA,GAAc,UAAA;AAAA;AAAA,KAGJ,YAAA,GAAe,MAAM,SAAS,YAAA;AAAA,KAE9B,WAAA,WAAsB,YAAA,IAAgB,WAAA,CAAY,CAAA;AAAA,KAClD,cAAA,WAAyB,YAAA,IAAgB,WAAA,CAAY,CAAA;AAAA,KAErD,SAAA,WAAoB,YAAA,IAAgB,CAAA,kCAC5C,cAAA,CAAe,CAAA,UAAW,MAAA,wBAClB,aAAA,CAAc,WAAA,CAAY,CAAA,MAC/B,SAAA,EAAW,cAAA,CAAe,CAAA,MAAO,aAAA,CAAc,WAAA,CAAY,CAAA,KAC9D,cAAA,CAAe,CAAA,UAAW,MAAA,wBAClB,OAAA,CAAQ,WAAA,CAAY,CAAA,MACzB,SAAA,EAAW,cAAA,CAAe,CAAA,MAAO,OAAA,CAAQ,WAAA,CAAY,CAAA;AAAA,KAEhD,GAAA,WAAc,YAAA,kBACZ,CAAA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AA;EACA,MAAA;EACA,MAAA;AAAA;AAAA,KAGU,SAAA;EACV,IAAA;EACA,KAAA;EACA,GAAA;AAAA;;;iBCcc,wBAAA,CAAyB,MAAiB,EAAT,SAAS;;;KCvB9C,kBAAA,SAA2B,eAAe;;KAG1C,oBAAA;EACV,KAAA;EACA,EAAE;AAAA;;iBAwBY,oBAAA,CAAqB,MAAA,EAAQ,SAAA,EAAW,IAAA,EAAM,kBAAkB;;;;ANK9D;AAclB;;iBMYgB,6BAAA,CACd,OAAA,EAAS,qBAAA,EACT,MAAA,EAAQ,oBAAA,GACP,MAAA;;iBAYa,oBAAA,CAAqB,OAAA,EAAS,qBAAqB,EAAE,MAAA;;;;;;AN7CrE;;;;;;;;;cOnBa,kBAAA,EAAoB,OAAA,CAAQ,MAAA,CAAO,iBAAA,EAAmB,eAAA"}
package/dist/index.d.ts CHANGED
@@ -42,13 +42,62 @@ type Rpc<T extends OperationMap> = { [K in keyof T]: RpcMethod<T[K]> };
42
42
  * - `i18nMessage` — built-in: `contelloI18nMessagesBatch`, requires `{ collection }` and optional `{ ids }` filter
43
43
  */
44
44
  type SourceCardinality = 'entity' | 'singleton' | 'route' | 'asset' | 'i18nMessage';
45
- type SourceDef<TModel extends string = string, TCardinality extends SourceCardinality = SourceCardinality, TResult = unknown> = {
45
+ /**
46
+ * One argument of a write mutation and what fills it. Entity mutations take a single input
47
+ * object; the built-ins vary — `createContelloRoute` takes `route:`, `deleteContelloRoute`
48
+ * takes a bare `id:`.
49
+ */
50
+ type SourceMutationArgument = {
51
+ /** the GQL argument name — `request`, `route`, `id` */name: string; /** the rendered GQL type, including nullability — `CreateCategoryRequestInput!`, `String` */
52
+ type: string; /** `input` takes the caller's input, `id` the id passed to a delete */
53
+ from: 'input' | 'id';
54
+ /**
55
+ * the single field of a one-field envelope argument (`CreateCategoryRequestInput { entity }`).
56
+ * When set, the accessor takes the inner input and the runtime nests it under this key.
57
+ */
58
+ envelope?: string | undefined;
59
+ };
60
+ /**
61
+ * What a write mutation answers with:
62
+ * - `entity` — the entity itself, selected through the source's fragment
63
+ * - `idObject` — an object carrying `id` (`ContelloEntityDeleteResponse`)
64
+ * - `idScalar` — a bare id (`deleteContelloRoute: String!`)
65
+ */
66
+ type SourceMutationResult = 'entity' | 'idObject' | 'idScalar';
67
+ /**
68
+ * How one write operation of a source binds to a Mutation field. Emitted by the generator
69
+ * from introspection — the runtime never derives field or argument names by string munging.
70
+ */
71
+ type SourceMutationBinding = {
72
+ /** the mutation field — `createCategory` */field: string;
73
+ arguments: SourceMutationArgument[];
74
+ result: SourceMutationResult;
75
+ };
76
+ /** Mutation bindings of a source. Absent operations are simply missing (singletons have no `create`). */
77
+ type SourceMutations = {
78
+ create?: SourceMutationBinding | undefined;
79
+ update?: SourceMutationBinding | undefined;
80
+ delete?: SourceMutationBinding | undefined;
81
+ };
82
+ /**
83
+ * Phantom shape carrying the input types of a source's write operations. A key is present
84
+ * only when the schema exposes the matching mutation, so `client.sources.x.create` exists
85
+ * exactly when `createX` does.
86
+ */
87
+ type SourceWrites = {
88
+ create?: unknown;
89
+ update?: unknown;
90
+ delete?: unknown;
91
+ };
92
+ type SourceDef<TModel extends string = string, TCardinality extends SourceCardinality = SourceCardinality, TResult = unknown, TWrites = unknown> = {
46
93
  /** the GQL fragment text — bundled with transitive deps if any */document: string; /** the fragment name to spread inside the source subscription — e.g. `Category` */
47
94
  fragment: string; /** the subscription field this fragment is bound to — `categoriesBatch`, `config`, etc */
48
- subscription: string;
95
+ subscription: string; /** write bindings — present only for sources whose model exposes entity mutations */
96
+ mutations?: SourceMutations | undefined;
49
97
  __model: TModel;
50
98
  __cardinality: TCardinality; /** phantom type — exists only at the type level */
51
- __result?: TResult | undefined;
99
+ __result?: TResult | undefined; /** phantom type — exists only at the type level */
100
+ __writes?: TWrites | undefined;
52
101
  };
53
102
  type SourceMap = Record<string, SourceDef>;
54
103
  /**
@@ -73,10 +122,33 @@ type SourceFetcherFor<S> = S extends SourceDef<string, 'singleton', infer R> ? (
73
122
  collection: string;
74
123
  ids?: string[] | undefined;
75
124
  }) => Promise<R[]> : never;
125
+ /** Extracts the phantom write-input shape of a SourceDef. */
126
+ type WritesOf<S> = S extends SourceDef<string, SourceCardinality, any, infer W> ? W : unknown;
127
+ /** Extracts the phantom result shape of a SourceDef — what its fragment selects. */
128
+ type ResultOf<S> = S extends SourceDef<string, SourceCardinality, infer R, any> ? R : unknown;
129
+ /**
130
+ * Per-source write accessors. Each method exists only when the generator found the matching
131
+ * mutation. A `create`/`update` selects the source's own fragment, so it answers with the entity
132
+ * in exactly the shape `fetch` yields; a `delete` answers with the id it removed. Nothing is
133
+ * cached here — that is the job of the collection that owns the source in `@contello/store`.
134
+ */
135
+ type SourceWritersFor<S> = (WritesOf<S> extends {
136
+ create: infer TCreate;
137
+ } ? {
138
+ create: (input: TCreate) => Promise<ResultOf<S>>;
139
+ } : Record<never, never>) & (WritesOf<S> extends {
140
+ update: infer TUpdate;
141
+ } ? {
142
+ update: (input: TUpdate) => Promise<ResultOf<S>>;
143
+ } : Record<never, never>) & (WritesOf<S> extends {
144
+ delete: infer TDelete;
145
+ } ? {
146
+ delete: (input: TDelete) => Promise<string>;
147
+ } : Record<never, never>);
76
148
  /** Per-source runtime accessor: `client.sources.category.fetch()` → `Promise<CategoryFragment[]>` etc. */
77
149
  type SourceAccessors<TSources extends SourceMap> = { [K in keyof TSources]: {
78
150
  fetch: SourceFetcherFor<TSources[K]>;
79
- } };
151
+ } & SourceWritersFor<TSources[K]> };
80
152
  //#endregion
81
153
  //#region src/upload.d.ts
82
154
  type UploadMetadata = {
@@ -163,5 +235,39 @@ type LocalDate = {
163
235
  //#region src/source-subscription.d.ts
164
236
  declare function createSourceSubscription(source: SourceDef): string;
165
237
  //#endregion
166
- export { type ConnectionContext, type ConnectionEvents, ContelloClient, type ContelloClientOptions, type DownloadResult, type HttpAgentOptions, type LocalDate, type LocalDateTime, type OperationDef, type OperationKind, type OperationMap, type ProxyResult, type Rpc, type Schema, type SourceAccessors, type SourceCardinality, type SourceDef, type SourceMap, type UploadData, type UploadMetadata, type UploadOptions, createContelloClient, createSourceSubscription };
238
+ //#region src/source-mutation.d.ts
239
+ type SourceMutationKind = keyof SourceMutations;
240
+ /** What a write takes: the caller's input, and the id for a delete. */
241
+ type SourceMutationValues = {
242
+ input?: unknown;
243
+ id?: string | undefined;
244
+ };
245
+ /** The mutation document for one write operation of a source. Cached per source + kind. */
246
+ declare function createSourceMutation(source: SourceDef, kind: SourceMutationKind): string;
247
+ /**
248
+ * Variables for a write: one per bound argument, the input nested under the envelope field when
249
+ * the argument is a one-field wrapper, and everything encoded on the way out (LocalDate /
250
+ * LocalDateTime structs become wire strings) — every caller goes through here, so no write path
251
+ * can skip the encoding.
252
+ */
253
+ declare function createSourceMutationVariables(binding: SourceMutationBinding, values: SourceMutationValues): Record<string, unknown>;
254
+ /** Pulls the id out of whatever shape the mutation answered with. */
255
+ declare function readSourceMutationId(binding: SourceMutationBinding, result: unknown): string;
256
+ //#endregion
257
+ //#region src/built-in-mutations.d.ts
258
+ /**
259
+ * Write bindings for the built-in sources. Unlike entity mutations these are not derived — their
260
+ * field and argument names are fixed parts of every Contello schema — but the generator still
261
+ * checks each one against the introspected schema before emitting it, so a server without them
262
+ * (or with a different shape) simply yields a read-only source.
263
+ *
264
+ * Routes are the odd ones: `updateContelloRoute` is keyed by the `path` inside its input rather
265
+ * than by an id, and it replaces the route rather than patching it. `deleteContelloRoute` takes a
266
+ * bare `id` and answers with a bare id string.
267
+ *
268
+ * Assets have no `create` — an asset comes into being through `client.upload()`, not a mutation.
269
+ */
270
+ declare const BUILT_IN_MUTATIONS: Partial<Record<SourceCardinality, SourceMutations>>;
271
+ //#endregion
272
+ export { BUILT_IN_MUTATIONS, type ConnectionContext, type ConnectionEvents, ContelloClient, type ContelloClientOptions, type DownloadResult, type HttpAgentOptions, type LocalDate, type LocalDateTime, type OperationDef, type OperationKind, type OperationMap, type ProxyResult, type Rpc, type Schema, type SourceAccessors, type SourceCardinality, type SourceDef, type SourceMap, type SourceMutationArgument, type SourceMutationBinding, type SourceMutationKind, type SourceMutationResult, type SourceMutationValues, type SourceMutations, type SourceWrites, type UploadData, type UploadMetadata, type UploadOptions, createContelloClient, createSourceMutation, createSourceMutationVariables, createSourceSubscription, readSourceMutationId };
167
273
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/http.ts","../src/types.ts","../src/upload.ts","../src/client.ts","../src/scalars.ts","../src/source-subscription.ts"],"mappings":";;;;KAiCY,gBAAA;EACV,UAAA;EACA,OAAA;EACA,oBAAA;EACA,gBAAA;AAAA;AAAA,KAcU,cAAA;EACV,QAAA;EACA,IAAA;EACA,KAAA,IAAS,OAAA,CAAQ,UAAA;EACjB,MAAA,IAAU,cAAA,CAAe,UAAA;AAAA;AAAA,KAiCf,WAAA;EACV,MAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,IAAU,cAAA,CAAe,UAAA;AAAA;;;KC3Ff,aAAA;AAAA,KAEA,YAAA,iCAEG,MAAA,iCACC,aAAA,GAAgB,aAAA;EAE9B,QAAA;EACA,IAAA,EAAM,KAAA,EDyBI;ECvBV,QAAA,GAAW,OAAA;EAEX,WAAA,GAAc,UAAA;AAAA;AAAA,KAGJ,YAAA,GAAe,MAAM,SAAS,YAAA;AAAA,KAE9B,WAAA,WAAsB,YAAA,IAAgB,WAAA,CAAY,CAAA;AAAA,KAClD,cAAA,WAAyB,YAAA,IAAgB,WAAA,CAAY,CAAA;AAAA,KAErD,SAAA,WAAoB,YAAA,IAAgB,CAAA,kCAC5C,cAAA,CAAe,CAAA,UAAW,MAAA,wBAClB,aAAA,CAAc,WAAA,CAAY,CAAA,MAC/B,SAAA,EAAW,cAAA,CAAe,CAAA,MAAO,aAAA,CAAc,WAAA,CAAY,CAAA,KAC9D,cAAA,CAAe,CAAA,UAAW,MAAA,wBAClB,OAAA,CAAQ,WAAA,CAAY,CAAA,MACzB,SAAA,EAAW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OAAA,GAAU,aAAA,eAA4B,OAAA;EAMrF,OAAA,QAAe,KAAA,UAAe,SAAA,GAAY,MAAA,gCAAsC,OAAA,CAAQ,KAAA;AAAA;AAAA,iBAS1E,oBAAA,iBAAqC,MAAA,0BACnD,OAAA,EAAS,qBAAA,CAAsB,OAAA,IAC9B,cAAA,CAAe,OAAA;;;KChSN,aAAA;EACV,IAAA;EACA,KAAA;EACA,GAAA;EACA,IAAA;EACA,MAAA;EACA,MAAA;AAAA;AAAA,KAGU,SAAA;EACV,IAAA;EACA,KAAA;EACA,GAAA;AAAA;;;iBCcc,wBAAA,CAAyB,MAAiB,EAAT,SAAS"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/http.ts","../src/types.ts","../src/upload.ts","../src/client.ts","../src/scalars.ts","../src/source-subscription.ts","../src/source-mutation.ts","../src/built-in-mutations.ts"],"mappings":";;;;KAiCY,gBAAA;EACV,UAAA;EACA,OAAA;EACA,oBAAA;EACA,gBAAA;AAAA;AAAA,KAcU,cAAA;EACV,QAAA;EACA,IAAA;EACA,KAAA,IAAS,OAAA,CAAQ,UAAA;EACjB,MAAA,IAAU,cAAA,CAAe,UAAA;AAAA;AAAA,KAiCf,WAAA;EACV,MAAA;EACA,OAAA,EAAS,OAAA;EACT,MAAA,IAAU,cAAA,CAAe,UAAA;AAAA;;;KC3Ff,aAAA;AAAA,KAEA,YAAA,iCAEG,MAAA,iCACC,aAAA,GAAgB,aAAA;EAE9B,QAAA;EACA,IAAA,EAAM,KAAA,EDyBI;ECvBV,QAAA,GAAW,OAAA;EAEX,WAAA,GAAc,UAAA;AAAA;AAAA,KAGJ,YAAA,GAAe,MAAM,SAAS,YAAA;AAAA,KAE9B,WAAA,WAAsB,YAAA,IAAgB,WAAA,CAAY,CAAA;AAAA,KAClD,cAAA,WAAyB,YAAA,IAAgB,WAAA,CAAY,CAAA;AAAA,KAErD,SAAA,WAAoB,YAAA,IAAgB,CAAA,kCAC5C,cAAA,CAAe,CAAA,UAAW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