@tailor-platform/sdk 1.40.0 → 1.43.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 +58 -0
- package/README.md +23 -0
- package/dist/{actor-B2oEmlTc.d.mts → actor-DzCuoMlP.d.mts} +2 -2
- package/dist/{application-C_LFXkKJ.mjs → application-DQpD_kHR.mjs} +88 -9
- package/dist/application-DQpD_kHR.mjs.map +1 -0
- package/dist/application-DUcmoFdc.mjs +4 -0
- package/dist/brand-Ll48SMXe.mjs.map +1 -1
- package/dist/cli/index.mjs +34 -29
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +49 -7
- package/dist/cli/lib.mjs +4 -4
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/{client-DjGFRjH4.mjs → client-CcV6Jjds.mjs} +8 -5
- package/dist/{client-DjGFRjH4.mjs.map → client-CcV6Jjds.mjs.map} +1 -1
- package/dist/{client-Dtf48x0o.mjs → client-Cn9SqhZT.mjs} +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +83 -3
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-CEIXtw4D.mjs → crash-report-CSYupJ0T.mjs} +1 -1
- package/dist/{crash-report-CSWITsTz.mjs → crash-report-CUbm1ErM.mjs} +2 -2
- package/dist/{crash-report-CSWITsTz.mjs.map → crash-report-CUbm1ErM.mjs.map} +1 -1
- package/dist/{index-Chvw1Eod.d.mts → index-0Dk-fDWi.d.mts} +2 -2
- package/dist/{index-CiNNNpuH.d.mts → index-BEEL1-6Z.d.mts} +2 -2
- package/dist/{index-D_ezppY7.d.mts → index-Br4XCvX1.d.mts} +103 -86
- package/dist/{index-BtXZdz-F.d.mts → index-DdsUV-aA.d.mts} +2 -2
- package/dist/{index-reFAYSX7.d.mts → index-ZZYEd_0R.d.mts} +2 -2
- package/dist/{job-p6zf8Qpg.mjs → job-BOvKyNdT.mjs} +15 -9
- package/dist/job-BOvKyNdT.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{runtime-im7Sq4jO.mjs → runtime-Bn68JXnL.mjs} +199 -79
- package/dist/runtime-Bn68JXnL.mjs.map +1 -0
- package/dist/{tailor-db-field-CoFKRCYW.d.mts → tailor-db-field-D_z185oq.d.mts} +36 -6
- package/dist/utils/test/index.d.mts +36 -3
- package/dist/utils/test/index.mjs +78 -9
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/{workflow.generated-Btz6srLR.d.mts → workflow.generated-CDCnZNkH.d.mts} +2 -2
- package/docs/cli/function.md +83 -1
- package/docs/cli-reference.md +3 -1
- package/docs/services/executor.md +4 -0
- package/docs/services/idp.md +93 -56
- package/docs/services/resolver.md +4 -2
- package/docs/services/workflow.md +117 -3
- package/docs/testing.md +95 -7
- package/package.json +23 -23
- package/dist/application-CEeKm4R-.mjs +0 -4
- package/dist/application-C_LFXkKJ.mjs.map +0 -1
- package/dist/job-p6zf8Qpg.mjs.map +0 -1
- package/dist/runtime-im7Sq4jO.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { $ as ApplicationSchemaUpdateAttemptStatus, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as PageDirection, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Condition_Operator, Y as ConditionSchema, Z as FilterSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as Subgraph_ServiceType, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-
|
|
2
|
+
import { $ as ApplicationSchemaUpdateAttemptStatus, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as PageDirection, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Condition_Operator, Y as ConditionSchema, Z as FilterSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as Subgraph_ServiceType, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-CcV6Jjds.mjs";
|
|
3
3
|
import { t as db } from "./schema-CEcfEyPN.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DTNAMYGy.mjs";
|
|
5
5
|
import { t as readPackageJson } from "./package-json-CWp8s9dE.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { C as loadWorkspaceId, D as writePlatformConfig, S as loadAccessToken, _ as getDistDir, d as buildResolverOperationHookExpr, f as OAuth2ClientSchema, g as createBundleCache, h as loadFilesWithIgnores, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as createExecutorService, t as defineApplication, u as buildExecutorArgsExpr, v as hashFile, w as readPlatformConfig, y as loadConfig } from "./application-DQpD_kHR.mjs";
|
|
7
7
|
import { r as withSpan } from "./telemetry-BuDto_2q.mjs";
|
|
8
8
|
import { n as isCLIError, t as createCLIError } from "./errors-ChWX5ZG8.mjs";
|
|
9
9
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
@@ -963,7 +963,8 @@ var PluginManager = class {
|
|
|
963
963
|
generatePluginFiles(params) {
|
|
964
964
|
const { outputDir, sourceTypeInfoMap, configPath, typeGenerator, executorGenerator } = params;
|
|
965
965
|
const typeGenerationResult = typeGenerator(this.generatedTypes, outputDir);
|
|
966
|
-
|
|
966
|
+
const pluginExecutors = this.getPluginGeneratedExecutorsWithImportPath();
|
|
967
|
+
this.pluginExecutorFiles = executorGenerator(pluginExecutors, outputDir, typeGenerationResult, sourceTypeInfoMap, configPath);
|
|
967
968
|
return this.pluginExecutorFiles;
|
|
968
969
|
}
|
|
969
970
|
/**
|
|
@@ -2350,9 +2351,9 @@ async function applyIdP(client, result, phase = "create-update") {
|
|
|
2350
2351
|
* @returns Planned changes and metadata
|
|
2351
2352
|
*/
|
|
2352
2353
|
async function planIdP(context) {
|
|
2353
|
-
const { client, workspaceId, application, forRemoval, forceApplyAll = false } = context;
|
|
2354
|
+
const { client, workspaceId, application, forRemoval, forceApplyAll = false, hasIdpUserTrigger = false } = context;
|
|
2354
2355
|
const idps = forRemoval ? [] : application.idpServices;
|
|
2355
|
-
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$3(client, workspaceId, application.name, idps);
|
|
2356
|
+
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$3(client, workspaceId, application.name, idps, hasIdpUserTrigger);
|
|
2356
2357
|
return {
|
|
2357
2358
|
changeSet: {
|
|
2358
2359
|
service: serviceChangeSet,
|
|
@@ -2410,6 +2411,7 @@ function normalizeComparableIdPService(input) {
|
|
|
2410
2411
|
}
|
|
2411
2412
|
function normalizeComparablePermission(permission) {
|
|
2412
2413
|
if (!permission) return;
|
|
2414
|
+
if (permission.create.length === 0 && permission.read.length === 0 && permission.update.length === 0 && permission.delete.length === 0 && permission.sendPasswordResetEmail.length === 0) return;
|
|
2413
2415
|
const normalizePolicy = (policy) => ({
|
|
2414
2416
|
conditions: policy.conditions.map((c) => ({
|
|
2415
2417
|
left: c.left ? { kind: c.left.kind } : void 0,
|
|
@@ -2438,7 +2440,7 @@ function areIdPServicesEqual(existing, desired) {
|
|
|
2438
2440
|
permission: normalizeComparablePermission(existing.permission)
|
|
2439
2441
|
}), desired);
|
|
2440
2442
|
}
|
|
2441
|
-
async function planServices$3(client, workspaceId, appName, idps) {
|
|
2443
|
+
async function planServices$3(client, workspaceId, appName, idps, hasIdpUserTrigger) {
|
|
2442
2444
|
const changeSet = createChangeSet("IdP services");
|
|
2443
2445
|
const conflicts = [];
|
|
2444
2446
|
const unmanaged = [];
|
|
@@ -2487,7 +2489,9 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
2487
2489
|
}
|
|
2488
2490
|
const lang = convertLang(idp.lang);
|
|
2489
2491
|
const userAuthPolicy = idp.userAuthPolicy;
|
|
2490
|
-
const publishUserEvents = idp.publishUserEvents ??
|
|
2492
|
+
const publishUserEvents = idp.publishUserEvents ?? hasIdpUserTrigger;
|
|
2493
|
+
if (hasIdpUserTrigger && idp.publishUserEvents === void 0) logger.info(`IdP service "${namespaceName}": automatically enabled "publishUserEvents" because executors with idpUser triggers are defined. Set "publishUserEvents" explicitly to silence this message.`);
|
|
2494
|
+
else if (hasIdpUserTrigger && idp.publishUserEvents === false) logger.warn(`IdP service "${namespaceName}" has "publishUserEvents: false", but executors with idpUser triggers are defined. Those executors will not fire for this IdP. Set "publishUserEvents: true" to enable them.`);
|
|
2491
2495
|
const emailConfig = idp.emailConfig;
|
|
2492
2496
|
if (!idp.permission) logger.warn(`IdP service "${namespaceName}" has no permission configured.`);
|
|
2493
2497
|
const parsedPermission = parseIdPPermission(idp.permission);
|
|
@@ -3957,64 +3961,6 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
3957
3961
|
`);
|
|
3958
3962
|
}
|
|
3959
3963
|
|
|
3960
|
-
//#endregion
|
|
3961
|
-
//#region src/cli/shared/runtime-args.ts
|
|
3962
|
-
/**
|
|
3963
|
-
* Runtime args transformation for all services.
|
|
3964
|
-
*
|
|
3965
|
-
* Each service transforms server-side args/context into SDK-friendly format:
|
|
3966
|
-
* - Executor: server-side expression evaluated by platform before calling function
|
|
3967
|
-
* - Resolver: operationHook expression evaluated by platform before calling function
|
|
3968
|
-
*
|
|
3969
|
-
* The user field mapping (server → SDK) shared across services is defined in
|
|
3970
|
-
* `@/parser/service/tailordb` as `tailorUserMap`.
|
|
3971
|
-
*/
|
|
3972
|
-
/**
|
|
3973
|
-
* Actor field transformation expression.
|
|
3974
|
-
*
|
|
3975
|
-
* Transforms the server's actor object to match the SDK's TailorActor type:
|
|
3976
|
-
* server `attributeMap` → SDK `attributes`
|
|
3977
|
-
* server `attributes` → SDK `attributeList`
|
|
3978
|
-
* other fields → passed through
|
|
3979
|
-
* null/undefined actor → null
|
|
3980
|
-
*/
|
|
3981
|
-
const ACTOR_TRANSFORM_EXPR = "actor: args.actor ? (({ attributeMap, attributes: attrList, ...rest }) => ({ ...rest, attributes: attributeMap, attributeList: attrList }))(args.actor) : null";
|
|
3982
|
-
/**
|
|
3983
|
-
* Build the JavaScript expression that transforms server-format executor event
|
|
3984
|
-
* args into SDK-format args at runtime.
|
|
3985
|
-
*
|
|
3986
|
-
* The Tailor Platform server delivers event args with server-side field names.
|
|
3987
|
-
* The SDK exposes different field names to user code. This function produces a
|
|
3988
|
-
* JavaScript expression string that performs the mapping when evaluated
|
|
3989
|
-
* server-side.
|
|
3990
|
-
* @param triggerKind - The trigger kind discriminant from the parsed executor
|
|
3991
|
-
* @param env - Application env record to embed in the expression
|
|
3992
|
-
* @returns A JavaScript expression string, e.g. `({ ...args, ... })`
|
|
3993
|
-
*/
|
|
3994
|
-
function buildExecutorArgsExpr(triggerKind, env) {
|
|
3995
|
-
const envExpr = `env: ${JSON.stringify(env)}`;
|
|
3996
|
-
switch (triggerKind) {
|
|
3997
|
-
case "schedule": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
|
|
3998
|
-
case "resolverExecuted": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, success: !!args.succeeded, result: args.succeeded?.result.resolver, error: args.failed?.error, ${envExpr} })`;
|
|
3999
|
-
case "incomingWebhook": return `({ ...args, appNamespace: args.namespaceName, rawBody: args.raw_body, ${envExpr} })`;
|
|
4000
|
-
default: return `({ ...args, event: args.eventType?.split(".").pop(), rawEvent: args.eventType, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
|
|
4001
|
-
}
|
|
4002
|
-
}
|
|
4003
|
-
/**
|
|
4004
|
-
* Build the operationHook expression for resolver pipelines.
|
|
4005
|
-
*
|
|
4006
|
-
* Transforms server context to SDK resolver context:
|
|
4007
|
-
* context.args → input
|
|
4008
|
-
* context.pipeline → spread into result
|
|
4009
|
-
* user (global var) → TailorUser (via tailorUserMap: workspace_id→workspaceId, attribute_map→attributes, attributes→attributeList)
|
|
4010
|
-
* env → injected as JSON
|
|
4011
|
-
* @param env - Application env record to embed in the expression
|
|
4012
|
-
* @returns A JavaScript expression string for the operationHook
|
|
4013
|
-
*/
|
|
4014
|
-
function buildResolverOperationHookExpr(env) {
|
|
4015
|
-
return `({ ...context.pipeline, input: context.args, user: ${tailorUserMap}, env: ${JSON.stringify(env)} });`;
|
|
4016
|
-
}
|
|
4017
|
-
|
|
4018
3964
|
//#endregion
|
|
4019
3965
|
//#region src/cli/commands/apply/auth-invoker.ts
|
|
4020
3966
|
/**
|
|
@@ -8512,6 +8458,7 @@ async function apply(options) {
|
|
|
8512
8458
|
const yes = options?.yes ?? false;
|
|
8513
8459
|
const forceApplyAll = await withSpan("plan.detectSdkVersionChange", () => shouldForceApplyAll(client, workspaceId, application, functionEntries));
|
|
8514
8460
|
const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
8461
|
+
const hasIdpUserTrigger = Object.values(application.executorService?.executors ?? {}).some((executor) => executor.trigger.kind === "idpUser");
|
|
8515
8462
|
const ctx = {
|
|
8516
8463
|
client,
|
|
8517
8464
|
workspaceId,
|
|
@@ -8519,7 +8466,8 @@ async function apply(options) {
|
|
|
8519
8466
|
forRemoval: false,
|
|
8520
8467
|
config,
|
|
8521
8468
|
noSchemaCheck: options?.noSchemaCheck,
|
|
8522
|
-
forceApplyAll
|
|
8469
|
+
forceApplyAll,
|
|
8470
|
+
hasIdpUserTrigger
|
|
8523
8471
|
};
|
|
8524
8472
|
const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, functionEntries));
|
|
8525
8473
|
const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
|
|
@@ -8965,7 +8913,7 @@ async function getExecutor(options) {
|
|
|
8965
8913
|
throw error;
|
|
8966
8914
|
}
|
|
8967
8915
|
}
|
|
8968
|
-
const getCommand$
|
|
8916
|
+
const getCommand$6 = defineAppCommand({
|
|
8969
8917
|
name: "get",
|
|
8970
8918
|
description: "Get executor details",
|
|
8971
8919
|
args: z.object({
|
|
@@ -9445,7 +9393,7 @@ async function getWorkflow(options) {
|
|
|
9445
9393
|
throw error;
|
|
9446
9394
|
}
|
|
9447
9395
|
}
|
|
9448
|
-
const getCommand$
|
|
9396
|
+
const getCommand$5 = defineAppCommand({
|
|
9449
9397
|
name: "get",
|
|
9450
9398
|
description: "Get workflow details.",
|
|
9451
9399
|
args: z.object({
|
|
@@ -10074,7 +10022,7 @@ async function listExecutors(options) {
|
|
|
10074
10022
|
return [executors, nextPageToken];
|
|
10075
10023
|
}, { limit: options?.limit })).map((e) => toExecutorListInfo(e));
|
|
10076
10024
|
}
|
|
10077
|
-
const listCommand$
|
|
10025
|
+
const listCommand$9 = defineAppCommand({
|
|
10078
10026
|
name: "list",
|
|
10079
10027
|
description: "List all executors",
|
|
10080
10028
|
args: z.object({
|
|
@@ -10365,6 +10313,157 @@ const webhookCommand = defineCommand({
|
|
|
10365
10313
|
}
|
|
10366
10314
|
});
|
|
10367
10315
|
|
|
10316
|
+
//#endregion
|
|
10317
|
+
//#region src/cli/commands/function/transform.ts
|
|
10318
|
+
const functionRegistryInfo = (fn) => {
|
|
10319
|
+
return {
|
|
10320
|
+
name: fn.name,
|
|
10321
|
+
description: fn.description,
|
|
10322
|
+
sizeBytes: fn.sizeBytes.toString(),
|
|
10323
|
+
contentHash: fn.contentHash,
|
|
10324
|
+
createdAt: formatTimestamp(fn.createdAt),
|
|
10325
|
+
updatedAt: formatTimestamp(fn.updatedAt)
|
|
10326
|
+
};
|
|
10327
|
+
};
|
|
10328
|
+
|
|
10329
|
+
//#endregion
|
|
10330
|
+
//#region src/cli/commands/function/get.ts
|
|
10331
|
+
const getFunctionRegistryOptionsSchema = z.object({
|
|
10332
|
+
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10333
|
+
profile: z.string().optional(),
|
|
10334
|
+
name: z.string().min(1, { message: "name is required" })
|
|
10335
|
+
});
|
|
10336
|
+
async function loadOptions$12(options) {
|
|
10337
|
+
const result = getFunctionRegistryOptionsSchema.safeParse(options);
|
|
10338
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10339
|
+
return {
|
|
10340
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
10341
|
+
useProfile: true,
|
|
10342
|
+
profile: result.data.profile
|
|
10343
|
+
})),
|
|
10344
|
+
workspaceId: await loadWorkspaceId({
|
|
10345
|
+
workspaceId: result.data.workspaceId,
|
|
10346
|
+
profile: result.data.profile
|
|
10347
|
+
}),
|
|
10348
|
+
name: result.data.name
|
|
10349
|
+
};
|
|
10350
|
+
}
|
|
10351
|
+
/**
|
|
10352
|
+
* Get a function registry by name.
|
|
10353
|
+
* @param options - Function registry get options
|
|
10354
|
+
* @returns Function registry info
|
|
10355
|
+
*/
|
|
10356
|
+
async function getFunctionRegistry(options) {
|
|
10357
|
+
const { client, workspaceId, name } = await loadOptions$12(options);
|
|
10358
|
+
const notFoundErrorMessage = `Function registry "${name}" not found.`;
|
|
10359
|
+
try {
|
|
10360
|
+
const response = await client.getFunctionRegistry({
|
|
10361
|
+
workspaceId,
|
|
10362
|
+
name
|
|
10363
|
+
});
|
|
10364
|
+
if (!response.function) throw new Error(notFoundErrorMessage);
|
|
10365
|
+
return functionRegistryInfo(response.function);
|
|
10366
|
+
} catch (error) {
|
|
10367
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(notFoundErrorMessage, { cause: error });
|
|
10368
|
+
throw error;
|
|
10369
|
+
}
|
|
10370
|
+
}
|
|
10371
|
+
const getCommand$4 = defineAppCommand({
|
|
10372
|
+
name: "get",
|
|
10373
|
+
description: "Get a function registry by name",
|
|
10374
|
+
args: z.object({
|
|
10375
|
+
...workspaceArgs,
|
|
10376
|
+
name: arg(z.string(), {
|
|
10377
|
+
description: "Function name",
|
|
10378
|
+
alias: "n"
|
|
10379
|
+
})
|
|
10380
|
+
}).strict(),
|
|
10381
|
+
run: async (args) => {
|
|
10382
|
+
const fn = await getFunctionRegistry({
|
|
10383
|
+
workspaceId: args["workspace-id"],
|
|
10384
|
+
profile: args.profile,
|
|
10385
|
+
name: args.name
|
|
10386
|
+
});
|
|
10387
|
+
const formatted = args.json ? fn : {
|
|
10388
|
+
...fn,
|
|
10389
|
+
createdAt: humanizeRelativeTime(fn.createdAt),
|
|
10390
|
+
updatedAt: humanizeRelativeTime(fn.updatedAt)
|
|
10391
|
+
};
|
|
10392
|
+
logger.out(formatted);
|
|
10393
|
+
}
|
|
10394
|
+
});
|
|
10395
|
+
|
|
10396
|
+
//#endregion
|
|
10397
|
+
//#region src/cli/commands/function/list.ts
|
|
10398
|
+
const listFunctionRegistriesOptionsSchema = z.object({
|
|
10399
|
+
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10400
|
+
profile: z.string().optional(),
|
|
10401
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
10402
|
+
limit: z.coerce.number().int().nonnegative().optional()
|
|
10403
|
+
});
|
|
10404
|
+
async function loadOptions$11(options) {
|
|
10405
|
+
const result = listFunctionRegistriesOptionsSchema.safeParse(options);
|
|
10406
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10407
|
+
return {
|
|
10408
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
10409
|
+
useProfile: true,
|
|
10410
|
+
profile: result.data.profile
|
|
10411
|
+
})),
|
|
10412
|
+
workspaceId: await loadWorkspaceId({
|
|
10413
|
+
workspaceId: result.data.workspaceId,
|
|
10414
|
+
profile: result.data.profile
|
|
10415
|
+
}),
|
|
10416
|
+
order: result.data.order,
|
|
10417
|
+
limit: result.data.limit
|
|
10418
|
+
};
|
|
10419
|
+
}
|
|
10420
|
+
/**
|
|
10421
|
+
* List function registries in a workspace with optional pagination.
|
|
10422
|
+
* @param options - Function registry listing options
|
|
10423
|
+
* @returns List of function registries
|
|
10424
|
+
*/
|
|
10425
|
+
async function listFunctionRegistries(options) {
|
|
10426
|
+
const { client, workspaceId, order, limit } = await loadOptions$11(options);
|
|
10427
|
+
const pageDirection = toPageDirection(order);
|
|
10428
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
10429
|
+
try {
|
|
10430
|
+
const { functions, nextPageToken } = await client.listFunctionRegistries({
|
|
10431
|
+
workspaceId,
|
|
10432
|
+
pageToken,
|
|
10433
|
+
pageSize,
|
|
10434
|
+
sortBy: "updated_at",
|
|
10435
|
+
pageDirection
|
|
10436
|
+
});
|
|
10437
|
+
return [functions, nextPageToken];
|
|
10438
|
+
} catch (error) {
|
|
10439
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
10440
|
+
throw error;
|
|
10441
|
+
}
|
|
10442
|
+
}, { limit })).map(functionRegistryInfo);
|
|
10443
|
+
}
|
|
10444
|
+
const listCommand$8 = defineAppCommand({
|
|
10445
|
+
name: "list",
|
|
10446
|
+
description: "List function registries in a workspace",
|
|
10447
|
+
args: z.object({
|
|
10448
|
+
...workspaceArgs,
|
|
10449
|
+
...paginationArgs()
|
|
10450
|
+
}).strict(),
|
|
10451
|
+
run: async (args) => {
|
|
10452
|
+
const registries = await listFunctionRegistries({
|
|
10453
|
+
workspaceId: args["workspace-id"],
|
|
10454
|
+
profile: args.profile,
|
|
10455
|
+
order: args.order,
|
|
10456
|
+
limit: args.limit
|
|
10457
|
+
});
|
|
10458
|
+
const formatted = args.json ? registries : registries.map(({ createdAt, updatedAt, ...rest }) => ({
|
|
10459
|
+
...rest,
|
|
10460
|
+
createdAt: humanizeRelativeTime(createdAt),
|
|
10461
|
+
updatedAt: humanizeRelativeTime(updatedAt)
|
|
10462
|
+
}));
|
|
10463
|
+
logger.out(formatted);
|
|
10464
|
+
}
|
|
10465
|
+
});
|
|
10466
|
+
|
|
10368
10467
|
//#endregion
|
|
10369
10468
|
//#region src/cli/commands/generate/types.ts
|
|
10370
10469
|
/**
|
|
@@ -12760,7 +12859,7 @@ async function generate(options) {
|
|
|
12760
12859
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
12761
12860
|
let pluginManager;
|
|
12762
12861
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
12763
|
-
const { defineApplication } = await import("./application-
|
|
12862
|
+
const { defineApplication } = await import("./application-DUcmoFdc.mjs");
|
|
12764
12863
|
const application = defineApplication({
|
|
12765
12864
|
config,
|
|
12766
12865
|
pluginManager
|
|
@@ -13273,7 +13372,10 @@ async function loadOptions$9(options) {
|
|
|
13273
13372
|
const result = healthOptionsSchema.safeParse(options);
|
|
13274
13373
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13275
13374
|
return {
|
|
13276
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13375
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13376
|
+
useProfile: true,
|
|
13377
|
+
profile: result.data.profile
|
|
13378
|
+
})),
|
|
13277
13379
|
workspaceId: await loadWorkspaceId({
|
|
13278
13380
|
workspaceId: result.data.workspaceId,
|
|
13279
13381
|
profile: result.data.profile
|
|
@@ -13329,7 +13431,10 @@ async function loadOptions$8(options) {
|
|
|
13329
13431
|
const result = listAppsOptionsSchema.safeParse(options);
|
|
13330
13432
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13331
13433
|
return {
|
|
13332
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13434
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13435
|
+
useProfile: true,
|
|
13436
|
+
profile: result.data.profile
|
|
13437
|
+
})),
|
|
13333
13438
|
workspaceId: await loadWorkspaceId({
|
|
13334
13439
|
workspaceId: result.data.workspaceId,
|
|
13335
13440
|
profile: result.data.profile
|
|
@@ -13587,7 +13692,10 @@ async function loadOptions$6(options) {
|
|
|
13587
13692
|
const result = getWorkspaceOptionsSchema.safeParse(options);
|
|
13588
13693
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13589
13694
|
return {
|
|
13590
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13695
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13696
|
+
useProfile: true,
|
|
13697
|
+
profile: result.data.profile
|
|
13698
|
+
})),
|
|
13591
13699
|
workspaceId: await loadWorkspaceId({
|
|
13592
13700
|
workspaceId: result.data.workspaceId,
|
|
13593
13701
|
profile: result.data.profile
|
|
@@ -13751,7 +13859,10 @@ async function loadOptions$4(options) {
|
|
|
13751
13859
|
const result = inviteUserOptionsSchema.safeParse(options);
|
|
13752
13860
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13753
13861
|
return {
|
|
13754
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13862
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13863
|
+
useProfile: true,
|
|
13864
|
+
profile: result.data.profile
|
|
13865
|
+
})),
|
|
13755
13866
|
workspaceId: await loadWorkspaceId({
|
|
13756
13867
|
workspaceId: result.data.workspaceId,
|
|
13757
13868
|
profile: result.data.profile
|
|
@@ -13806,7 +13917,10 @@ async function loadOptions$3(options) {
|
|
|
13806
13917
|
const result = listUsersOptionsSchema.safeParse(options);
|
|
13807
13918
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13808
13919
|
return {
|
|
13809
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13920
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13921
|
+
useProfile: true,
|
|
13922
|
+
profile: result.data.profile
|
|
13923
|
+
})),
|
|
13810
13924
|
workspaceId: await loadWorkspaceId({
|
|
13811
13925
|
workspaceId: result.data.workspaceId,
|
|
13812
13926
|
profile: result.data.profile
|
|
@@ -13872,7 +13986,10 @@ async function loadOptions$2(options) {
|
|
|
13872
13986
|
const result = removeUserOptionsSchema.safeParse(options);
|
|
13873
13987
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13874
13988
|
return {
|
|
13875
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13989
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13990
|
+
useProfile: true,
|
|
13991
|
+
profile: result.data.profile
|
|
13992
|
+
})),
|
|
13876
13993
|
workspaceId: await loadWorkspaceId({
|
|
13877
13994
|
workspaceId: result.data.workspaceId,
|
|
13878
13995
|
profile: result.data.profile
|
|
@@ -13928,7 +14045,10 @@ async function loadOptions$1(options) {
|
|
|
13928
14045
|
const result = updateUserOptionsSchema.safeParse(options);
|
|
13929
14046
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13930
14047
|
return {
|
|
13931
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
14048
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
14049
|
+
useProfile: true,
|
|
14050
|
+
profile: result.data.profile
|
|
14051
|
+
})),
|
|
13932
14052
|
workspaceId: await loadWorkspaceId({
|
|
13933
14053
|
workspaceId: result.data.workspaceId,
|
|
13934
14054
|
profile: result.data.profile
|
|
@@ -14915,5 +15035,5 @@ function isDeno() {
|
|
|
14915
15035
|
}
|
|
14916
15036
|
|
|
14917
15037
|
//#endregion
|
|
14918
|
-
export { deleteCommand$1 as $,
|
|
14919
|
-
//# sourceMappingURL=runtime-
|
|
15038
|
+
export { deleteCommand$1 as $, getMigrationDirPath as $t, truncate as A, executionsCommand as At, updateOrganization as B, MIGRATION_LABEL_KEY as Bt, listCommand$2 as C, toPageDirection as Cn, jobsCommand as Ct, resumeWorkflow as D, startWorkflow as Dt, resumeCommand as E, startCommand as Et, showCommand as F, getCommand$6 as Ft, getCommand$1 as G, INITIAL_SCHEMA_NUMBER as Gt, treeCommand as H, bundleMigrationScript as Ht, logBetaWarning as I, getExecutor as It, updateFolder as J, compareLocalTypesWithSnapshot as Jt, getOrganization as K, MIGRATE_FILE_NAME as Kt, remove as L, apply as Lt, generate as M, listWorkflowExecutions as Mt, generateCommand as N, functionExecutionStatusToString as Nt, listCommand$3 as O, getCommand$5 as Ot, show as P, formatKeyValueTable as Pt, getFolder as Q, getLatestMigrationNumber as Qt, removeCommand$1 as R, executeScript as Rt, listApps as S, paginationArgs as Sn, getExecutorJob as St, healthCommand as T, watchExecutorJob as Tt, listCommand$4 as U, DB_TYPES_FILE_NAME as Ut, organizationTree as V, parseMigrationLabelNumber as Vt, listOrganizations as W, DIFF_FILE_NAME as Wt, listFolders as X, createSnapshotFromLocalTypes as Xt, listCommand$5 as Y, compareSnapshots as Yt, getCommand$2 as Z, formatMigrationNumber as Zt, getWorkspace as _, commonArgs as _n, webhookCommand as _t, updateUser as a, reconstructSnapshotFromMigrations as an, getCommand$3 as at, createCommand as b, isVerbose as bn, listCommand$9 as bt, listCommand as c, hasChanges as cn, tokenCommand as ct, inviteUser as d, sdkNameLabelKey as dn, generate$1 as dt, getMigrationFilePath as en, deleteFolder as et, restoreCommand as f, trnPrefix as fn, listCommand$8 as ft, getCommand as g, defineAppCommand as gn, listWebhookExecutors as gt, listWorkspaces as h, apiCommand as hn, getFunctionRegistry as ht, updateCommand as i, loadDiff as in, listOAuth2Clients as it, truncateCommand as j, getWorkflowExecution as jt, listWorkflows as k, getWorkflow as kt, listUsers as l, getNamespacesWithMigrations as ln, listCommand$7 as lt, listCommand$1 as m, apiCall as mn, getCommand$4 as mt, query as n, getNextMigrationNumber as nn, createFolder as nt, removeCommand as o, formatDiffSummary as on, getOAuth2Client as ot, restoreWorkspace as p, generateUserTypes as pn, listFunctionRegistries as pt, updateCommand$2 as q, SCHEMA_FILE_NAME as qt, queryCommand as r, isValidMigrationNumber as rn, listCommand$6 as rt, removeUser as s, formatMigrationDiff as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, getMigrationFiles as tn, createCommand$1 as tt, inviteCommand as u, prompt as un, listMachineUsers as ut, deleteCommand as v, confirmationArgs as vn, triggerCommand as vt, getAppHealth as w, workspaceArgs as wn, listExecutorJobs as wt, createWorkspace as x, pagedLogArgs as xn, listExecutors as xt, deleteWorkspace as y, deploymentArgs as yn, triggerExecutor as yt, updateCommand$1 as z, waitForExecution$1 as zt };
|
|
15039
|
+
//# sourceMappingURL=runtime-Bn68JXnL.mjs.map
|