@relyio/cli 0.14.0 → 0.15.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.js +272 -101
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -19960,7 +19960,7 @@ var init_chunk_NJQK5STK = __esm({
|
|
|
19960
19960
|
}
|
|
19961
19961
|
});
|
|
19962
19962
|
|
|
19963
|
-
// ../sdk/dist/chunk-
|
|
19963
|
+
// ../sdk/dist/chunk-EQUZNVAR.js
|
|
19964
19964
|
function readDeadline(raw, now) {
|
|
19965
19965
|
if (raw === void 0 || raw === null || raw === "") return { state: "none" };
|
|
19966
19966
|
if (typeof raw !== "string") return { state: "unreadable" };
|
|
@@ -20022,8 +20022,8 @@ function parseDevEnv(env, now) {
|
|
|
20022
20022
|
}
|
|
20023
20023
|
}
|
|
20024
20024
|
var DEV_CONTEXT_DIR, DEV_CONTEXT_FILENAME, DEV_CONTEXT_FILE, DEV_ENV;
|
|
20025
|
-
var
|
|
20026
|
-
"../sdk/dist/chunk-
|
|
20025
|
+
var init_chunk_EQUZNVAR = __esm({
|
|
20026
|
+
"../sdk/dist/chunk-EQUZNVAR.js"() {
|
|
20027
20027
|
init_chunk_DI6KFDBO();
|
|
20028
20028
|
DEV_CONTEXT_DIR = ".relyio";
|
|
20029
20029
|
DEV_CONTEXT_FILENAME = "dev.json";
|
|
@@ -20075,7 +20075,7 @@ var init_chunk_HDHBYYEY = __esm({
|
|
|
20075
20075
|
}
|
|
20076
20076
|
});
|
|
20077
20077
|
|
|
20078
|
-
// ../sdk/dist/chunk-
|
|
20078
|
+
// ../sdk/dist/chunk-OUR7OUUZ.js
|
|
20079
20079
|
function defineRoute(route) {
|
|
20080
20080
|
if (route.kind === "raw" && route.standardShape === void 0) {
|
|
20081
20081
|
throw new Error("kind 'raw' requires a named StandardShape");
|
|
@@ -20264,8 +20264,8 @@ function contributedFieldKindName(extension, kind) {
|
|
|
20264
20264
|
return `${extension}.${kind}`;
|
|
20265
20265
|
}
|
|
20266
20266
|
var HEADER_END_USER, END_USER_TOKEN_REFUSAL_REASONS, HEADER_RETRY_AFTER, HEADER_IF_MATCH, HEADER_IDEMPOTENCY_KEY, FRESH_PARAMETER, K, rotr, PREVIEW_DATASET_PREFIX, READABLE_MAX, HASH_DIGITS, VISITOR_LIVE_PATH, VISITOR_QUERY, VISITOR_CURSOR, VISITOR_POLL_INTERVAL_MS, VISITOR_KEEPALIVE, VISITOR_FRAMES, VISITOR_CLOSE_CODES, VISITOR_CLOSE_RETRY, VISITOR_POLL_RETRY, VISITOR_ADMISSION_RETRY_AFTER_SECONDS, CHANGE_KINDS, RESYNC_REASONS, FUNCTION_RUN_FAILURES, WEBHOOK_EVENT_ID_HEADER, RESEND_IDEMPOTENCY_HEADER, RESEND_ATTACHMENTS_MAX_BYTES, DEPLOYMENT_SUCCEEDED, STRIPE_EVENT_FIELDS, STRIPE_SUBSCRIPTION_FIELDS, IDENTITY_CLAIMS_SETTING, IDENTITY_CLAIMS_SETTING_FIELD, EXTENSION_SURFACES, CONTRIBUTED_FIELD_KIND_OPTION, EXTENSION_BACKFILL_REFUSALS;
|
|
20267
|
-
var
|
|
20268
|
-
"../sdk/dist/chunk-
|
|
20267
|
+
var init_chunk_OUR7OUUZ = __esm({
|
|
20268
|
+
"../sdk/dist/chunk-OUR7OUUZ.js"() {
|
|
20269
20269
|
init_chunk_DI6KFDBO();
|
|
20270
20270
|
__name(defineRoute, "defineRoute");
|
|
20271
20271
|
__name(refuseMismatchedAlternate, "refuseMismatchedAlternate");
|
|
@@ -20918,7 +20918,7 @@ var init_chunk_T7LGREB3 = __esm({
|
|
|
20918
20918
|
}
|
|
20919
20919
|
});
|
|
20920
20920
|
|
|
20921
|
-
// ../sdk/dist/chunk-
|
|
20921
|
+
// ../sdk/dist/chunk-L42C4G2S.js
|
|
20922
20922
|
function isResourceNotFound(error2) {
|
|
20923
20923
|
return error2 instanceof ResourceNotFoundError;
|
|
20924
20924
|
}
|
|
@@ -21342,15 +21342,25 @@ function readHeaders(options) {
|
|
|
21342
21342
|
if (options.fresh === true) headers["Cache-Control"] = "no-cache";
|
|
21343
21343
|
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
21344
21344
|
}
|
|
21345
|
+
function mimeMatches(fileType, pattern) {
|
|
21346
|
+
const actual = (fileType.split(";")[0] ?? "").trim().toLowerCase();
|
|
21347
|
+
const allowed = (pattern.split(";")[0] ?? "").trim().toLowerCase();
|
|
21348
|
+
if (allowed === "*" || allowed === "*/*") return true;
|
|
21349
|
+
if (allowed === actual) return true;
|
|
21350
|
+
const [allowedType, allowedSubtype] = allowed.split("/");
|
|
21351
|
+
const [actualType] = actual.split("/");
|
|
21352
|
+
return allowedSubtype === "*" && allowedType === actualType;
|
|
21353
|
+
}
|
|
21345
21354
|
function validateFile(file2, constraints = {}) {
|
|
21346
21355
|
const violations = [];
|
|
21347
21356
|
const { allowedMimeTypes, maxSizeBytes } = constraints;
|
|
21348
|
-
|
|
21357
|
+
const { type } = file2;
|
|
21358
|
+
if (allowedMimeTypes && allowedMimeTypes.length > 0 && type != null && type !== "" && !allowedMimeTypes.some((pattern) => mimeMatches(type, pattern))) {
|
|
21349
21359
|
violations.push({
|
|
21350
21360
|
field: "file",
|
|
21351
21361
|
code: "UNSUPPORTED_MIME",
|
|
21352
|
-
message: `Unsupported file type "${
|
|
21353
|
-
value:
|
|
21362
|
+
message: `Unsupported file type "${type}". Allowed: ${allowedMimeTypes.join(", ")}`,
|
|
21363
|
+
value: type
|
|
21354
21364
|
});
|
|
21355
21365
|
}
|
|
21356
21366
|
if (typeof maxSizeBytes === "number" && maxSizeBytes > 0 && typeof file2.size === "number" && file2.size > maxSizeBytes) {
|
|
@@ -22406,12 +22416,12 @@ function randomClientId() {
|
|
|
22406
22416
|
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
22407
22417
|
}
|
|
22408
22418
|
var PUBLISHABLE_KEY_PREFIX, isPublishableKey, PREVIEW_KEY_PREFIX, isPreviewKey, _SDKError, SDKError, _ResourceNotFoundError, ResourceNotFoundError, _ResourceConflictError, ResourceConflictError, _ResourceExpiredError, ResourceExpiredError, _MissingApiKeyError, MissingApiKeyError, _ReadOnlyKeyError, ReadOnlyKeyError, _PublishableKeyRefusedError, PublishableKeyRefusedError, _FunctionRunFailedError, FunctionRunFailedError, _FunctionContainersBusyError, FunctionContainersBusyError, _FunctionRunTimedOutError, FunctionRunTimedOutError, _PlanFeatureUnavailableError, PlanFeatureUnavailableError, _UsageQuotaExceededError, UsageQuotaExceededError, _RateLimitError, RateLimitError, _MethodNotAllowedError, MethodNotAllowedError, _PayloadTooLargeError, PayloadTooLargeError, _TransactionRolledBackError, TransactionRolledBackError, _ServiceIndeterminateError, ServiceIndeterminateError, _ServerError, ServerError, _UnknownContractError, UnknownContractError, _AuthorizationError, AuthorizationError, _InvalidApiKeyError, InvalidApiKeyError, _EndUserTokenInvalidError, EndUserTokenInvalidError, _NetworkError, NetworkError, _TimeoutError, TimeoutError, _ConnectionError, ConnectionError, _BaseValidationError, BaseValidationError, _ValidationError, ValidationError, _InvalidPayloadError, InvalidPayloadError, _a50, ContractBodyError, STALE_VERSION_GUIDANCE, _ErrorMapper, ErrorMapper, DECLARED_PATHS, COMPILED_ROUTES, IDEMPOTENT_METHODS, UNREACHABLE_CODES, _DefaultRetryPolicy, DefaultRetryPolicy, derived, unknown, announced, MAX_TIMER_DELAY_MS, _HttpClient, HttpClient, _ControlledHttpClient, ControlledHttpClient, API_KEY_HEADER, DATASET_HEADER, END_USER_HEADER, BROWSER_CONTROLLED_HEADERS, _EntryHandle, EntryHandle, _ContentClient, ContentClient, _FileUploadError, FileUploadError, _FileValidationError, FileValidationError, FILE_ERROR_CODES, _AssetFileBuilder, AssetFileBuilder, _AssetUploadBuilder, AssetUploadBuilder, _AssetClient, AssetClient, _DocumentHandle, DocumentHandle, _SingletonClient, SingletonClient, _SettingsClient, SettingsClient, _RecordsClient, RecordsClient, OPERATION_PATH, CHANGES_POLL_TIMEOUT_MS, EXPIRED_REASONS2, _ChangesExpiredError, ChangesExpiredError, _LiveEdgeError, LiveEdgeError, LIVE_EDGE_OF_API, HTTP_SCHEME_OF, LIVE_KEEPALIVE_INTERVAL_MS, LIVE_SOCKET_OPEN_TIMEOUT_MS, LIVE_POLLS_BEFORE_SOCKET, SOCKET_CONNECTING, SOCKET_OPEN, AFTER_A_CLOSE, CLOSE_MEANING, NEEDS_PUBLISHABLE_KEY, FUNCTION_CALL_TIMEOUT_MS, VERBS, DEFAULT_CONFIG, devOverrideNotified, previewNotified, _TypedRelyIOClient, TypedRelyIOClient;
|
|
22409
|
-
var
|
|
22410
|
-
"../sdk/dist/chunk-
|
|
22419
|
+
var init_chunk_L42C4G2S = __esm({
|
|
22420
|
+
"../sdk/dist/chunk-L42C4G2S.js"() {
|
|
22411
22421
|
init_chunk_NJQK5STK();
|
|
22412
|
-
|
|
22422
|
+
init_chunk_EQUZNVAR();
|
|
22413
22423
|
init_chunk_HDHBYYEY();
|
|
22414
|
-
|
|
22424
|
+
init_chunk_OUR7OUUZ();
|
|
22415
22425
|
init_chunk_DI6KFDBO();
|
|
22416
22426
|
PUBLISHABLE_KEY_PREFIX = "rly_pub_";
|
|
22417
22427
|
isPublishableKey = /* @__PURE__ */ __name((apiKey) => apiKey?.startsWith(PUBLISHABLE_KEY_PREFIX) === true, "isPublishableKey");
|
|
@@ -23935,6 +23945,7 @@ var init_chunk_356SF5Y2 = __esm({
|
|
|
23935
23945
|
};
|
|
23936
23946
|
__name(_ContentClient, "ContentClient");
|
|
23937
23947
|
ContentClient = _ContentClient;
|
|
23948
|
+
__name(mimeMatches, "mimeMatches");
|
|
23938
23949
|
_FileUploadError = class _FileUploadError2 extends SDKError {
|
|
23939
23950
|
constructor(code19, message, options = {}) {
|
|
23940
23951
|
super(message, options.statusCode, options.cause, { ...options.context, fileErrorCode: code19 });
|
|
@@ -25827,9 +25838,9 @@ function snapToLadder(value) {
|
|
|
25827
25838
|
var FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, FOLLOW_BACK_OFF_MAX_MS, LOCALE_STATUS_PUBLISHED, IMAGE_LADDER;
|
|
25828
25839
|
var init_dist2 = __esm({
|
|
25829
25840
|
"../sdk/dist/index.js"() {
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25841
|
+
init_chunk_L42C4G2S();
|
|
25842
|
+
init_chunk_L42C4G2S();
|
|
25843
|
+
init_chunk_OUR7OUUZ();
|
|
25833
25844
|
init_chunk_DI6KFDBO();
|
|
25834
25845
|
FOLLOW_RETRY_BASE_MS = 1e3;
|
|
25835
25846
|
FOLLOW_RETRY_MAX_MS = 3e4;
|
|
@@ -25862,9 +25873,9 @@ var init_dist2 = __esm({
|
|
|
25862
25873
|
}
|
|
25863
25874
|
});
|
|
25864
25875
|
|
|
25865
|
-
// ../../platform/api-contract/dist/chunk-
|
|
25866
|
-
var
|
|
25867
|
-
"../../platform/api-contract/dist/chunk-
|
|
25876
|
+
// ../../platform/api-contract/dist/chunk-4KRF3DVJ.js
|
|
25877
|
+
var init_chunk_4KRF3DVJ = __esm({
|
|
25878
|
+
"../../platform/api-contract/dist/chunk-4KRF3DVJ.js"() {
|
|
25868
25879
|
}
|
|
25869
25880
|
});
|
|
25870
25881
|
|
|
@@ -26254,7 +26265,7 @@ function readError2(body) {
|
|
|
26254
26265
|
var ContractBodyError2;
|
|
26255
26266
|
var init_client = __esm({
|
|
26256
26267
|
"../../platform/api-contract/dist/client/index.js"() {
|
|
26257
|
-
|
|
26268
|
+
init_chunk_4KRF3DVJ();
|
|
26258
26269
|
init_chunk_VFXRYMMX();
|
|
26259
26270
|
ContractBodyError2 = class extends Error {
|
|
26260
26271
|
body;
|
|
@@ -41912,7 +41923,7 @@ var init_dist3 = __esm({
|
|
|
41912
41923
|
init_chunk_6JGYNMIT();
|
|
41913
41924
|
init_chunk_OWKTFXBY();
|
|
41914
41925
|
init_chunk_J2UAM3VR();
|
|
41915
|
-
|
|
41926
|
+
init_chunk_4KRF3DVJ();
|
|
41916
41927
|
init_chunk_VFXRYMMX();
|
|
41917
41928
|
init_chunk_46347LG2();
|
|
41918
41929
|
HEADER_RETRY_AFTER2 = { name: "Retry-After" };
|
|
@@ -41940,6 +41951,12 @@ var init_dist3 = __esm({
|
|
|
41940
41951
|
"output-invalid"
|
|
41941
41952
|
];
|
|
41942
41953
|
new Set(FUNCTION_RUN_FAILURES2);
|
|
41954
|
+
[
|
|
41955
|
+
"running",
|
|
41956
|
+
"succeeded",
|
|
41957
|
+
...FUNCTION_RUN_FAILURES2,
|
|
41958
|
+
"lost"
|
|
41959
|
+
];
|
|
41943
41960
|
GITHUB_INSTALLATION_EVENTS = ["installation", "installation_repositories"];
|
|
41944
41961
|
GITHUB_REPOSITORY_EVENTS = [
|
|
41945
41962
|
"push",
|
|
@@ -52302,7 +52319,7 @@ var init_extensions = __esm({
|
|
|
52302
52319
|
"../sdk/dist/extensions/index.js"() {
|
|
52303
52320
|
init_chunk_W2GRVXDG();
|
|
52304
52321
|
init_chunk_PZCDJFMA();
|
|
52305
|
-
|
|
52322
|
+
init_chunk_OUR7OUUZ();
|
|
52306
52323
|
init_chunk_DI6KFDBO();
|
|
52307
52324
|
DECLARED = "declared";
|
|
52308
52325
|
SURFACES = EXTENSION_SURFACES;
|
|
@@ -52360,13 +52377,6 @@ async function getSchemaStatus(projectId, branchId, localSchema) {
|
|
|
52360
52377
|
)
|
|
52361
52378
|
);
|
|
52362
52379
|
}
|
|
52363
|
-
async function getCurrentSchema(projectId, branchId) {
|
|
52364
|
-
return readPayload2(
|
|
52365
|
-
await client_default.get(
|
|
52366
|
-
`/projects/${projectId}/branches/${branchId}/schema`
|
|
52367
|
-
)
|
|
52368
|
-
);
|
|
52369
|
-
}
|
|
52370
52380
|
async function getAdaptationStatus(projectId, branchId) {
|
|
52371
52381
|
return readPayload2(
|
|
52372
52382
|
await client_default.get(
|
|
@@ -52374,16 +52384,10 @@ async function getAdaptationStatus(projectId, branchId) {
|
|
|
52374
52384
|
)
|
|
52375
52385
|
);
|
|
52376
52386
|
}
|
|
52377
|
-
var schema_default;
|
|
52378
52387
|
var init_schema = __esm({
|
|
52379
52388
|
"src/api/schema.ts"() {
|
|
52380
52389
|
init_client2();
|
|
52381
52390
|
init_wire();
|
|
52382
|
-
schema_default = {
|
|
52383
|
-
getSchemaStatus,
|
|
52384
|
-
getCurrentSchema,
|
|
52385
|
-
getAdaptationStatus
|
|
52386
|
-
};
|
|
52387
52391
|
}
|
|
52388
52392
|
});
|
|
52389
52393
|
|
|
@@ -52539,31 +52543,46 @@ async function declarationOf(absolute) {
|
|
|
52539
52543
|
}
|
|
52540
52544
|
return { declaration: definition.declaration };
|
|
52541
52545
|
}
|
|
52542
|
-
async function
|
|
52543
|
-
const
|
|
52546
|
+
async function readFunctionFiles(projectRoot, then) {
|
|
52547
|
+
const read = [];
|
|
52544
52548
|
const errors = [];
|
|
52545
52549
|
for (const file2 of functionFiles(projectRoot)) {
|
|
52546
52550
|
const item = itemAt(file2);
|
|
52547
52551
|
if (item === void 0) continue;
|
|
52548
52552
|
try {
|
|
52549
|
-
const
|
|
52550
|
-
if ("error" in
|
|
52551
|
-
errors.push({ file: file2, error:
|
|
52553
|
+
const declared = await declarationOf(path7.join(projectRoot, file2));
|
|
52554
|
+
if ("error" in declared) {
|
|
52555
|
+
errors.push({ file: file2, error: declared.error });
|
|
52552
52556
|
continue;
|
|
52553
52557
|
}
|
|
52554
|
-
|
|
52555
|
-
functions.push({
|
|
52556
|
-
name: item.name,
|
|
52557
|
-
file: file2,
|
|
52558
|
-
declaration: read.declaration,
|
|
52559
|
-
bundle,
|
|
52560
|
-
bundleHash: bundleHashOf(bundle)
|
|
52561
|
-
});
|
|
52558
|
+
read.push(await then({ name: item.name, file: file2, declaration: declared.declaration }));
|
|
52562
52559
|
} catch (error2) {
|
|
52563
52560
|
errors.push({ file: file2, error: error2 instanceof Error ? error2.message : String(error2) });
|
|
52564
52561
|
}
|
|
52565
52562
|
}
|
|
52566
|
-
return {
|
|
52563
|
+
return { read, errors };
|
|
52564
|
+
}
|
|
52565
|
+
async function loadFunctions(projectRoot) {
|
|
52566
|
+
const { read, errors } = await readFunctionFiles(projectRoot, async (declared) => {
|
|
52567
|
+
const bundle = await bundleOf(projectRoot, declared.file, declared.declaration.runtime);
|
|
52568
|
+
return { ...declared, bundle, bundleHash: bundleHashOf(bundle) };
|
|
52569
|
+
});
|
|
52570
|
+
return { functions: read, errors };
|
|
52571
|
+
}
|
|
52572
|
+
async function loadFunctionDeclarations(projectRoot) {
|
|
52573
|
+
const { read, errors } = await readFunctionFiles(projectRoot, async (declared) => declared);
|
|
52574
|
+
return { functions: read, errors };
|
|
52575
|
+
}
|
|
52576
|
+
function functionsIrOf(declared) {
|
|
52577
|
+
return Object.fromEntries(
|
|
52578
|
+
declared.map(({ name, declaration }) => [
|
|
52579
|
+
name,
|
|
52580
|
+
{
|
|
52581
|
+
input: declaration.input,
|
|
52582
|
+
...declaration.output === void 0 ? {} : { output: declaration.output }
|
|
52583
|
+
}
|
|
52584
|
+
])
|
|
52585
|
+
);
|
|
52567
52586
|
}
|
|
52568
52587
|
var CONTAINER_REQUIRE_BANNER;
|
|
52569
52588
|
var init_functions_loader = __esm({
|
|
@@ -53125,12 +53144,8 @@ async function run(options) {
|
|
|
53125
53144
|
const manifest = await readManifest(options.projectRoot);
|
|
53126
53145
|
if ("code" in manifest) return failed(manifest);
|
|
53127
53146
|
try {
|
|
53128
|
-
|
|
53129
|
-
|
|
53130
|
-
branchName,
|
|
53131
|
-
branchId,
|
|
53132
|
-
plan: await planManifest(projectId, branchId, manifest)
|
|
53133
|
-
};
|
|
53147
|
+
const { deploy, ...plan } = await planManifest(projectId, branchId, manifest);
|
|
53148
|
+
return { status: "ok", branchName, branchId, plan, deploy };
|
|
53134
53149
|
} catch (error2) {
|
|
53135
53150
|
return failed(apiError(error2));
|
|
53136
53151
|
}
|
|
@@ -53449,7 +53464,7 @@ var init_deploy_service = __esm({
|
|
|
53449
53464
|
// ../sdk/dist/dev-handshake/index.js
|
|
53450
53465
|
var init_dev_handshake = __esm({
|
|
53451
53466
|
"../sdk/dist/dev-handshake/index.js"() {
|
|
53452
|
-
|
|
53467
|
+
init_chunk_EQUZNVAR();
|
|
53453
53468
|
}
|
|
53454
53469
|
});
|
|
53455
53470
|
function planPathLabel(path32) {
|
|
@@ -53623,6 +53638,25 @@ function formatManifestPlan(plan) {
|
|
|
53623
53638
|
);
|
|
53624
53639
|
return lines.join("\n");
|
|
53625
53640
|
}
|
|
53641
|
+
function formatDeployNote(deploy) {
|
|
53642
|
+
switch (deploy.outcome) {
|
|
53643
|
+
case "allowed": {
|
|
53644
|
+
return chalk12.gray(`Deploying it from here: ${deploy.note}`);
|
|
53645
|
+
}
|
|
53646
|
+
case "refused": {
|
|
53647
|
+
return chalk12.yellow(`Deploying it from here would be refused: ${deploy.note}`);
|
|
53648
|
+
}
|
|
53649
|
+
case "indeterminate": {
|
|
53650
|
+
return chalk12.yellow(
|
|
53651
|
+
`Whether deploying it from here would be refused is unknown: ${deploy.note}`
|
|
53652
|
+
);
|
|
53653
|
+
}
|
|
53654
|
+
default: {
|
|
53655
|
+
const unhandled = deploy;
|
|
53656
|
+
throw new Error(`Unhandled deploy note ${JSON.stringify(unhandled)}`);
|
|
53657
|
+
}
|
|
53658
|
+
}
|
|
53659
|
+
}
|
|
53626
53660
|
function confirmationLine(plan) {
|
|
53627
53661
|
if (!plan.needsConfirmation) return "Nothing deletes or rewrites data.";
|
|
53628
53662
|
const count3 = plan.areas.flatMap((area) => area.lines).filter((line) => line.deletesOrRewritesData).length;
|
|
@@ -53748,7 +53782,7 @@ var init_dist6 = __esm({
|
|
|
53748
53782
|
}
|
|
53749
53783
|
});
|
|
53750
53784
|
|
|
53751
|
-
// ../codegen-typescript/dist/chunk-
|
|
53785
|
+
// ../codegen-typescript/dist/chunk-TPUN4ZUQ.js
|
|
53752
53786
|
function isRecord8(value) {
|
|
53753
53787
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53754
53788
|
}
|
|
@@ -53812,12 +53846,12 @@ function policyReference(test, literal4) {
|
|
|
53812
53846
|
);
|
|
53813
53847
|
return plain ? `conditionRoot(${literal4(test.root)})${test.path.map((segment) => `.${segment}`).join("")}` : `conditionRoot(${literal4(test.root)}, ${literal4(test.path)})`;
|
|
53814
53848
|
}
|
|
53815
|
-
async function generateTypeScript(rawSchema, options
|
|
53849
|
+
async function generateTypeScript(rawSchema, options, format2) {
|
|
53816
53850
|
const generator = new TypeScriptGenerator(parseSchema(rawSchema), options, format2);
|
|
53817
53851
|
const content = await generator.generate();
|
|
53818
53852
|
return { content, warnings: generator.warnings };
|
|
53819
53853
|
}
|
|
53820
|
-
async function generateTypeScriptFromSchema(rawSchema, options
|
|
53854
|
+
async function generateTypeScriptFromSchema(rawSchema, options, format2) {
|
|
53821
53855
|
const parsedSchema = parseSchema(rawSchema);
|
|
53822
53856
|
const generator = new TypeScriptGenerator(parsedSchema, options, format2);
|
|
53823
53857
|
return generator.generate();
|
|
@@ -53877,8 +53911,8 @@ function collectFieldsets(elements) {
|
|
|
53877
53911
|
return collected;
|
|
53878
53912
|
}
|
|
53879
53913
|
var SchemaParser, SchemaValidator2, TEST_NAMES3, FLAG_TESTS, BARE_TESTS, EXTENSIONS_IMPORT, IDENTITY_KEYS, KEYED_FIELD_OPTIONS2, CONFIG_WRITTEN_AS, TypeScriptGenerator, SCHEMA_PRINT_OPTIONS;
|
|
53880
|
-
var
|
|
53881
|
-
"../codegen-typescript/dist/chunk-
|
|
53914
|
+
var init_chunk_TPUN4ZUQ = __esm({
|
|
53915
|
+
"../codegen-typescript/dist/chunk-TPUN4ZUQ.js"() {
|
|
53882
53916
|
init_dist4();
|
|
53883
53917
|
init_dist6();
|
|
53884
53918
|
init_dist4();
|
|
@@ -54312,6 +54346,8 @@ ${prefix}: ${error2.path}`, ` ${error2.message}`);
|
|
|
54312
54346
|
this.addQueries();
|
|
54313
54347
|
this.addSchemaExport();
|
|
54314
54348
|
this.addTypeExports();
|
|
54349
|
+
const functions = this.addFunctions();
|
|
54350
|
+
this.addRegisterAugmentation(functions);
|
|
54315
54351
|
this.addImports(importsAt);
|
|
54316
54352
|
this.assertNoNameIsDeclaredTwice();
|
|
54317
54353
|
this.warnings = this.differences();
|
|
@@ -54477,7 +54513,13 @@ import type {} from '@relyio/sdk'
|
|
|
54477
54513
|
...[...this.schema.assetTypes.values()].map((element) => element.source),
|
|
54478
54514
|
...[...this.schema.singletons.values()].map((element) => element.source),
|
|
54479
54515
|
...[...this.schema.settingsGroups.values()].map((element) => element.source),
|
|
54480
|
-
...[...this.schema.recordTypes.values()].map((element) => element.source)
|
|
54516
|
+
...[...this.schema.recordTypes.values()].map((element) => element.source),
|
|
54517
|
+
// A Function's input and output place fieldsets as an element's fields do (REL-4059): one
|
|
54518
|
+
// const per id across the whole file
|
|
54519
|
+
...this.functionsInOrder().flatMap(([, fn]) => [
|
|
54520
|
+
{ fields: [...fn.input] },
|
|
54521
|
+
...fn.output === void 0 ? [] : [{ fields: [...fn.output] }]
|
|
54522
|
+
])
|
|
54481
54523
|
]);
|
|
54482
54524
|
if (this.fieldsets.size === 0) return;
|
|
54483
54525
|
this.output.push(`// ============================================================================
|
|
@@ -55287,11 +55329,56 @@ export type ${this.declare("SchemaTypes", "type", "the SchemaTypes export")} = t
|
|
|
55287
55329
|
);
|
|
55288
55330
|
}
|
|
55289
55331
|
this.output.push(lines.join("\n"), "");
|
|
55290
|
-
|
|
55332
|
+
}
|
|
55333
|
+
/**
|
|
55334
|
+
* The project's Functions in name order (REL-4059), sorted so the same Functions write the same
|
|
55335
|
+
* bytes, which `relyio ci` compares.
|
|
55336
|
+
*/
|
|
55337
|
+
functionsInOrder() {
|
|
55338
|
+
return Object.entries(this.options.functions).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
55339
|
+
}
|
|
55340
|
+
/**
|
|
55341
|
+
* Each Function's Fields as a const (REL-4059): its input — and its output, when it declares one —
|
|
55342
|
+
* as the keyed record its file declares, `{ cartId: fields.shortText({ required: true }) }`,
|
|
55343
|
+
* written by the field emitter every schema element's fields are. {@link addRegisterAugmentation}
|
|
55344
|
+
* registers each under the Function's name, so `relyio.functions.<name>(input)` takes and answers
|
|
55345
|
+
* what they declare. Answers each name beside its const; none when the project declares none.
|
|
55346
|
+
*/
|
|
55347
|
+
addFunctions() {
|
|
55348
|
+
const functions = this.functionsInOrder();
|
|
55349
|
+
if (functions.length === 0) return [];
|
|
55350
|
+
this.output.push(`// ============================================================================
|
|
55351
|
+
// \u26A1 Functions (what \`relyio.functions.<name>(input)\` takes and answers)
|
|
55352
|
+
// ============================================================================
|
|
55353
|
+
`);
|
|
55354
|
+
return functions.map(([name, fn]) => {
|
|
55355
|
+
const source = `Function '${name}'`;
|
|
55356
|
+
const varName = this.declare(`${naming.camel(name)}Function`, "value", source);
|
|
55357
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(varName)) {
|
|
55358
|
+
throw new Error(
|
|
55359
|
+
`${source} has no name a TypeScript const can be derived from: a Function's name is a letter, then letters, digits, '_' or '-'`
|
|
55360
|
+
);
|
|
55361
|
+
}
|
|
55362
|
+
const entries2 = [`input: ${this.fieldRecord([...fn.input], `${source}'s input`)}`];
|
|
55363
|
+
if (fn.output !== void 0) {
|
|
55364
|
+
entries2.push(`output: ${this.fieldRecord([...fn.output], `${source}'s output`)}`);
|
|
55365
|
+
}
|
|
55366
|
+
this.output.push(
|
|
55367
|
+
[
|
|
55368
|
+
`/** The Fields of the Function \`${name}\`, as \`relyio/functions/${name}.ts\` declares them */`,
|
|
55369
|
+
`const ${varName} = { ${entries2.join(", ")} }`
|
|
55370
|
+
].join("\n"),
|
|
55371
|
+
""
|
|
55372
|
+
);
|
|
55373
|
+
return { name, varName };
|
|
55374
|
+
});
|
|
55291
55375
|
}
|
|
55292
55376
|
/**
|
|
55293
55377
|
* Register this schema with the SDK, so `createClient({ apiKey })` is typed with no generic and no
|
|
55294
|
-
* `schema:` (`INV-SS-TYPES-INFERRED`, `sdk-surfaces-spec.md` decision 7)
|
|
55378
|
+
* `schema:` (`INV-SS-TYPES-INFERRED`, `sdk-surfaces-spec.md` decision 7), and the project's
|
|
55379
|
+
* Functions beside it (REL-4059): `functions` names each one's Fields, so `relyio.functions` holds
|
|
55380
|
+
* exactly those names and each call is typed by them. A project declaring no Function registers no
|
|
55381
|
+
* `functions`, and the accessor stays untyped.
|
|
55295
55382
|
*
|
|
55296
55383
|
* It is emitted into this same file rather than a second one: the augmentation takes effect
|
|
55297
55384
|
* wherever `schema.ts` is part of the program. It needs `'@relyio/sdk'` itself in the program too,
|
|
@@ -55300,12 +55387,16 @@ export type ${this.declare("SchemaTypes", "type", "the SchemaTypes export")} = t
|
|
|
55300
55387
|
* '@relyio/sdk' cannot be found") even though the name resolves. Two generated files augmenting
|
|
55301
55388
|
* `Register` in one program conflict on `schema` (TS2717); one program registers one schema.
|
|
55302
55389
|
*/
|
|
55303
|
-
addRegisterAugmentation() {
|
|
55304
|
-
|
|
55390
|
+
addRegisterAugmentation(functions) {
|
|
55391
|
+
const registered = functions.length === 0 ? "" : ` functions: {
|
|
55392
|
+
${functions.map(({ name, varName }) => ` ${this.propertyKey(name)}: typeof ${varName}
|
|
55393
|
+
`).join("")} }
|
|
55394
|
+
`;
|
|
55395
|
+
this.output.push(`// Registers this schema with the SDK: \`createClient({ apiKey })\` is typed by it${functions.length === 0 ? "" : ", and `relyio.functions` by its Functions"}
|
|
55305
55396
|
declare module '@relyio/sdk' {
|
|
55306
55397
|
interface Register {
|
|
55307
55398
|
schema: typeof schema
|
|
55308
|
-
}
|
|
55399
|
+
${registered} }
|
|
55309
55400
|
}
|
|
55310
55401
|
`);
|
|
55311
55402
|
}
|
|
@@ -55492,14 +55583,17 @@ async function writeExtensionsSource(declared, format2) {
|
|
|
55492
55583
|
if (format2 === void 0) return { content: source, warnings };
|
|
55493
55584
|
return { content: await format2(source), warnings };
|
|
55494
55585
|
}
|
|
55495
|
-
async function generateTypeScript2(rawSchema, options
|
|
55586
|
+
async function generateTypeScript2(rawSchema, options) {
|
|
55496
55587
|
return generateTypeScript(rawSchema, options, formatWithPrettier);
|
|
55497
55588
|
}
|
|
55498
|
-
async function generateTypeScriptFromSchema2(rawSchema, options
|
|
55589
|
+
async function generateTypeScriptFromSchema2(rawSchema, options) {
|
|
55499
55590
|
return generateTypeScriptFromSchema(rawSchema, options, formatWithPrettier);
|
|
55500
55591
|
}
|
|
55501
55592
|
async function exportSchemaSource(definition) {
|
|
55502
|
-
return generateTypeScript2(
|
|
55593
|
+
return generateTypeScript2(
|
|
55594
|
+
{ data: withoutManagedRecordTypes(definition) },
|
|
55595
|
+
{ purpose: "export", functions: {} }
|
|
55596
|
+
);
|
|
55503
55597
|
}
|
|
55504
55598
|
function withoutManagedRecordTypes(definition) {
|
|
55505
55599
|
const { recordTypes } = definition;
|
|
@@ -55519,7 +55613,7 @@ async function exportExtensionsSource(declared) {
|
|
|
55519
55613
|
var SDK_AUTOMATIONS, BUILDERS, EXTENSIONS, RESERVED2, SHORTHAND_OPERATORS, HANDLES, IN_STEPS, EVENT_ONLY, WHERE_BECOMES, AutomationWriter, SDK_EXTENSIONS, formatWithPrettier, plugin, index_default;
|
|
55520
55614
|
var init_dist7 = __esm({
|
|
55521
55615
|
"../codegen-typescript/dist/index.js"() {
|
|
55522
|
-
|
|
55616
|
+
init_chunk_TPUN4ZUQ();
|
|
55523
55617
|
init_dist6();
|
|
55524
55618
|
init_dist3();
|
|
55525
55619
|
init_dist5();
|
|
@@ -55603,7 +55697,10 @@ var init_dist7 = __esm({
|
|
|
55603
55697
|
const steps = automationStepsInOrder(this.definition.steps);
|
|
55604
55698
|
const agents = steps.filter((step) => step.kind === "agent");
|
|
55605
55699
|
if (agents.length > 0) {
|
|
55606
|
-
const generator = new TypeScriptGenerator(parseSchema({}), {
|
|
55700
|
+
const generator = new TypeScriptGenerator(parseSchema({}), {
|
|
55701
|
+
purpose: "export",
|
|
55702
|
+
functions: {}
|
|
55703
|
+
});
|
|
55607
55704
|
const written = generator.keyedFieldRecords(
|
|
55608
55705
|
agents.map((agent) => ({ fields: agent.output, owner: `step '${agent.name}'` })),
|
|
55609
55706
|
file2
|
|
@@ -56063,12 +56160,14 @@ ${declarations.map((line) => ` ${line}`).join("\n")}
|
|
|
56063
56160
|
};
|
|
56064
56161
|
plugin = {
|
|
56065
56162
|
language: "typescript",
|
|
56066
|
-
async generate(ir, options) {
|
|
56163
|
+
async generate(ir, options, functions) {
|
|
56067
56164
|
const { content, warnings } = await generateTypeScript2(
|
|
56068
56165
|
{ data: ir },
|
|
56069
56166
|
{
|
|
56070
56167
|
...options,
|
|
56071
|
-
fileName: options.fileName || "schema.ts"
|
|
56168
|
+
fileName: options.fileName || "schema.ts",
|
|
56169
|
+
// The project's Functions, registered beside the schema (REL-4059)
|
|
56170
|
+
functions
|
|
56072
56171
|
}
|
|
56073
56172
|
);
|
|
56074
56173
|
return {
|
|
@@ -57529,6 +57628,9 @@ _resolve_postponed_annotations()
|
|
|
57529
57628
|
`;
|
|
57530
57629
|
plugin2 = {
|
|
57531
57630
|
language: "python",
|
|
57631
|
+
// The Functions are not read: no Python client calls one, so no Python type is a Function call's.
|
|
57632
|
+
// A model of each Function's input and output, for a caller of `POST /v1/functions/{name}`, is
|
|
57633
|
+
// not built (REL-4059 typed the TypeScript SDK's call only)
|
|
57532
57634
|
async generate(ir, options) {
|
|
57533
57635
|
return generatePython(ir, options);
|
|
57534
57636
|
}
|
|
@@ -61256,7 +61358,7 @@ var init_banner = __esm({
|
|
|
61256
61358
|
init_dev_cockpit_context();
|
|
61257
61359
|
init_dev_cockpit_format();
|
|
61258
61360
|
init_startup_info();
|
|
61259
|
-
CLI_VERSION2 = "0.
|
|
61361
|
+
CLI_VERSION2 = "0.15.0" ;
|
|
61260
61362
|
BRAND_GLYPH = "\u25B6";
|
|
61261
61363
|
BRAND_NAME = "RelyIO";
|
|
61262
61364
|
LABEL_WIDTH = 9;
|
|
@@ -69396,8 +69498,6 @@ init_config();
|
|
|
69396
69498
|
// src/commands/promote.ts
|
|
69397
69499
|
init_manage();
|
|
69398
69500
|
init_manage_error();
|
|
69399
|
-
init_manifest();
|
|
69400
|
-
init_schema();
|
|
69401
69501
|
|
|
69402
69502
|
// src/api/sandbox.ts
|
|
69403
69503
|
init_client2();
|
|
@@ -69456,6 +69556,14 @@ async function promoteSandbox(projectId, branchId, body) {
|
|
|
69456
69556
|
)
|
|
69457
69557
|
);
|
|
69458
69558
|
}
|
|
69559
|
+
async function planPromote(projectId, branchId, body) {
|
|
69560
|
+
return readPayload2(
|
|
69561
|
+
await client_default.post(
|
|
69562
|
+
`/projects/${projectId}/branches/${branchId}/sandbox/promote/plan`,
|
|
69563
|
+
body
|
|
69564
|
+
)
|
|
69565
|
+
);
|
|
69566
|
+
}
|
|
69459
69567
|
var sandbox_default = {
|
|
69460
69568
|
createOrResumeSandbox,
|
|
69461
69569
|
listSandboxes,
|
|
@@ -69463,7 +69571,8 @@ var sandbox_default = {
|
|
|
69463
69571
|
resumeSandbox,
|
|
69464
69572
|
setSandboxPinned,
|
|
69465
69573
|
discardSandbox,
|
|
69466
|
-
promoteSandbox
|
|
69574
|
+
promoteSandbox,
|
|
69575
|
+
planPromote
|
|
69467
69576
|
};
|
|
69468
69577
|
|
|
69469
69578
|
// src/api/tasks.ts
|
|
@@ -69708,10 +69817,7 @@ function reportPromotionFailure(error2, body) {
|
|
|
69708
69817
|
async function readPromotePlan(projectId, sandboxBranchId, targetBranchId) {
|
|
69709
69818
|
const spinner = out.spinner("Reading the plan...");
|
|
69710
69819
|
try {
|
|
69711
|
-
const
|
|
69712
|
-
const plan = await planManifest(projectId, targetBranchId, {
|
|
69713
|
-
schema: sandboxSchema.schemaDefinition
|
|
69714
|
-
});
|
|
69820
|
+
const plan = await sandbox_default.planPromote(projectId, sandboxBranchId, { targetBranchId });
|
|
69715
69821
|
spinner.stop();
|
|
69716
69822
|
return plan;
|
|
69717
69823
|
} catch (error2) {
|
|
@@ -69720,6 +69826,19 @@ async function readPromotePlan(projectId, sandboxBranchId, targetBranchId) {
|
|
|
69720
69826
|
throw exitWith(EXIT_ERROR);
|
|
69721
69827
|
}
|
|
69722
69828
|
}
|
|
69829
|
+
var PROMOTED_FUNCTION_DONE = {
|
|
69830
|
+
create: "created",
|
|
69831
|
+
change: "changed",
|
|
69832
|
+
delete: "deleted"
|
|
69833
|
+
};
|
|
69834
|
+
function reportPromotedFunctions(functions, targetName) {
|
|
69835
|
+
if (functions.length === 0) {
|
|
69836
|
+
out.info(`Functions: none changed on "${targetName}"`);
|
|
69837
|
+
return;
|
|
69838
|
+
}
|
|
69839
|
+
const named2 = functions.map((fn) => `${fn.name} (${PROMOTED_FUNCTION_DONE[fn.action]})`);
|
|
69840
|
+
out.success(`Functions promoted to "${targetName}": ${named2.join(", ")}`);
|
|
69841
|
+
}
|
|
69723
69842
|
async function handlePromote(options) {
|
|
69724
69843
|
const acceptPlanError = acceptPlanOptionError(options.acceptPlan);
|
|
69725
69844
|
if (acceptPlanError !== void 0) {
|
|
@@ -69754,6 +69873,9 @@ async function handlePromote(options) {
|
|
|
69754
69873
|
console.log(style.primary("\u2502 ") + style.muted(`Sandbox: ${sandbox.branch.name}`));
|
|
69755
69874
|
console.log(style.primary("\u2502 ") + style.muted(`Target: ${target.name}`));
|
|
69756
69875
|
console.log(style.primary("\u2502 ") + style.muted(`Schema: flushed via full deploy`));
|
|
69876
|
+
console.log(
|
|
69877
|
+
style.primary("\u2502 ") + style.muted(`Functions: carried when the sandbox deployed its own`)
|
|
69878
|
+
);
|
|
69757
69879
|
console.log(
|
|
69758
69880
|
style.primary("\u2502 ") + style.muted(`Writes: ${withEntries ? "applied to the target as changes" : "not applied"}`)
|
|
69759
69881
|
);
|
|
@@ -69825,6 +69947,7 @@ async function handlePromote(options) {
|
|
|
69825
69947
|
result.schemaChanged ? `Schema deployed to "${target.name}"${result.deployedVersion ? ` (v${result.deployedVersion})` : ""}` : `Schema already in sync with "${target.name}"`
|
|
69826
69948
|
);
|
|
69827
69949
|
}
|
|
69950
|
+
reportPromotedFunctions(result.functions, target.name);
|
|
69828
69951
|
if (result.adaptation) displayQueuedAdaptation(result.adaptation, null);
|
|
69829
69952
|
if (result.entriesTaskId) {
|
|
69830
69953
|
const entriesSpinner = out.spinner("Applying sandbox writes as changes...");
|
|
@@ -69886,10 +70009,14 @@ Examples:
|
|
|
69886
70009
|
|
|
69887
70010
|
Notes:
|
|
69888
70011
|
\u2022 The schema is flushed through the standard deploy (full validation + events).
|
|
70012
|
+
\u2022 Functions the sandbox deployed go with it, through the same deploy, and the
|
|
70013
|
+
promote names each one it created, changed or deleted on the target. A sandbox
|
|
70014
|
+
that deployed none leaves the target's Functions as they are.
|
|
69889
70015
|
\u2022 The sandbox's writes are applied to the target as changes, not copied: an entry it
|
|
69890
70016
|
created is added under its own id, one it edited is updated in place, one it
|
|
69891
70017
|
deleted is deleted. They run as a background task, safe for large sets.
|
|
69892
|
-
\u2022 If the target branch changed since your sandbox forked
|
|
70018
|
+
\u2022 If the target branch changed since your sandbox forked \u2014 its schema, or the
|
|
70019
|
+
Functions it runs when your sandbox deployed Functions \u2014 promotion is blocked and
|
|
69893
70020
|
you'll be asked to rebase (start a fresh \`relyio dev\` from the updated branch).
|
|
69894
70021
|
\u2022 A sandbox schema that would delete, archive or fill the target's stored content
|
|
69895
70022
|
prints its plan first, and you are asked once, with the plan in front of you. -y
|
|
@@ -70955,7 +71082,7 @@ function sandboxCommands(program2) {
|
|
|
70955
71082
|
}
|
|
70956
71083
|
|
|
70957
71084
|
// src/commands/version.ts
|
|
70958
|
-
var CLI_VERSION = "0.
|
|
71085
|
+
var CLI_VERSION = "0.15.0" ;
|
|
70959
71086
|
async function handleVersion(_options) {
|
|
70960
71087
|
out.heading("RelyIO CLI Version Information");
|
|
70961
71088
|
const versionInfo = [
|
|
@@ -71223,7 +71350,9 @@ async function performStatusCheck(branchName, options) {
|
|
|
71223
71350
|
}
|
|
71224
71351
|
const divergence = await manage_default.getBranchDivergence(ctx.projectId, ctx.branchId);
|
|
71225
71352
|
ctx.divergence = divergence;
|
|
71226
|
-
if (divergence?.
|
|
71353
|
+
if (divergence?.source === "deleted") {
|
|
71354
|
+
task.title = divergence.forkedFromBranchName === null ? "Parent branch was deleted" : `Parent branch "${divergence.forkedFromBranchName}" was deleted`;
|
|
71355
|
+
} else if (divergence?.hasDiverged) {
|
|
71227
71356
|
task.title = `Parent branch "${divergence.forkedFromBranchName}" has diverged`;
|
|
71228
71357
|
} else if (divergence) {
|
|
71229
71358
|
task.title = `Up to date with "${divergence.forkedFromBranchName}"`;
|
|
@@ -71458,7 +71587,7 @@ function displayCompactStatus(context, failure) {
|
|
|
71458
71587
|
}
|
|
71459
71588
|
out.line("info", branchInfo);
|
|
71460
71589
|
console.log();
|
|
71461
|
-
if (context.divergence?.hasDiverged) {
|
|
71590
|
+
if (context.divergence?.source === "present" && context.divergence.hasDiverged) {
|
|
71462
71591
|
const parentName = context.divergence.forkedFromBranchName;
|
|
71463
71592
|
if (context.divergence.compatibility?.safeToMerge) {
|
|
71464
71593
|
out.line(
|
|
@@ -71506,7 +71635,7 @@ async function displayVerboseStatus(context, failure, watchMode) {
|
|
|
71506
71635
|
if (currentGitSha) {
|
|
71507
71636
|
out.info(`Git commit: ${currentGitSha.slice(0, 8)}...`, "git");
|
|
71508
71637
|
}
|
|
71509
|
-
if (context.divergence?.hasDiverged) {
|
|
71638
|
+
if (context.divergence?.source === "present" && context.divergence.hasDiverged) {
|
|
71510
71639
|
const parentName = context.divergence.forkedFromBranchName;
|
|
71511
71640
|
const changes = context.divergence.parentChanges;
|
|
71512
71641
|
if (changes) {
|
|
@@ -71532,8 +71661,13 @@ async function displayVerboseStatus(context, failure, watchMode) {
|
|
|
71532
71661
|
`Parent has ${context.divergence.compatibility.breakingChanges.length} breaking change(s). Review with 'relyio diff --against ${parentName}'.`
|
|
71533
71662
|
);
|
|
71534
71663
|
}
|
|
71535
|
-
} else if (context.divergence
|
|
71664
|
+
} else if (context.divergence?.source === "present") {
|
|
71536
71665
|
out.info(`Up to date with "${context.divergence.forkedFromBranchName}"`);
|
|
71666
|
+
} else if (context.divergence?.source === "deleted") {
|
|
71667
|
+
const parentName = context.divergence.forkedFromBranchName;
|
|
71668
|
+
out.info(
|
|
71669
|
+
parentName === null ? "Parent branch was deleted" : `Parent branch "${parentName}" was deleted`
|
|
71670
|
+
);
|
|
71537
71671
|
}
|
|
71538
71672
|
if (failure?.code === "BRANCH_NOT_FOUND") {
|
|
71539
71673
|
out.error(`No RelyIO branch named '${context.branchName}' found`);
|
|
@@ -71819,6 +71953,9 @@ async function writeFiles(files, outputDir) {
|
|
|
71819
71953
|
);
|
|
71820
71954
|
}
|
|
71821
71955
|
|
|
71956
|
+
// src/commands/generate-types.ts
|
|
71957
|
+
init_functions_loader();
|
|
71958
|
+
|
|
71822
71959
|
// src/codegen/built-in-generators.ts
|
|
71823
71960
|
init_dist6();
|
|
71824
71961
|
var BUILT_IN_GENERATOR_LOADERS = Object.freeze({
|
|
@@ -72050,6 +72187,23 @@ async function performTypeGeneration(branchName, options, watchMode = false) {
|
|
|
72050
72187
|
ctx.ir = result.schema;
|
|
72051
72188
|
}
|
|
72052
72189
|
},
|
|
72190
|
+
{
|
|
72191
|
+
// The project's Functions, so `relyio.functions.<name>(input)` is typed by each one's
|
|
72192
|
+
// Fields (REL-4059). A file that does not load is refused, naming it, as deploy refuses it
|
|
72193
|
+
title: "Loading Functions",
|
|
72194
|
+
task: async (ctx, task) => {
|
|
72195
|
+
const loaded = await loadFunctionDeclarations(process.cwd());
|
|
72196
|
+
if (loaded.errors.length > 0) {
|
|
72197
|
+
throw new Error(
|
|
72198
|
+
`${loaded.errors.length} Function file${loaded.errors.length === 1 ? "" : "s"} could not be read:
|
|
72199
|
+
${loaded.errors.map((error2) => ` ${error2.file}: ${error2.error}`).join("\n")}`
|
|
72200
|
+
);
|
|
72201
|
+
}
|
|
72202
|
+
ctx.functions = functionsIrOf(loaded.functions);
|
|
72203
|
+
const count3 = loaded.functions.length;
|
|
72204
|
+
task.title = `${count3} Function${count3 === 1 ? "" : "s"} loaded`;
|
|
72205
|
+
}
|
|
72206
|
+
},
|
|
72053
72207
|
{
|
|
72054
72208
|
title: "Generating types",
|
|
72055
72209
|
task: async (ctx, task) => {
|
|
@@ -72060,7 +72214,11 @@ async function performTypeGeneration(branchName, options, watchMode = false) {
|
|
|
72060
72214
|
task: async () => {
|
|
72061
72215
|
const plugin3 = await loadPlugin(language);
|
|
72062
72216
|
const target = resolveTarget(ctx.config || {}, options, language);
|
|
72063
|
-
const
|
|
72217
|
+
const { functions } = ctx;
|
|
72218
|
+
if (functions === void 0) {
|
|
72219
|
+
throw new Error("The Functions were not read before the types were generated");
|
|
72220
|
+
}
|
|
72221
|
+
const result = await plugin3.generate(ctx.ir, target.options, functions);
|
|
72064
72222
|
await writeFiles(result.files, target.output);
|
|
72065
72223
|
if (result.warnings?.length) {
|
|
72066
72224
|
for (const warning of result.warnings) {
|
|
@@ -72581,7 +72739,8 @@ async function handlePlan(options) {
|
|
|
72581
72739
|
success: true,
|
|
72582
72740
|
branchName: result.branchName,
|
|
72583
72741
|
branchId: result.branchId,
|
|
72584
|
-
plan: result.plan
|
|
72742
|
+
plan: result.plan,
|
|
72743
|
+
deploy: result.deploy
|
|
72585
72744
|
},
|
|
72586
72745
|
refused ? EXIT_BLOCKED : void 0
|
|
72587
72746
|
);
|
|
@@ -72590,6 +72749,7 @@ async function handlePlan(options) {
|
|
|
72590
72749
|
console.log(`Plan for ${result.branchName} (${result.branchId.slice(0, 8)})`);
|
|
72591
72750
|
console.log();
|
|
72592
72751
|
console.log(formatManifestPlan(result.plan));
|
|
72752
|
+
console.log(formatDeployNote(result.deploy));
|
|
72593
72753
|
console.log();
|
|
72594
72754
|
if (refused) throw exitWith(EXIT_BLOCKED);
|
|
72595
72755
|
}
|
|
@@ -72615,8 +72775,10 @@ Examples:
|
|
|
72615
72775
|
|
|
72616
72776
|
Each area lists one line per item it creates (+), changes (~) or deletes (-). A line that deletes
|
|
72617
72777
|
or rewrites stored data needs confirming before it deploys; the plan says plainly when none does.
|
|
72778
|
+
Last, it says whether deploying from here would be refused: on a Repo-mode main the repository
|
|
72779
|
+
deploys it, so open a pull request with the change instead.
|
|
72618
72780
|
|
|
72619
|
-
Exit codes: 0 a plan, 2 deploy would refuse
|
|
72781
|
+
Exit codes: 0 a plan, 2 deploy would refuse the plan, 1 no plan could be read.
|
|
72620
72782
|
`
|
|
72621
72783
|
);
|
|
72622
72784
|
}
|
|
@@ -75527,9 +75689,12 @@ function printTestRun(ran, io) {
|
|
|
75527
75689
|
io.log(` recorded ${request2.method} ${request2.url} (not sent: Preview)`);
|
|
75528
75690
|
}
|
|
75529
75691
|
for (const refusal2 of ran.run.refusals) {
|
|
75530
|
-
io.log(` refused ${
|
|
75692
|
+
io.log(` refused ${refusalLine(refusal2)}`);
|
|
75531
75693
|
}
|
|
75532
75694
|
}
|
|
75695
|
+
function refusalLine(refusal2) {
|
|
75696
|
+
return `${refusal2.method} ${refusal2.host ?? "an unknown host"} (${refusal2.reason})`;
|
|
75697
|
+
}
|
|
75533
75698
|
function inputOf2(text) {
|
|
75534
75699
|
if (text === void 0) return {};
|
|
75535
75700
|
let parsed;
|
|
@@ -75571,14 +75736,17 @@ async function runFunctionsLogs(name, options, io, clock = FOREVER) {
|
|
|
75571
75736
|
async function printRun(projectId, branchId, name, run4, io) {
|
|
75572
75737
|
const timing = [
|
|
75573
75738
|
run4.durationMs === null ? null : `${run4.durationMs} ms`,
|
|
75574
|
-
run4.cpuMs === null ? null : `cpu ${run4.cpuMs} ms
|
|
75739
|
+
run4.cpuMs === null ? null : `cpu ${run4.cpuMs} ms`,
|
|
75740
|
+
// A Container run is billed as its instance type's vCPU × its running time (REL-4075)
|
|
75741
|
+
run4.container === null ? null : `container ${run4.container.size}`,
|
|
75742
|
+
run4.runningMs === null ? null : `running ${run4.runningMs} ms`
|
|
75575
75743
|
].filter((part) => part !== null).join(", ");
|
|
75576
75744
|
io.log(
|
|
75577
75745
|
`${run4.startedAt} ${run4.id} ${run4.status}${timing === "" ? "" : ` (${timing})`} v${run4.version} ${run4.wayIn} ${callerOf(run4)}${run4.attempt > 1 ? ` attempt ${run4.attempt}` : ""}`
|
|
75578
75746
|
);
|
|
75579
75747
|
if (run4.error !== null) io.log(` ${run4.error.name}: ${run4.error.message}`);
|
|
75580
75748
|
for (const refusal2 of run4.refusals) {
|
|
75581
|
-
io.log(` refused ${
|
|
75749
|
+
io.log(` refused ${refusalLine(refusal2)}`);
|
|
75582
75750
|
}
|
|
75583
75751
|
if (run4.logLines === 0) return;
|
|
75584
75752
|
try {
|
|
@@ -75811,7 +75979,7 @@ function secretsCommands(program2) {
|
|
|
75811
75979
|
init_dist3();
|
|
75812
75980
|
|
|
75813
75981
|
// ../sdk/dist/preview/index.js
|
|
75814
|
-
|
|
75982
|
+
init_chunk_OUR7OUUZ();
|
|
75815
75983
|
|
|
75816
75984
|
// src/api/ci.ts
|
|
75817
75985
|
init_dist3();
|
|
@@ -75899,7 +76067,7 @@ init_deploy_service();
|
|
|
75899
76067
|
|
|
75900
76068
|
// src/services/generated-types.ts
|
|
75901
76069
|
init_dist6();
|
|
75902
|
-
async function compareGeneratedTypes(schema, projectRoot) {
|
|
76070
|
+
async function compareGeneratedTypes(schema, functions, projectRoot) {
|
|
75903
76071
|
const configPath = await findCodegenConfig(projectRoot);
|
|
75904
76072
|
if (configPath === void 0) return { kind: "not-compared" };
|
|
75905
76073
|
const config = await loadCodegenConfig(configPath);
|
|
@@ -75909,7 +76077,7 @@ async function compareGeneratedTypes(schema, projectRoot) {
|
|
|
75909
76077
|
for (const language of languages) {
|
|
75910
76078
|
const target = resolveTarget(config, {}, language);
|
|
75911
76079
|
const plugin3 = await loadPlugin(language);
|
|
75912
|
-
const generated = await plugin3.generate(schema, target.options);
|
|
76080
|
+
const generated = await plugin3.generate(schema, target.options, functions);
|
|
75913
76081
|
for (const file2 of generated.files) {
|
|
75914
76082
|
const absolute = path7.resolve(projectRoot, target.output, file2.path);
|
|
75915
76083
|
const committed = await readFile(absolute, "utf8").catch((error2) => {
|
|
@@ -75927,6 +76095,7 @@ async function compareGeneratedTypes(schema, projectRoot) {
|
|
|
75927
76095
|
// src/commands/ci.ts
|
|
75928
76096
|
init_plan_service();
|
|
75929
76097
|
init_deploy_plan();
|
|
76098
|
+
init_functions_loader();
|
|
75930
76099
|
init_exit_codes();
|
|
75931
76100
|
init_schema_loader();
|
|
75932
76101
|
var defaultIo2 = () => ({
|
|
@@ -75990,7 +76159,8 @@ function projectOf(io, named2) {
|
|
|
75990
76159
|
}
|
|
75991
76160
|
var NO_WORK_FOR_THIS_JOB = /* @__PURE__ */ new Set([
|
|
75992
76161
|
"event-not-accepted",
|
|
75993
|
-
"not-a-branch-push"
|
|
76162
|
+
"not-a-branch-push",
|
|
76163
|
+
"pull-request-closed"
|
|
75994
76164
|
]);
|
|
75995
76165
|
function nothingToDo(io, message) {
|
|
75996
76166
|
annotate(io, "notice", message);
|
|
@@ -76209,12 +76379,13 @@ async function checkPullRequest(io, { projectId, ci }) {
|
|
|
76209
76379
|
io.log(` ${error2.path}: ${error2.message}`);
|
|
76210
76380
|
return refuse3(io, `${items.error.message} Nothing was checked.`, items.error.code);
|
|
76211
76381
|
}
|
|
76212
|
-
const generatedTypes = ci.schemaMode === "repo" ? await compareGeneratedTypes(loaded.schema, io.cwd) : { kind: "not-compared" };
|
|
76382
|
+
const generatedTypes = ci.schemaMode === "repo" ? await compareGeneratedTypes(loaded.schema, functionsIrOf(items.functions), io.cwd) : { kind: "not-compared" };
|
|
76213
76383
|
let answer;
|
|
76214
76384
|
try {
|
|
76215
76385
|
answer = await submitSchemaCheck(projectId, {
|
|
76216
76386
|
schema: loaded.schema,
|
|
76217
76387
|
generatedTypes,
|
|
76388
|
+
functions: functionsDeclarationOf(items.functions),
|
|
76218
76389
|
automations: items.automations,
|
|
76219
76390
|
extensions: items.extensions
|
|
76220
76391
|
});
|
|
@@ -77553,7 +77724,7 @@ Examples:
|
|
|
77553
77724
|
}
|
|
77554
77725
|
|
|
77555
77726
|
// src/index.ts
|
|
77556
|
-
var CLI_VERSION3 = "0.
|
|
77727
|
+
var CLI_VERSION3 = "0.15.0" ;
|
|
77557
77728
|
var program = new Command();
|
|
77558
77729
|
program.name("relyio").description("RelyIO CLI - Content Management, Simplified").version(CLI_VERSION3);
|
|
77559
77730
|
registerGlobalOptions(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relyio/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "RelyIO is coming soon — this package is not ready for general use yet.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"email": "team@relyio.com"
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
"tsup": "8.5.1",
|
|
63
63
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
64
64
|
"typescript-eslint": "8.69.0",
|
|
65
|
-
"vitest": "
|
|
66
|
-
"@relyio/
|
|
65
|
+
"vitest": "5.0.5",
|
|
66
|
+
"@relyio/codegen-core": "1.0.0",
|
|
67
67
|
"@relyio/codegen-python": "0.1.0",
|
|
68
68
|
"@relyio/codegen-typescript": "1.0.0",
|
|
69
69
|
"@relyio/device-auth": "0.0.0",
|
|
70
|
+
"@relyio/api-contract": "0.1.0",
|
|
70
71
|
"@relyio/eslint-config": "0.0.0",
|
|
71
72
|
"@relyio/manifest": "0.0.0",
|
|
72
|
-
"@relyio/codegen-core": "1.0.0",
|
|
73
73
|
"@relyio/schema": "0.0.1",
|
|
74
|
-
"@relyio/
|
|
75
|
-
"@relyio/
|
|
74
|
+
"@relyio/tenancy": "0.1.0",
|
|
75
|
+
"@relyio/sdk": "0.20.0"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|