@eide/foir-cli 0.38.0 → 0.40.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 CHANGED
@@ -686,12 +686,11 @@ function createIdentityMethods(client) {
686
686
  },
687
687
  // ── Admin Users ───────────────────────────────────────
688
688
  async createAdminUser(params) {
689
- const createData = { email: params.email };
690
- if (params.firstName !== void 0) createData.firstName = params.firstName;
691
- if (params.lastName !== void 0) createData.lastName = params.lastName;
692
689
  const resp = await client.createAdminUser(
693
690
  create(CreateAdminUserRequestSchema, {
694
- create: createData,
691
+ email: params.email,
692
+ firstName: params.firstName,
693
+ lastName: params.lastName,
695
694
  tenantId: params.tenantId,
696
695
  projectId: params.projectId,
697
696
  role: params.role
@@ -706,13 +705,14 @@ function createIdentityMethods(client) {
706
705
  return { user: resp.user ?? null };
707
706
  },
708
707
  async updateAdminUser(params) {
709
- const update = {};
710
- if (params.firstName !== void 0) update.firstName = { set: params.firstName };
711
- if (params.lastName !== void 0) update.lastName = { set: params.lastName };
712
- if (params.avatarUrl !== void 0) update.avatarUrl = { set: params.avatarUrl };
713
- if (params.status !== void 0) update.status = { set: params.status };
714
708
  const resp = await client.updateAdminUser(
715
- create(UpdateAdminUserRequestSchema, { id: params.id, update })
709
+ create(UpdateAdminUserRequestSchema, {
710
+ id: params.id,
711
+ firstName: params.firstName,
712
+ lastName: params.lastName,
713
+ avatarUrl: params.avatarUrl,
714
+ status: params.status
715
+ })
716
716
  );
717
717
  return { user: resp.user ?? null };
718
718
  },
@@ -746,7 +746,7 @@ function createIdentityMethods(client) {
746
746
  async createCustomer(params) {
747
747
  const resp = await client.createCustomer(
748
748
  create(CreateCustomerRequestSchema, {
749
- create: { email: params.email },
749
+ email: params.email,
750
750
  password: params.password
751
751
  })
752
752
  );
@@ -763,13 +763,11 @@ function createIdentityMethods(client) {
763
763
  };
764
764
  },
765
765
  async updateCustomer(params) {
766
- const update = {};
767
- if (params.email !== void 0) update.email = { set: params.email };
768
- if (params.status !== void 0) update.status = { set: params.status };
769
766
  const resp = await client.updateCustomer(
770
767
  create(UpdateCustomerRequestSchema, {
771
768
  id: params.id,
772
- update
769
+ email: params.email,
770
+ status: params.status
773
771
  })
774
772
  );
775
773
  return {
@@ -807,7 +805,7 @@ function createIdentityMethods(client) {
807
805
  // ── Tenants ───────────────────────────────────────────
808
806
  async createTenant(params) {
809
807
  const resp = await client.createTenant(
810
- create(CreateTenantRequestSchema, { create: { name: params.name } })
808
+ create(CreateTenantRequestSchema, { name: params.name })
811
809
  );
812
810
  return { tenant: resp.tenant ?? null };
813
811
  },
@@ -818,11 +816,12 @@ function createIdentityMethods(client) {
818
816
  return { tenant: resp.tenant ?? null };
819
817
  },
820
818
  async updateTenant(params) {
821
- const update = {};
822
- if (params.name !== void 0) update.name = { set: params.name };
823
- if (params.status !== void 0) update.status = { set: params.status };
824
819
  const resp = await client.updateTenant(
825
- create(UpdateTenantRequestSchema, { id: params.id, update })
820
+ create(UpdateTenantRequestSchema, {
821
+ id: params.id,
822
+ name: params.name,
823
+ status: params.status
824
+ })
826
825
  );
827
826
  return { tenant: resp.tenant ?? null };
828
827
  },
@@ -886,7 +885,7 @@ function createIdentityMethods(client) {
886
885
  const resp = await client.listProjects(
887
886
  create(ListProjectsRequestSchema, {
888
887
  tenantId: params.tenantId,
889
- status: params.status,
888
+ where: params.where,
890
889
  first: params.first ?? DEFAULT_PAGE_SIZE,
891
890
  after: params?.after
892
891
  })
@@ -936,7 +935,7 @@ function createIdentityMethods(client) {
936
935
  const resp = await client.listInvitations(
937
936
  create(ListInvitationsRequestSchema, {
938
937
  tenantId: params.tenantId,
939
- status: params.status,
938
+ where: params.where,
940
939
  first: params.first ?? DEFAULT_PAGE_SIZE,
941
940
  after: params?.after
942
941
  })
@@ -1044,7 +1043,7 @@ function createIdentityMethods(client) {
1044
1043
  async listAuthProviders(params = {}) {
1045
1044
  const resp = await client.listAuthProviders(
1046
1045
  create(ListAuthProvidersRequestSchema, {
1047
- enabled: params.enabled,
1046
+ where: params.where,
1048
1047
  first: params.first ?? DEFAULT_PAGE_SIZE,
1049
1048
  after: params?.after
1050
1049
  })
@@ -1922,9 +1921,7 @@ function createConfigsMethods(client) {
1922
1921
  async listOperations(params = {}) {
1923
1922
  return client.listOperations(
1924
1923
  create5(ListOperationsRequestSchema, {
1925
- category: params.category,
1926
- isActive: params.isActive,
1927
- search: params.search,
1924
+ where: params.where,
1928
1925
  first: params.first ?? DEFAULT_PAGE_SIZE,
1929
1926
  after: params?.after
1930
1927
  })
@@ -1946,8 +1943,7 @@ function createConfigsMethods(client) {
1946
1943
  async listConfigs(params = {}) {
1947
1944
  return client.listConfigs(
1948
1945
  create5(ListConfigsRequestSchema, {
1949
- configType: params.configType,
1950
- enabled: params.enabled,
1946
+ where: params.where,
1951
1947
  first: params.first ?? DEFAULT_PAGE_SIZE,
1952
1948
  after: params?.after
1953
1949
  })
@@ -2084,8 +2080,7 @@ function createSegmentsMethods(client) {
2084
2080
  async listSegments(params = {}) {
2085
2081
  return client.listSegments(
2086
2082
  create6(ListSegmentsRequestSchema, {
2087
- isActive: params.isActive,
2088
- configId: params.configId,
2083
+ where: params.where,
2089
2084
  first: params.first ?? DEFAULT_PAGE_SIZE,
2090
2085
  after: params?.after
2091
2086
  })
@@ -2255,8 +2250,7 @@ function createSettingsMethods(client) {
2255
2250
  async listMyMentions(params = {}) {
2256
2251
  return client.listMyMentions(
2257
2252
  create7(ListMyMentionsRequestSchema, {
2258
- status: params.status ?? [],
2259
- entityType: params.entityType,
2253
+ where: params.where,
2260
2254
  first: params.first ?? DEFAULT_PAGE_SIZE,
2261
2255
  after: params?.after
2262
2256
  })
@@ -2287,11 +2281,10 @@ function createSettingsMethods(client) {
2287
2281
  const resp = await client.getNote(create7(GetNoteRequestSchema, { id }));
2288
2282
  return resp.note ?? null;
2289
2283
  },
2290
- async listNotes(params) {
2284
+ async listNotes(params = {}) {
2291
2285
  return client.listNotes(
2292
2286
  create7(ListNotesRequestSchema, {
2293
- entityType: params.entityType,
2294
- entityId: params.entityId,
2287
+ where: params.where,
2295
2288
  first: params.first ?? DEFAULT_PAGE_SIZE,
2296
2289
  after: params?.after
2297
2290
  })
@@ -2330,34 +2323,26 @@ function createSettingsMethods(client) {
2330
2323
  return resp.dimension ?? null;
2331
2324
  },
2332
2325
  async createContextDimension(params) {
2333
- const createInput = {
2334
- key: params.key,
2335
- name: params.name,
2336
- sourceType: params.sourceType,
2337
- sourceModelKey: params.sourceModelKey
2338
- };
2339
- if (params.description !== void 0)
2340
- createInput.description = params.description;
2341
- if (params.defaultRecordKey !== void 0)
2342
- createInput.defaultRecordKey = params.defaultRecordKey;
2343
2326
  const resp = await client.createContextDimension(
2344
- create7(CreateContextDimensionRequestSchema, { create: createInput })
2327
+ create7(CreateContextDimensionRequestSchema, {
2328
+ key: params.key,
2329
+ name: params.name,
2330
+ description: params.description,
2331
+ sourceType: params.sourceType,
2332
+ sourceModelKey: params.sourceModelKey,
2333
+ defaultRecordKey: params.defaultRecordKey
2334
+ })
2345
2335
  );
2346
2336
  return resp.dimension ?? null;
2347
2337
  },
2348
2338
  async updateContextDimension(params) {
2349
- const update = {};
2350
- if (params.name !== void 0) update.name = { set: params.name };
2351
- if (params.description !== void 0)
2352
- update.description = { set: params.description };
2353
- if (params.sourceModelKey !== void 0)
2354
- update.sourceModelKey = { set: params.sourceModelKey };
2355
- if (params.defaultRecordKey !== void 0)
2356
- update.defaultRecordKey = { set: params.defaultRecordKey };
2357
2339
  const resp = await client.updateContextDimension(
2358
2340
  create7(UpdateContextDimensionRequestSchema, {
2359
2341
  id: params.id,
2360
- update,
2342
+ name: params.name,
2343
+ description: params.description,
2344
+ sourceModelKey: params.sourceModelKey,
2345
+ defaultRecordKey: params.defaultRecordKey,
2361
2346
  publish: params.publish
2362
2347
  })
2363
2348
  );
@@ -2496,7 +2481,7 @@ function createSettingsMethods(client) {
2496
2481
  async listVariantCatalog(params = {}) {
2497
2482
  return client.listVariantCatalog(
2498
2483
  create7(ListVariantCatalogRequestSchema, {
2499
- isActive: params.isActive,
2484
+ where: params.where,
2500
2485
  first: params.first ?? DEFAULT_PAGE_SIZE,
2501
2486
  after: params?.after
2502
2487
  })
@@ -2546,7 +2531,7 @@ function createSettingsMethods(client) {
2546
2531
  async listLocales(params = {}) {
2547
2532
  return client.listLocales(
2548
2533
  create7(ListLocalesRequestSchema, {
2549
- includeInactive: params.includeInactive,
2534
+ where: params.where,
2550
2535
  first: params.first ?? DEFAULT_PAGE_SIZE,
2551
2536
  after: params?.after
2552
2537
  })
@@ -2703,12 +2688,10 @@ function createStorageMethods(client) {
2703
2688
  const resp = await client.getFile(create8(GetFileRequestSchema, { id }));
2704
2689
  return resp.file ?? null;
2705
2690
  },
2706
- async listFiles(params) {
2691
+ async listFiles(params = {}) {
2707
2692
  return client.listFiles(
2708
2693
  create8(ListFilesRequestSchema, {
2709
- folder: params.folder,
2710
- mimeType: params.mimeType,
2711
- search: params.search,
2694
+ where: params.where,
2712
2695
  includeDeleted: params.includeDeleted ?? false,
2713
2696
  first: params.first ?? DEFAULT_PAGE_SIZE,
2714
2697
  after: params?.after
@@ -2727,7 +2710,9 @@ function createStorageMethods(client) {
2727
2710
  id: params.id,
2728
2711
  filename: params.filename,
2729
2712
  folder: params.folder,
2730
- tags: params.tags ?? []
2713
+ tags: params.tags ?? [],
2714
+ status: params.status,
2715
+ metadata: params.metadata
2731
2716
  })
2732
2717
  );
2733
2718
  return resp.file ?? null;
@@ -2800,18 +2785,21 @@ import {
2800
2785
  ListDeadLetterEntriesRequestSchema,
2801
2786
  RetryDeadLetterEntryRequestSchema,
2802
2787
  DismissDeadLetterEntryRequestSchema,
2803
- PublishOperationRequestSchema
2788
+ PublishOperationRequestSchema,
2789
+ OperationKind
2804
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
+ }
2805
2796
  function createOperationsMethods(client) {
2806
2797
  return {
2807
2798
  // ── CRUD ──────────────────────────────────────────────────
2808
2799
  async listOperations(params = {}) {
2809
2800
  return client.listOperations(
2810
2801
  create9(ListOperationsRequestSchema2, {
2811
- configId: params.configId,
2812
- category: params.category,
2813
- isActive: params.isActive,
2814
- search: params.search,
2802
+ where: params.where,
2815
2803
  first: params.first ?? DEFAULT_PAGE_SIZE,
2816
2804
  after: params?.after
2817
2805
  })
@@ -2846,7 +2834,15 @@ function createOperationsMethods(client) {
2846
2834
  configId: params.configId,
2847
2835
  supportsAsync: params.supportsAsync,
2848
2836
  callbackTtlSeconds: params.callbackTtlSeconds,
2849
- 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,
2845
+ allowInternalEndpoint: params.allowInternalEndpoint
2850
2846
  })
2851
2847
  );
2852
2848
  return resp.operation ?? null;
@@ -2868,7 +2864,15 @@ function createOperationsMethods(client) {
2868
2864
  isActive: params.isActive,
2869
2865
  supportsAsync: params.supportsAsync,
2870
2866
  callbackTtlSeconds: params.callbackTtlSeconds,
2871
- capabilities: params.capabilities
2867
+ capabilities: params.capabilities,
2868
+ kind: params.kind ? toOperationKind(params.kind) : void 0,
2869
+ attachedToModel: params.attachedToModel,
2870
+ parentFields: params.parentFields ?? [],
2871
+ cacheControl: params.cacheControl,
2872
+ secretBindings: params.secretBindings ?? [],
2873
+ requestTemplate: params.requestTemplate,
2874
+ responseTransform: params.responseTransform,
2875
+ allowInternalEndpoint: params.allowInternalEndpoint
2872
2876
  })
2873
2877
  );
2874
2878
  return resp.operation ?? null;
@@ -2900,7 +2904,7 @@ function createOperationsMethods(client) {
2900
2904
  async listDeadLetterEntries(params = {}) {
2901
2905
  return client.listDeadLetterEntries(
2902
2906
  create9(ListDeadLetterEntriesRequestSchema, {
2903
- operationKey: params.operationKey,
2907
+ where: params.where,
2904
2908
  first: params.first ?? DEFAULT_PAGE_SIZE,
2905
2909
  after: params?.after
2906
2910
  })
@@ -2946,9 +2950,7 @@ function createHooksMethods(client) {
2946
2950
  async listHooks(params = {}) {
2947
2951
  return client.listHooks(
2948
2952
  create10(ListHooksRequestSchema, {
2949
- event: params.event,
2950
- isActive: params.isActive,
2951
- configId: params.configId,
2953
+ where: params.where,
2952
2954
  first: params.first ?? DEFAULT_PAGE_SIZE,
2953
2955
  after: params?.after
2954
2956
  })
@@ -3003,11 +3005,10 @@ function createHooksMethods(client) {
3003
3005
  return resp.hook ?? null;
3004
3006
  },
3005
3007
  // ── Deliveries ──────────────────────────────────────────
3006
- async listHookDeliveries(params) {
3008
+ async listHookDeliveries(params = {}) {
3007
3009
  return client.listHookDeliveries(
3008
3010
  create10(ListHookDeliveriesRequestSchema, {
3009
- hookId: params.hookId,
3010
- status: params.status,
3011
+ where: params.where,
3011
3012
  first: params.first ?? DEFAULT_PAGE_SIZE,
3012
3013
  after: params?.after
3013
3014
  })
@@ -3047,7 +3048,7 @@ function createNotificationsMethods(client) {
3047
3048
  async listNotifications(params = {}) {
3048
3049
  return client.listNotifications(
3049
3050
  create11(ListNotificationsRequestSchema, {
3050
- isRead: params.unreadOnly ? false : void 0,
3051
+ where: params.where,
3051
3052
  first: params.first ?? 20,
3052
3053
  after: params?.after
3053
3054
  })
@@ -3087,8 +3088,7 @@ function createCronSchedulesMethods(client) {
3087
3088
  async listCronSchedules(params = {}) {
3088
3089
  return client.listCronSchedules(
3089
3090
  create12(ListCronSchedulesRequestSchema, {
3090
- configId: params.configId,
3091
- isActive: params.isActive,
3091
+ where: params.where,
3092
3092
  first: params.first ?? DEFAULT_PAGE_SIZE,
3093
3093
  after: params?.after
3094
3094
  })
@@ -3185,7 +3185,7 @@ function createPublishBatchesMethods(client) {
3185
3185
  async listPublishBatches(params = {}) {
3186
3186
  const resp = await client.listPublishBatches(
3187
3187
  create13(ListPublishBatchesRequestSchema, {
3188
- status: params.status,
3188
+ where: params.where,
3189
3189
  first: params.first ?? DEFAULT_PAGE_SIZE,
3190
3190
  after: params?.after
3191
3191
  })
@@ -3561,8 +3561,7 @@ function registerSelectProjectCommand(program2, globalOpts) {
3561
3561
  for (const tenant of tenants) {
3562
3562
  const { items } = await client.identity.listProjects({
3563
3563
  tenantId: tenant.id,
3564
- status: 1,
3565
- // PROJECT_STATUS_ACTIVE
3564
+ where: { status: { eq: "ACTIVE" } },
3566
3565
  first: 100
3567
3566
  });
3568
3567
  for (const p of items) {
@@ -4059,10 +4058,13 @@ function registerMediaCommands(program2, globalOpts) {
4059
4058
  const opts = globalOpts();
4060
4059
  const { getToken } = await getStorageAuth(opts);
4061
4060
  const storage = createStorageRpcClient(getToken);
4061
+ const mediaWhere = {};
4062
+ if (flags.folder) mediaWhere.folder = { eq: flags.folder };
4063
+ const mediaMime = flags["mime-type"] ?? flags.mimeType;
4064
+ if (mediaMime) mediaWhere.mimeType = { eq: mediaMime };
4065
+ if (flags.search) mediaWhere.filename = { contains: flags.search };
4062
4066
  const result = await storage.listFiles({
4063
- folder: flags.folder,
4064
- mimeType: flags["mime-type"] ?? flags.mimeType,
4065
- search: flags.search,
4067
+ where: Object.keys(mediaWhere).length > 0 ? mediaWhere : void 0,
4066
4068
  includeDeleted: !!flags.includeDeleted,
4067
4069
  first: Number(flags.first) || 50,
4068
4070
  after: flags.after
@@ -5314,7 +5316,10 @@ function resolveEndpoint(endpoint, baseUrl) {
5314
5316
  return baseUrl ? `${baseUrl.replace(/\/+$/, "")}${endpoint.startsWith("/") ? "" : "/"}${endpoint}` : endpoint;
5315
5317
  }
5316
5318
  async function reconcileOperations(client, configId, operations, operationBaseUrl, summary) {
5317
- const existing = await client.operations.listOperations({ configId, first: 200 });
5319
+ const existing = await client.operations.listOperations({
5320
+ where: { configId: { eq: configId } },
5321
+ first: 200
5322
+ });
5318
5323
  const existingByKey = new Map(
5319
5324
  (existing.operations ?? []).map((o) => [o.key, o])
5320
5325
  );
@@ -5356,7 +5361,16 @@ async function reconcileOperations(client, configId, operations, operationBaseUr
5356
5361
  isActive: op.isActive,
5357
5362
  supportsAsync,
5358
5363
  callbackTtlSeconds: op.callbackTtlSeconds,
5359
- capabilities
5364
+ capabilities,
5365
+ // Resolver (kind=query/field) fields — partial update on the platform.
5366
+ kind: op.kind,
5367
+ attachedToModel: op.attachedToModel,
5368
+ parentFields: op.parentFields,
5369
+ cacheControl: op.cacheControl,
5370
+ secretBindings: op.secretBindings,
5371
+ requestTemplate: op.requestTemplate,
5372
+ responseTransform: op.responseTransform,
5373
+ allowInternalEndpoint: op.allowInternalEndpoint
5360
5374
  });
5361
5375
  summary.operations.updated++;
5362
5376
  summary.updatedOperationIds.push(ex.id);
@@ -5379,7 +5393,16 @@ async function reconcileOperations(client, configId, operations, operationBaseUr
5379
5393
  configId,
5380
5394
  supportsAsync,
5381
5395
  callbackTtlSeconds: op.callbackTtlSeconds,
5382
- capabilities
5396
+ capabilities,
5397
+ // Resolver (kind=query/field) fields.
5398
+ kind: op.kind,
5399
+ attachedToModel: op.attachedToModel,
5400
+ parentFields: op.parentFields,
5401
+ cacheControl: op.cacheControl,
5402
+ secretBindings: op.secretBindings,
5403
+ requestTemplate: op.requestTemplate,
5404
+ responseTransform: op.responseTransform,
5405
+ allowInternalEndpoint: op.allowInternalEndpoint
5383
5406
  });
5384
5407
  summary.operations.created++;
5385
5408
  }
@@ -5394,7 +5417,10 @@ async function reconcileOperations(client, configId, operations, operationBaseUr
5394
5417
  }
5395
5418
  }
5396
5419
  async function reconcileHooks(client, configId, hooks, summary) {
5397
- const existing = await client.hooks.listHooks({ configId, first: 200 });
5420
+ const existing = await client.hooks.listHooks({
5421
+ where: { configId: { eq: configId } },
5422
+ first: 200
5423
+ });
5398
5424
  const existingByKey = new Map(
5399
5425
  (existing.hooks ?? []).map((h) => [h.key, h])
5400
5426
  );
@@ -5442,7 +5468,7 @@ async function reconcileHooks(client, configId, hooks, summary) {
5442
5468
  }
5443
5469
  async function reconcileSegments(client, configId, segments, summary) {
5444
5470
  const [scoped, all] = await Promise.all([
5445
- client.segments.listSegments({ configId, first: 200 }),
5471
+ client.segments.listSegments({ where: { configId: { eq: configId } }, first: 200 }),
5446
5472
  client.segments.listSegments({ first: 200 })
5447
5473
  ]);
5448
5474
  const existingByKey = /* @__PURE__ */ new Map();
@@ -5491,7 +5517,10 @@ async function reconcileSegments(client, configId, segments, summary) {
5491
5517
  }
5492
5518
  }
5493
5519
  async function reconcileCronSchedules(client, configId, schedules, summary) {
5494
- const existing = await client.cronSchedules.listCronSchedules({ configId, first: 200 });
5520
+ const existing = await client.cronSchedules.listCronSchedules({
5521
+ where: { configId: { eq: configId } },
5522
+ first: 200
5523
+ });
5495
5524
  const schedulesList = existing.schedules ?? [];
5496
5525
  const existingByKey = new Map(
5497
5526
  schedulesList.map((s) => [s.key, s])
@@ -7263,9 +7292,11 @@ function registerOperationsCommands(program2, globalOpts) {
7263
7292
  withErrorHandler(globalOpts, async (cmdOpts) => {
7264
7293
  const opts = globalOpts();
7265
7294
  const client = await createPlatformClient(opts);
7295
+ const where = {};
7296
+ if (cmdOpts.category) where.category = { eq: cmdOpts.category };
7297
+ if (cmdOpts.active) where.isActive = { eq: true };
7266
7298
  const data = await client.operations.listOperations({
7267
- category: cmdOpts.category,
7268
- isActive: cmdOpts.active ? true : void 0,
7299
+ where: Object.keys(where).length > 0 ? where : void 0,
7269
7300
  first: parseInt(String(cmdOpts.first ?? "50"), 10)
7270
7301
  });
7271
7302
  formatListProto(OperationSchema, data.operations, opts, {
@@ -7338,7 +7369,7 @@ function registerOperationsCommands(program2, globalOpts) {
7338
7369
  const opts = globalOpts();
7339
7370
  const client = await createPlatformClient(opts);
7340
7371
  const data = await client.operations.listDeadLetterEntries({
7341
- operationKey: cmdOpts.operation,
7372
+ where: cmdOpts.operation ? { operationKey: { eq: cmdOpts.operation } } : void 0,
7342
7373
  first: parseInt(cmdOpts.first ?? "20", 10)
7343
7374
  });
7344
7375
  formatListProto(DeadLetterEntrySchema, data.entries, opts, {
@@ -7400,7 +7431,7 @@ function registerSegmentsCommands(program2, globalOpts) {
7400
7431
  const opts = globalOpts();
7401
7432
  const client = await createPlatformClient(opts);
7402
7433
  const data = await client.segments.listSegments({
7403
- isActive: cmdOpts.active ? true : void 0,
7434
+ where: cmdOpts.active ? { isActive: { eq: true } } : void 0,
7404
7435
  first: parseInt(String(cmdOpts.first ?? "50"), 10),
7405
7436
  after: cmdOpts.after
7406
7437
  });
@@ -7528,7 +7559,7 @@ function registerSchedulesCommands(program2, globalOpts) {
7528
7559
  const opts = globalOpts();
7529
7560
  const client = await createPlatformClient(opts);
7530
7561
  const data = await client.cronSchedules.listCronSchedules({
7531
- isActive: cmdOpts.active ? true : void 0,
7562
+ where: cmdOpts.active ? { isActive: { eq: true } } : void 0,
7532
7563
  first: parseInt(String(cmdOpts.first ?? "50"), 10)
7533
7564
  });
7534
7565
  formatListProto(CronScheduleSchema, data.schedules, opts, {
@@ -7868,7 +7899,7 @@ function registerAuthProvidersCommands(program2, globalOpts) {
7868
7899
  const opts = globalOpts();
7869
7900
  const client = await createPlatformClient(opts);
7870
7901
  const result = await client.identity.listAuthProviders({
7871
- enabled: cmdOpts.enabledOnly ? true : void 0
7902
+ where: cmdOpts.enabledOnly ? { enabled: { eq: true } } : void 0
7872
7903
  });
7873
7904
  formatListProto(AuthProviderSchema, result.items, opts, {
7874
7905
  columns: [
@@ -8202,12 +8233,12 @@ function registerHooksCommands(program2, globalOpts) {
8202
8233
  withErrorHandler(globalOpts, async (cmdOpts) => {
8203
8234
  const opts = globalOpts();
8204
8235
  const client = await createPlatformClient(opts);
8205
- let isActive;
8206
- if (cmdOpts.active) isActive = true;
8207
- else if (cmdOpts.inactive) isActive = false;
8236
+ const where = {};
8237
+ if (cmdOpts.event) where.event = { eq: cmdOpts.event };
8238
+ if (cmdOpts.active) where.isActive = { eq: true };
8239
+ else if (cmdOpts.inactive) where.isActive = { eq: false };
8208
8240
  const resp = await client.hooks.listHooks({
8209
- event: cmdOpts.event,
8210
- isActive,
8241
+ where: Object.keys(where).length > 0 ? where : void 0,
8211
8242
  first: cmdOpts.first ? parseInt(String(cmdOpts.first), 10) : void 0,
8212
8243
  after: cmdOpts.after
8213
8244
  });
@@ -8329,9 +8360,10 @@ function registerHooksCommands(program2, globalOpts) {
8329
8360
  async (hookId, cmdOpts) => {
8330
8361
  const opts = globalOpts();
8331
8362
  const client = await createPlatformClient(opts);
8363
+ const where = { hookId: { eq: hookId } };
8364
+ if (cmdOpts.status) where.status = { eq: cmdOpts.status };
8332
8365
  const resp = await client.hooks.listHookDeliveries({
8333
- hookId,
8334
- status: cmdOpts.status,
8366
+ where,
8335
8367
  first: cmdOpts.first ? parseInt(String(cmdOpts.first), 10) : void 0,
8336
8368
  after: cmdOpts.after
8337
8369
  });
@@ -8411,7 +8443,7 @@ function registerRolloutsCommands(program2, globalOpts) {
8411
8443
  const opts = globalOpts();
8412
8444
  const client = await createPlatformClient(opts);
8413
8445
  const { batches } = await client.publishBatches.listPublishBatches({
8414
- status: cmdOpts.status,
8446
+ where: cmdOpts.status ? { status: { eq: cmdOpts.status } } : void 0,
8415
8447
  first: cmdOpts.first ? parseInt(String(cmdOpts.first), 10) : void 0,
8416
8448
  after: cmdOpts.after
8417
8449
  });
@@ -8675,7 +8707,7 @@ function registerLocalesCommands(program2, globalOpts) {
8675
8707
  const opts = globalOpts();
8676
8708
  const client = await createPlatformClient(opts);
8677
8709
  const result = await client.settings.listLocales({
8678
- includeInactive: !!cmdOpts.includeInactive,
8710
+ where: cmdOpts.includeInactive ? void 0 : { isActive: { eq: true } },
8679
8711
  first: parseInt(String(cmdOpts.first ?? "50"), 10)
8680
8712
  });
8681
8713
  formatListProto(LocaleSchema, result.locales, opts, {
@@ -8982,7 +9014,7 @@ function registerVariantCatalogCommands(program2, globalOpts) {
8982
9014
  const opts = globalOpts();
8983
9015
  const client = await createPlatformClient(opts);
8984
9016
  const result = await client.settings.listVariantCatalog({
8985
- isActive: cmdOpts.active ? true : void 0,
9017
+ where: cmdOpts.active ? { isActive: { eq: true } } : void 0,
8986
9018
  first: parseInt(String(cmdOpts.first ?? "50"), 10)
8987
9019
  });
8988
9020
  formatListProto(VariantCatalogEntrySchema, result.entries, opts, {
@@ -9087,10 +9119,12 @@ function registerFilesCommands(program2, globalOpts) {
9087
9119
  withErrorHandler(globalOpts, async (cmdOpts) => {
9088
9120
  const opts = globalOpts();
9089
9121
  const client = await createPlatformClient(opts);
9122
+ const where = {};
9123
+ if (cmdOpts.folder) where.folder = { eq: cmdOpts.folder };
9124
+ if (cmdOpts.mimeType) where.mimeType = { eq: cmdOpts.mimeType };
9125
+ if (cmdOpts.search) where.filename = { contains: cmdOpts.search };
9090
9126
  const data = await client.storage.listFiles({
9091
- folder: cmdOpts.folder,
9092
- mimeType: cmdOpts.mimeType,
9093
- search: cmdOpts.search,
9127
+ where: Object.keys(where).length > 0 ? where : void 0,
9094
9128
  first: parseInt(cmdOpts.first ?? "50", 10),
9095
9129
  after: cmdOpts.after
9096
9130
  });
@@ -9209,9 +9243,13 @@ function registerNotesCommands(program2, globalOpts) {
9209
9243
  withErrorHandler(globalOpts, async (cmdOpts) => {
9210
9244
  const opts = globalOpts();
9211
9245
  const client = await createPlatformClient(opts);
9246
+ const where = {
9247
+ entityType: { eq: cmdOpts.entityType },
9248
+ entityId: { eq: cmdOpts.entityId }
9249
+ };
9250
+ if (!cmdOpts.includeResolved) where.isResolved = { eq: false };
9212
9251
  const data = await client.settings.listNotes({
9213
- entityType: cmdOpts.entityType,
9214
- entityId: cmdOpts.entityId,
9252
+ where,
9215
9253
  first: parseInt(String(cmdOpts.first ?? "20"), 10)
9216
9254
  });
9217
9255
  formatListProto(NoteSchema, data.notes, opts, {
@@ -9309,7 +9347,7 @@ function registerNotificationsCommands(program2, globalOpts) {
9309
9347
  const opts = globalOpts();
9310
9348
  const client = await createPlatformClient(opts);
9311
9349
  const data = await client.notifications.listNotifications({
9312
- unreadOnly: !!cmdOpts.unread,
9350
+ where: cmdOpts.unread ? { isRead: { eq: false } } : void 0,
9313
9351
  first: parseInt(String(cmdOpts.first ?? "20"), 10)
9314
9352
  });
9315
9353
  if (!(opts.json || opts.jsonl || opts.quiet)) {
@@ -9372,9 +9410,11 @@ function registerConfigsCommands(program2, globalOpts) {
9372
9410
  withErrorHandler(globalOpts, async (cmdOpts) => {
9373
9411
  const opts = globalOpts();
9374
9412
  const client = await createPlatformClient(opts);
9413
+ const where = {};
9414
+ if (cmdOpts.type) where.configType = { eq: cmdOpts.type };
9415
+ if (cmdOpts.enabled) where.enabled = { eq: true };
9375
9416
  const data = await client.configs.listConfigs({
9376
- configType: cmdOpts.type,
9377
- enabled: cmdOpts.enabled ? true : void 0,
9417
+ where: Object.keys(where).length > 0 ? where : void 0,
9378
9418
  first: parseInt(String(cmdOpts.first ?? "50"), 10)
9379
9419
  });
9380
9420
  formatListProto(ConfigSchema, data.configs, opts, {
@@ -213,6 +213,67 @@ 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;
272
+ /**
273
+ * Allow the resolver to call an internal (private-network) endpoint.
274
+ * Off by default; only meaningful for QUERY / FIELD operations.
275
+ */
276
+ allowInternalEndpoint?: boolean;
216
277
  }
217
278
  interface ApplyConfigSegmentInput {
218
279
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.38.0",
3
+ "version": "0.40.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.89.0",
53
+ "@eide/foir-proto-ts": "^0.91.0",
54
54
  "chalk": "^5.3.0",
55
55
  "commander": "^12.1.0",
56
56
  "dotenv": "^16.4.5",