@tailor-platform/sdk 1.2.4 → 1.2.5
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 +19 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +1 -2
- package/dist/cli/lib.mjs +1 -1
- package/dist/config-BmQRlW1j.mjs.map +1 -1
- package/dist/configure/index.d.mts +2 -2
- package/dist/{index-Dkyvjk4D.d.mts → index-LqF60FaW.d.mts} +2 -2
- package/dist/{list-BCSBAjwc.mjs → list-CEdXdOpY.mjs} +71 -88
- package/dist/list-CEdXdOpY.mjs.map +1 -0
- package/dist/{types-BeinUo7W.d.mts → types-DCb7NVBk.d.mts} +9 -9
- package/dist/utils/test/index.d.mts +2 -2
- package/docs/generator/builtin.md +1 -4
- package/docs/generator/custom.md +1 -4
- package/docs/services/executor.md +1 -2
- package/docs/services/resolver.md +1 -4
- package/docs/services/staticwebsite.md +1 -6
- package/docs/services/tailordb.md +1 -4
- package/docs/testing.md +5 -17
- package/package.json +9 -9
- package/dist/list-BCSBAjwc.mjs.map +0 -1
|
@@ -106,8 +106,26 @@ const TYPE_ICONS = {
|
|
|
106
106
|
trace: "→",
|
|
107
107
|
log: ""
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
const TYPE_COLORS = {
|
|
110
|
+
info: chalk.cyan,
|
|
111
|
+
success: chalk.green,
|
|
112
|
+
warn: chalk.yellow,
|
|
113
|
+
error: chalk.red,
|
|
114
|
+
debug: chalk.gray,
|
|
115
|
+
trace: chalk.gray,
|
|
116
|
+
log: (text) => text
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Reporter that handles all log output modes.
|
|
120
|
+
*
|
|
121
|
+
* Supports three modes controlled via logObj.tag:
|
|
122
|
+
* - "default": Colored icons and messages, no timestamp, dynamic line wrapping
|
|
123
|
+
* - "stream": Colored icons with timestamps, for streaming/polling operations
|
|
124
|
+
* - "plain": Colored messages only, no icons, no timestamp
|
|
125
|
+
*/
|
|
126
|
+
var Reporter = class {
|
|
110
127
|
log(logObj, ctx) {
|
|
128
|
+
const mode = logObj.tag || "default";
|
|
111
129
|
const stdout = ctx.options.stdout || process.stdout;
|
|
112
130
|
const stderr = ctx.options.stderr || process.stderr;
|
|
113
131
|
const formatOptions = ctx.options.formatOptions;
|
|
@@ -115,37 +133,21 @@ var IconReporter = class {
|
|
|
115
133
|
breakLength: stdout.columns || 80,
|
|
116
134
|
compact: formatOptions.compact
|
|
117
135
|
}, ...logObj.args);
|
|
136
|
+
const colorFn = TYPE_COLORS[logObj.type] || ((text) => text);
|
|
137
|
+
if (mode === "plain") {
|
|
138
|
+
stderr.write(`${colorFn(message)}\n`);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
118
141
|
const icon = TYPE_ICONS[logObj.type] || "";
|
|
119
|
-
const
|
|
120
|
-
const timestamp =
|
|
121
|
-
stderr.write(`${timestamp}${
|
|
142
|
+
const coloredOutput = colorFn(`${icon ? `${icon} ` : ""}${message}`);
|
|
143
|
+
const timestamp = mode === "stream" && logObj.date ? `${logObj.date.toLocaleTimeString()} ` : "";
|
|
144
|
+
stderr.write(`${timestamp}${coloredOutput}\n`);
|
|
122
145
|
}
|
|
123
146
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const stderr = ctx.options.stderr || process.stderr;
|
|
127
|
-
const message = formatWithOptions({
|
|
128
|
-
breakLength: 100,
|
|
129
|
-
compact: ctx.options.formatOptions.compact
|
|
130
|
-
}, ...logObj.args);
|
|
131
|
-
stderr.write(`${message}\n`);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
const defaultLogger = createConsola({
|
|
135
|
-
reporters: [new IconReporter()],
|
|
136
|
-
formatOptions: { date: false }
|
|
137
|
-
});
|
|
138
|
-
const streamLogger = createConsola({
|
|
139
|
-
reporters: [new IconReporter()],
|
|
147
|
+
const consola = createConsola({
|
|
148
|
+
reporters: [new Reporter()],
|
|
140
149
|
formatOptions: { date: true }
|
|
141
150
|
});
|
|
142
|
-
const plainLogger = createConsola({
|
|
143
|
-
reporters: [new PlainReporter()],
|
|
144
|
-
formatOptions: {
|
|
145
|
-
date: false,
|
|
146
|
-
compact: true
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
151
|
const logger = {
|
|
150
152
|
get jsonMode() {
|
|
151
153
|
return _jsonMode;
|
|
@@ -154,57 +156,29 @@ const logger = {
|
|
|
154
156
|
_jsonMode = value;
|
|
155
157
|
},
|
|
156
158
|
info(message, opts) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
streamLogger.info(message);
|
|
160
|
-
break;
|
|
161
|
-
case "plain":
|
|
162
|
-
plainLogger.log(message);
|
|
163
|
-
break;
|
|
164
|
-
default: defaultLogger.info(message);
|
|
165
|
-
}
|
|
159
|
+
const mode = opts?.mode ?? "default";
|
|
160
|
+
consola.withTag(mode).info(message);
|
|
166
161
|
},
|
|
167
162
|
success(message, opts) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
streamLogger.success(message);
|
|
171
|
-
break;
|
|
172
|
-
case "plain":
|
|
173
|
-
plainLogger.log(styles.success(message));
|
|
174
|
-
break;
|
|
175
|
-
default: defaultLogger.success(message);
|
|
176
|
-
}
|
|
163
|
+
const mode = opts?.mode ?? "default";
|
|
164
|
+
consola.withTag(mode).success(message);
|
|
177
165
|
},
|
|
178
166
|
warn(message, opts) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
streamLogger.warn(message);
|
|
182
|
-
break;
|
|
183
|
-
case "plain":
|
|
184
|
-
plainLogger.log(styles.warning(message));
|
|
185
|
-
break;
|
|
186
|
-
default: defaultLogger.warn(message);
|
|
187
|
-
}
|
|
167
|
+
const mode = opts?.mode ?? "default";
|
|
168
|
+
consola.withTag(mode).warn(message);
|
|
188
169
|
},
|
|
189
170
|
error(message, opts) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
streamLogger.error(message);
|
|
193
|
-
break;
|
|
194
|
-
case "plain":
|
|
195
|
-
plainLogger.error(styles.error(message));
|
|
196
|
-
break;
|
|
197
|
-
default: defaultLogger.error(message);
|
|
198
|
-
}
|
|
171
|
+
const mode = opts?.mode ?? "default";
|
|
172
|
+
consola.withTag(mode).error(message);
|
|
199
173
|
},
|
|
200
174
|
log(message) {
|
|
201
|
-
|
|
175
|
+
consola.withTag("plain").log(message);
|
|
202
176
|
},
|
|
203
177
|
newline() {
|
|
204
|
-
|
|
178
|
+
consola.withTag("plain").log("");
|
|
205
179
|
},
|
|
206
180
|
debug(message) {
|
|
207
|
-
|
|
181
|
+
if (process.env.DEBUG === "true") consola.withTag("plain").log(styles.dim(message));
|
|
208
182
|
},
|
|
209
183
|
out(data$1) {
|
|
210
184
|
if (typeof data$1 === "string") {
|
|
@@ -244,7 +218,7 @@ const logger = {
|
|
|
244
218
|
},
|
|
245
219
|
prompt(message, options) {
|
|
246
220
|
if (isCI) throw new CIPromptError();
|
|
247
|
-
return
|
|
221
|
+
return consola.prompt(message, options);
|
|
248
222
|
}
|
|
249
223
|
};
|
|
250
224
|
|
|
@@ -1372,11 +1346,20 @@ async function fetchLatestToken(config, user) {
|
|
|
1372
1346
|
Please verify your user name and login using 'tailor-sdk login' command.
|
|
1373
1347
|
`);
|
|
1374
1348
|
if (new Date(tokens.token_expires_at) > /* @__PURE__ */ new Date()) return tokens.access_token;
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1349
|
+
const client = initOAuth2Client();
|
|
1350
|
+
let resp;
|
|
1351
|
+
try {
|
|
1352
|
+
resp = await client.refreshToken({
|
|
1353
|
+
accessToken: tokens.access_token,
|
|
1354
|
+
refreshToken: tokens.refresh_token,
|
|
1355
|
+
expiresAt: Date.parse(tokens.token_expires_at)
|
|
1356
|
+
});
|
|
1357
|
+
} catch {
|
|
1358
|
+
throw new Error(ml`
|
|
1359
|
+
Failed to refresh token. Your session may have expired.
|
|
1360
|
+
Please run 'tailor-sdk login' and try again.
|
|
1361
|
+
`);
|
|
1362
|
+
}
|
|
1380
1363
|
config.users[user] = {
|
|
1381
1364
|
access_token: resp.accessToken,
|
|
1382
1365
|
refresh_token: resp.refreshToken,
|
|
@@ -1854,7 +1837,7 @@ var ExecutorService = class {
|
|
|
1854
1837
|
}
|
|
1855
1838
|
} catch (error) {
|
|
1856
1839
|
const relativePath = path$20.relative(process.cwd(), executorFile);
|
|
1857
|
-
logger.error(
|
|
1840
|
+
logger.error(`Failed to load executor from ${styles.bold(relativePath)}`);
|
|
1858
1841
|
logger.error(String(error));
|
|
1859
1842
|
throw error;
|
|
1860
1843
|
}
|
|
@@ -1937,7 +1920,7 @@ var ResolverService = class {
|
|
|
1937
1920
|
}
|
|
1938
1921
|
} catch (error) {
|
|
1939
1922
|
const relativePath = path$20.relative(process.cwd(), resolverFile);
|
|
1940
|
-
logger.error(
|
|
1923
|
+
logger.error(`Failed to load resolver from ${styles.bold(relativePath)}`);
|
|
1941
1924
|
logger.error(String(error));
|
|
1942
1925
|
throw error;
|
|
1943
1926
|
}
|
|
@@ -62571,8 +62554,8 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62571
62554
|
(function() {
|
|
62572
62555
|
var parseString = require_parse_string(), cast = require_cast(), parseType = require_lib$1().parseType, VERSION = "0.4.1", parsedTypeParse = function(parsedType, string, options) {
|
|
62573
62556
|
options ??= {};
|
|
62574
|
-
options.explicit
|
|
62575
|
-
options.customTypes
|
|
62557
|
+
options.explicit ?? (options.explicit = false);
|
|
62558
|
+
options.customTypes ?? (options.customTypes = {});
|
|
62576
62559
|
return cast(parseString(parsedType, string, options), parsedType, options);
|
|
62577
62560
|
}, parse$5 = function(type, string, options) {
|
|
62578
62561
|
return parsedTypeParse(parseType(type), string, options);
|
|
@@ -99270,7 +99253,7 @@ var TailorDBService = class {
|
|
|
99270
99253
|
}
|
|
99271
99254
|
} catch (error) {
|
|
99272
99255
|
const relativePath = path$20.relative(process.cwd(), typeFile);
|
|
99273
|
-
logger.error(
|
|
99256
|
+
logger.error(`Failed to load type from ${styles.bold(relativePath)}`);
|
|
99274
99257
|
logger.error(String(error));
|
|
99275
99258
|
throw error;
|
|
99276
99259
|
}
|
|
@@ -105320,7 +105303,7 @@ var GenerationManager = class {
|
|
|
105320
105303
|
sourceInfo: db.getTypeSourceInfo()
|
|
105321
105304
|
};
|
|
105322
105305
|
} catch (error) {
|
|
105323
|
-
logger.error(
|
|
105306
|
+
logger.error(`Error loading types for TailorDB service ${styles.bold(namespace)}`);
|
|
105324
105307
|
logger.error(String(error));
|
|
105325
105308
|
if (!watch) throw error;
|
|
105326
105309
|
}
|
|
@@ -105341,7 +105324,7 @@ var GenerationManager = class {
|
|
|
105341
105324
|
this.services.resolver[namespace][resolver.name] = resolver;
|
|
105342
105325
|
});
|
|
105343
105326
|
} catch (error) {
|
|
105344
|
-
logger.error(
|
|
105327
|
+
logger.error(`Error loading resolvers for Resolver service ${styles.bold(namespace)}`);
|
|
105345
105328
|
logger.error(String(error));
|
|
105346
105329
|
if (!watch) throw error;
|
|
105347
105330
|
}
|
|
@@ -105366,7 +105349,7 @@ var GenerationManager = class {
|
|
|
105366
105349
|
try {
|
|
105367
105350
|
await this.processGenerator(gen);
|
|
105368
105351
|
} catch (error) {
|
|
105369
|
-
logger.error(
|
|
105352
|
+
logger.error(`Error processing generator ${styles.bold(gen.id)}`);
|
|
105370
105353
|
logger.error(String(error));
|
|
105371
105354
|
if (!watch) throw error;
|
|
105372
105355
|
}
|
|
@@ -105399,7 +105382,7 @@ var GenerationManager = class {
|
|
|
105399
105382
|
source: typeInfo.sourceInfo[typeName]
|
|
105400
105383
|
});
|
|
105401
105384
|
} catch (error) {
|
|
105402
|
-
logger.error(
|
|
105385
|
+
logger.error(`Error processing type ${styles.bold(typeName)} in ${namespace} with generator ${gen.id}`);
|
|
105403
105386
|
logger.error(String(error));
|
|
105404
105387
|
}
|
|
105405
105388
|
}));
|
|
@@ -105409,7 +105392,7 @@ var GenerationManager = class {
|
|
|
105409
105392
|
types: results.tailordbResults[namespace]
|
|
105410
105393
|
});
|
|
105411
105394
|
} catch (error) {
|
|
105412
|
-
logger.error(
|
|
105395
|
+
logger.error(`Error processing TailorDB namespace ${styles.bold(namespace)} with generator ${gen.id}`);
|
|
105413
105396
|
logger.error(String(error));
|
|
105414
105397
|
}
|
|
105415
105398
|
else results.tailordbNamespaceResults[namespace] = results.tailordbResults[namespace];
|
|
@@ -105426,7 +105409,7 @@ var GenerationManager = class {
|
|
|
105426
105409
|
namespace
|
|
105427
105410
|
});
|
|
105428
105411
|
} catch (error) {
|
|
105429
|
-
logger.error(
|
|
105412
|
+
logger.error(`Error processing resolver ${styles.bold(resolverName)} in ${namespace} with generator ${gen.id}`);
|
|
105430
105413
|
logger.error(String(error));
|
|
105431
105414
|
}
|
|
105432
105415
|
}));
|
|
@@ -105436,7 +105419,7 @@ var GenerationManager = class {
|
|
|
105436
105419
|
resolvers: results.resolverResults[namespace]
|
|
105437
105420
|
});
|
|
105438
105421
|
} catch (error) {
|
|
105439
|
-
logger.error(
|
|
105422
|
+
logger.error(`Error processing Resolver namespace ${styles.bold(namespace)} with generator ${gen.id}`);
|
|
105440
105423
|
logger.error(String(error));
|
|
105441
105424
|
}
|
|
105442
105425
|
else results.resolverNamespaceResults[namespace] = results.resolverResults[namespace];
|
|
@@ -105449,7 +105432,7 @@ var GenerationManager = class {
|
|
|
105449
105432
|
try {
|
|
105450
105433
|
results.executorResults[executorId] = await processExecutor(executor);
|
|
105451
105434
|
} catch (error) {
|
|
105452
|
-
logger.error(
|
|
105435
|
+
logger.error(`Error processing executor ${styles.bold(executor.name)} with generator ${gen.id}`);
|
|
105453
105436
|
logger.error(String(error));
|
|
105454
105437
|
}
|
|
105455
105438
|
}));
|
|
@@ -105502,7 +105485,7 @@ var GenerationManager = class {
|
|
|
105502
105485
|
fs$15.writeFile(file.path, file.content, (err) => {
|
|
105503
105486
|
if (err) {
|
|
105504
105487
|
const relativePath = path$20.relative(process.cwd(), file.path);
|
|
105505
|
-
logger.error(
|
|
105488
|
+
logger.error(`Error writing file ${styles.bold(relativePath)}`);
|
|
105506
105489
|
logger.error(String(err));
|
|
105507
105490
|
reject(err);
|
|
105508
105491
|
} else {
|
|
@@ -105511,7 +105494,7 @@ var GenerationManager = class {
|
|
|
105511
105494
|
if (file.executable) fs$15.chmod(file.path, 493, (chmodErr) => {
|
|
105512
105495
|
if (chmodErr) {
|
|
105513
105496
|
const relativePath$1 = path$20.relative(process.cwd(), file.path);
|
|
105514
|
-
logger.error(
|
|
105497
|
+
logger.error(`Error setting executable permission on ${styles.bold(relativePath$1)}`);
|
|
105515
105498
|
logger.error(String(chmodErr));
|
|
105516
105499
|
reject(chmodErr);
|
|
105517
105500
|
} else resolve$3();
|
|
@@ -107101,4 +107084,4 @@ const listCommand = defineCommand({
|
|
|
107101
107084
|
|
|
107102
107085
|
//#endregion
|
|
107103
107086
|
export { withCommonArgs as $, generate as A, loadWorkspaceId as B, listOAuth2Clients as C, tokenCommand as D, getMachineUserToken as E, loadConfig as F, initOAuth2Client as G, writePlatformConfig as H, apiCall as I, PATScope as J, initOperatorClient as K, apiCommand as L, apply as M, applyCommand as N, listCommand$3 as O, generateUserTypes as P, jsonArgs as Q, fetchLatestToken as R, listCommand$2 as S, getOAuth2Client as T, fetchAll as U, readPlatformConfig as V, fetchUserInfo as W, confirmationArgs as X, commonArgs as Y, deploymentArgs as Z, listWorkflowExecutions as _, createCommand as a, remove as b, resumeWorkflow as c, listCommand$1 as d, workspaceArgs as et, listWorkflows as f, getWorkflowExecution as g, executionsCommand as h, deleteWorkspace as i, generateCommand as j, listMachineUsers as k, startCommand as l, getWorkflow as m, listWorkspaces as n, createWorkspace as o, getCommand as p, readPackageJson as q, deleteCommand as r, resumeCommand as s, listCommand as t, logger as tt, startWorkflow as u, show as v, getCommand$1 as w, removeCommand as x, showCommand as y, loadAccessToken as z };
|
|
107104
|
-
//# sourceMappingURL=list-
|
|
107087
|
+
//# sourceMappingURL=list-CEdXdOpY.mjs.map
|