@eide/foir-cli 0.39.0 → 0.41.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/cli.js +41 -5
- package/dist/lib/config-helpers.d.ts +56 -0
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2785,8 +2785,14 @@ import {
|
|
|
2785
2785
|
ListDeadLetterEntriesRequestSchema,
|
|
2786
2786
|
RetryDeadLetterEntryRequestSchema,
|
|
2787
2787
|
DismissDeadLetterEntryRequestSchema,
|
|
2788
|
-
PublishOperationRequestSchema
|
|
2788
|
+
PublishOperationRequestSchema,
|
|
2789
|
+
OperationKind
|
|
2789
2790
|
} from "@eide/foir-proto-ts/operations/v1/operations_pb";
|
|
2791
|
+
function toOperationKind(kind) {
|
|
2792
|
+
if (kind === "query") return OperationKind.QUERY;
|
|
2793
|
+
if (kind === "field") return OperationKind.FIELD;
|
|
2794
|
+
return OperationKind.MUTATION;
|
|
2795
|
+
}
|
|
2790
2796
|
function createOperationsMethods(client) {
|
|
2791
2797
|
return {
|
|
2792
2798
|
// ── CRUD ──────────────────────────────────────────────────
|
|
@@ -2828,7 +2834,14 @@ function createOperationsMethods(client) {
|
|
|
2828
2834
|
configId: params.configId,
|
|
2829
2835
|
supportsAsync: params.supportsAsync,
|
|
2830
2836
|
callbackTtlSeconds: params.callbackTtlSeconds,
|
|
2831
|
-
capabilities: params.capabilities ?? []
|
|
2837
|
+
capabilities: params.capabilities ?? [],
|
|
2838
|
+
kind: toOperationKind(params.kind),
|
|
2839
|
+
attachedToModel: params.attachedToModel,
|
|
2840
|
+
parentFields: params.parentFields ?? [],
|
|
2841
|
+
cacheControl: params.cacheControl,
|
|
2842
|
+
secretBindings: params.secretBindings ?? [],
|
|
2843
|
+
requestTemplate: params.requestTemplate,
|
|
2844
|
+
responseTransform: params.responseTransform
|
|
2832
2845
|
})
|
|
2833
2846
|
);
|
|
2834
2847
|
return resp.operation ?? null;
|
|
@@ -2850,7 +2863,14 @@ function createOperationsMethods(client) {
|
|
|
2850
2863
|
isActive: params.isActive,
|
|
2851
2864
|
supportsAsync: params.supportsAsync,
|
|
2852
2865
|
callbackTtlSeconds: params.callbackTtlSeconds,
|
|
2853
|
-
capabilities: params.capabilities
|
|
2866
|
+
capabilities: params.capabilities,
|
|
2867
|
+
kind: params.kind ? toOperationKind(params.kind) : void 0,
|
|
2868
|
+
attachedToModel: params.attachedToModel,
|
|
2869
|
+
parentFields: params.parentFields ?? [],
|
|
2870
|
+
cacheControl: params.cacheControl,
|
|
2871
|
+
secretBindings: params.secretBindings ?? [],
|
|
2872
|
+
requestTemplate: params.requestTemplate,
|
|
2873
|
+
responseTransform: params.responseTransform
|
|
2854
2874
|
})
|
|
2855
2875
|
);
|
|
2856
2876
|
return resp.operation ?? null;
|
|
@@ -5339,7 +5359,15 @@ async function reconcileOperations(client, configId, operations, operationBaseUr
|
|
|
5339
5359
|
isActive: op.isActive,
|
|
5340
5360
|
supportsAsync,
|
|
5341
5361
|
callbackTtlSeconds: op.callbackTtlSeconds,
|
|
5342
|
-
capabilities
|
|
5362
|
+
capabilities,
|
|
5363
|
+
// Resolver (kind=query/field) fields — partial update on the platform.
|
|
5364
|
+
kind: op.kind,
|
|
5365
|
+
attachedToModel: op.attachedToModel,
|
|
5366
|
+
parentFields: op.parentFields,
|
|
5367
|
+
cacheControl: op.cacheControl,
|
|
5368
|
+
secretBindings: op.secretBindings,
|
|
5369
|
+
requestTemplate: op.requestTemplate,
|
|
5370
|
+
responseTransform: op.responseTransform
|
|
5343
5371
|
});
|
|
5344
5372
|
summary.operations.updated++;
|
|
5345
5373
|
summary.updatedOperationIds.push(ex.id);
|
|
@@ -5362,7 +5390,15 @@ async function reconcileOperations(client, configId, operations, operationBaseUr
|
|
|
5362
5390
|
configId,
|
|
5363
5391
|
supportsAsync,
|
|
5364
5392
|
callbackTtlSeconds: op.callbackTtlSeconds,
|
|
5365
|
-
capabilities
|
|
5393
|
+
capabilities,
|
|
5394
|
+
// Resolver (kind=query/field) fields.
|
|
5395
|
+
kind: op.kind,
|
|
5396
|
+
attachedToModel: op.attachedToModel,
|
|
5397
|
+
parentFields: op.parentFields,
|
|
5398
|
+
cacheControl: op.cacheControl,
|
|
5399
|
+
secretBindings: op.secretBindings,
|
|
5400
|
+
requestTemplate: op.requestTemplate,
|
|
5401
|
+
responseTransform: op.responseTransform
|
|
5366
5402
|
});
|
|
5367
5403
|
summary.operations.created++;
|
|
5368
5404
|
}
|
|
@@ -213,6 +213,62 @@ interface ApplyConfigOperationInput {
|
|
|
213
213
|
* whose extension makes no back-channel calls.
|
|
214
214
|
*/
|
|
215
215
|
capabilities?: string[];
|
|
216
|
+
/**
|
|
217
|
+
* How the operation surfaces in the public GraphQL schema and how it is
|
|
218
|
+
* dispatched. `mutation` (default) is the existing behaviour: an
|
|
219
|
+
* `executeXxx` root mutation dispatched via the worker queue. `query`
|
|
220
|
+
* registers a root Query field resolved synchronously in-process.
|
|
221
|
+
* `field` attaches a resolver field to `attachedToModel`, batched per
|
|
222
|
+
* request. QUERY/FIELD operations are the new "resolver" kind and use
|
|
223
|
+
* `requestTemplate` / `responseTransform` to call an upstream endpoint.
|
|
224
|
+
*/
|
|
225
|
+
kind?: 'mutation' | 'query' | 'field';
|
|
226
|
+
/**
|
|
227
|
+
* Model key the resolver field attaches to. Required (and only meaningful)
|
|
228
|
+
* when `kind === 'field'`.
|
|
229
|
+
*/
|
|
230
|
+
attachedToModel?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Field path(s) under `attachedToModel` that this resolver populates.
|
|
233
|
+
* FIELD only.
|
|
234
|
+
*/
|
|
235
|
+
parentFields?: string[];
|
|
236
|
+
/**
|
|
237
|
+
* Cache-control for QUERY / FIELD resolver results. `scope` selects the
|
|
238
|
+
* cache audience; `maxAge` is the freshness window in seconds.
|
|
239
|
+
*/
|
|
240
|
+
cacheControl?: {
|
|
241
|
+
scope: 'PUBLIC' | 'PRIVATE' | 'NO_CACHE';
|
|
242
|
+
maxAge?: number;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Maps `{{secret.NAME}}` placeholders in the request template to
|
|
246
|
+
* PROJECT-owned secrets. The dispatcher resolves plaintext at call time;
|
|
247
|
+
* it is never stored on the operation row.
|
|
248
|
+
*/
|
|
249
|
+
secretBindings?: Array<{
|
|
250
|
+
name: string;
|
|
251
|
+
secretRef: string;
|
|
252
|
+
}>;
|
|
253
|
+
/**
|
|
254
|
+
* Shapes the outbound HTTP request for QUERY / FIELD operations. Template
|
|
255
|
+
* variables `{{input.X}}`, `{{parent.X}}`, `{{secret.NAME}}`,
|
|
256
|
+
* `{{context.X}}` are interpolated at dispatch time. Set `batchCapable`
|
|
257
|
+
* to send one upstream request for the whole deduped input set.
|
|
258
|
+
*/
|
|
259
|
+
requestTemplate?: {
|
|
260
|
+
method?: string;
|
|
261
|
+
pathTemplate?: string;
|
|
262
|
+
query?: Record<string, string>;
|
|
263
|
+
headers?: Record<string, string>;
|
|
264
|
+
bodyTemplate?: string;
|
|
265
|
+
batchCapable?: boolean;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* jq-style transform applied to the upstream response before it is
|
|
269
|
+
* returned to the caller. QUERY / FIELD only.
|
|
270
|
+
*/
|
|
271
|
+
responseTransform?: string;
|
|
216
272
|
}
|
|
217
273
|
interface ApplyConfigSegmentInput {
|
|
218
274
|
key: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eide/foir-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Universal platform CLI for Foir platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@bufbuild/protovalidate": "^1.1.1",
|
|
51
51
|
"@connectrpc/connect": "^2.0.0",
|
|
52
52
|
"@connectrpc/connect-node": "^2.0.0",
|
|
53
|
-
"@eide/foir-proto-ts": "^0.
|
|
53
|
+
"@eide/foir-proto-ts": "^0.92.0",
|
|
54
54
|
"chalk": "^5.3.0",
|
|
55
55
|
"commander": "^12.1.0",
|
|
56
56
|
"dotenv": "^16.4.5",
|