gooseworks 0.2.4 → 0.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/dist/auth/oauth-server.d.ts.map +1 -1
- package/dist/auth/oauth-server.js +27 -19
- package/dist/auth/oauth-server.js.map +1 -1
- package/dist/commands/formats.d.ts +3 -0
- package/dist/commands/formats.d.ts.map +1 -0
- package/dist/commands/formats.js +155 -0
- package/dist/commands/formats.js.map +1 -0
- package/dist/commands/graphics/get-flow.d.ts +30 -0
- package/dist/commands/graphics/get-flow.d.ts.map +1 -0
- package/dist/commands/graphics/get-flow.js +212 -0
- package/dist/commands/graphics/get-flow.js.map +1 -0
- package/dist/commands/graphics/publish-flow.d.ts +28 -0
- package/dist/commands/graphics/publish-flow.d.ts.map +1 -0
- package/dist/commands/graphics/publish-flow.js +178 -0
- package/dist/commands/graphics/publish-flow.js.map +1 -0
- package/dist/commands/graphics/shared.d.ts +48 -0
- package/dist/commands/graphics/shared.d.ts.map +1 -0
- package/dist/commands/graphics/shared.js +181 -0
- package/dist/commands/graphics/shared.js.map +1 -0
- package/dist/commands/styles.d.ts +3 -0
- package/dist/commands/styles.d.ts.map +1 -0
- package/dist/commands/styles.js +157 -0
- package/dist/commands/styles.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/graphics-api.d.ts +106 -0
- package/dist/lib/graphics-api.d.ts.map +1 -0
- package/dist/lib/graphics-api.js +289 -0
- package/dist/lib/graphics-api.js.map +1 -0
- package/dist/lib/graphics-cache.d.ts +31 -0
- package/dist/lib/graphics-cache.d.ts.map +1 -0
- package/dist/lib/graphics-cache.js +126 -0
- package/dist/lib/graphics-cache.js.map +1 -0
- package/dist/lib/graphics-manifest.d.ts +96 -0
- package/dist/lib/graphics-manifest.d.ts.map +1 -0
- package/dist/lib/graphics-manifest.js +289 -0
- package/dist/lib/graphics-manifest.js.map +1 -0
- package/dist/skills/fetcher.d.ts +18 -0
- package/dist/skills/fetcher.d.ts.map +1 -0
- package/dist/skills/fetcher.js +118 -0
- package/dist/skills/fetcher.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic publish/update orchestration shared by the styles and formats
|
|
4
|
+
* commands. Handles manifest read + validate + slug overlay, multipart
|
|
5
|
+
* upload, and the 409 slug-collision retry loop.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.runPublishFlow = runPublishFlow;
|
|
42
|
+
exports.runUpdateFlow = runUpdateFlow;
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const graphics_manifest_1 = require("../../lib/graphics-manifest");
|
|
45
|
+
const graphics_api_1 = require("../../lib/graphics-api");
|
|
46
|
+
const shared_1 = require("./shared");
|
|
47
|
+
function formatValidationErrors(errors) {
|
|
48
|
+
return errors.map((e) => ` • ${e}`).join('\n');
|
|
49
|
+
}
|
|
50
|
+
function formatServerValidationErrors(body) {
|
|
51
|
+
if (!body?.errors)
|
|
52
|
+
return '';
|
|
53
|
+
return body.errors
|
|
54
|
+
.map((e) => {
|
|
55
|
+
if (typeof e === 'string')
|
|
56
|
+
return ` • ${e}`;
|
|
57
|
+
if (e.path)
|
|
58
|
+
return ` • ${e.path}: ${e.message ?? 'invalid'}`;
|
|
59
|
+
return ` • ${e.message ?? 'invalid'}`;
|
|
60
|
+
})
|
|
61
|
+
.join('\n');
|
|
62
|
+
}
|
|
63
|
+
async function runPublishFlow(cfg, opts) {
|
|
64
|
+
await runWriteFlow(cfg, opts, /* allowSlugRetry */ true);
|
|
65
|
+
}
|
|
66
|
+
async function runUpdateFlow(cfg, opts) {
|
|
67
|
+
// Update has no slug-collision retry — the slug is already locked.
|
|
68
|
+
await runWriteFlow(cfg, opts, /* allowSlugRetry */ false);
|
|
69
|
+
}
|
|
70
|
+
async function runWriteFlow(cfg, opts, allowSlugRetry) {
|
|
71
|
+
const dir = path.resolve(opts.dir ?? process.cwd());
|
|
72
|
+
const manifestPath = path.join(dir, cfg.manifestFilename);
|
|
73
|
+
let manifest;
|
|
74
|
+
try {
|
|
75
|
+
manifest = (0, graphics_manifest_1.readManifestFile)(manifestPath);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
if (err instanceof graphics_manifest_1.ManifestParseError) {
|
|
79
|
+
process.stderr.write(`${err.message}\n`);
|
|
80
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
81
|
+
}
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
if (typeof manifest !== 'object' || manifest === null || Array.isArray(manifest)) {
|
|
85
|
+
process.stderr.write(`${cfg.manifestFilename} must contain a JSON object.\n`);
|
|
86
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
87
|
+
}
|
|
88
|
+
if (opts.slug) {
|
|
89
|
+
manifest.slug = opts.slug;
|
|
90
|
+
}
|
|
91
|
+
validateOrExit(cfg, manifest);
|
|
92
|
+
const examples = manifest.examples ?? [];
|
|
93
|
+
let files;
|
|
94
|
+
try {
|
|
95
|
+
files = (0, graphics_manifest_1.resolveExampleFiles)(dir, examples);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
if (err instanceof graphics_manifest_1.ManifestMissingFileError) {
|
|
99
|
+
process.stderr.write(`Manifest references file '${err.missing}' but it doesn't exist in ${dir}.\n`);
|
|
100
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
101
|
+
}
|
|
102
|
+
if (err instanceof graphics_manifest_1.ManifestEscapingPathError) {
|
|
103
|
+
process.stderr.write(`Manifest references file '${err.ref}' which escapes the manifest directory ${dir}.\n`);
|
|
104
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
105
|
+
}
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
const result = await uploadOrExit(cfg, opts, manifest, files, allowSlugRetry);
|
|
109
|
+
process.stdout.write(`${cfg.label === 'style' ? 'Published style' : 'Published format'}: ${result.slug}\n` +
|
|
110
|
+
`${cfg.hubUrl(result.slug)}\n`);
|
|
111
|
+
}
|
|
112
|
+
function validateOrExit(cfg, manifest) {
|
|
113
|
+
const validation = cfg.validate(manifest);
|
|
114
|
+
if (!validation.ok) {
|
|
115
|
+
process.stderr.write(`Manifest validation failed:\n${formatValidationErrors(validation.errors)}\n`);
|
|
116
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function uploadOrExit(cfg, opts, manifest, files, allowSlugRetry) {
|
|
120
|
+
try {
|
|
121
|
+
return await cfg.upload(manifest, files);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
if (!(err instanceof graphics_api_1.ApiError))
|
|
125
|
+
(0, shared_1.reportApiErrorAndExit)(err);
|
|
126
|
+
const body = (err.body || {});
|
|
127
|
+
if (err.status === 400 && body.error === 'validation_failed') {
|
|
128
|
+
const lines = formatServerValidationErrors(body);
|
|
129
|
+
process.stderr.write(`Server validation failed${lines ? `:\n${lines}` : ''}\n`);
|
|
130
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
131
|
+
}
|
|
132
|
+
if (err.status === 400 && body.error === 'missing_file') {
|
|
133
|
+
process.stderr.write(`Server says file '${body.file ?? '?'}' is missing from the upload.\n`);
|
|
134
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
135
|
+
}
|
|
136
|
+
if (err.status === 400 && body.error === 'manifest_parse') {
|
|
137
|
+
process.stderr.write(`Server could not parse manifest: ${body.message ?? 'unknown'}\n`);
|
|
138
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
139
|
+
}
|
|
140
|
+
if (err.status === 413) {
|
|
141
|
+
process.stderr.write(`File too large: ${body.file ?? 'one of the uploaded files'} (max 10 MB).\n`);
|
|
142
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
143
|
+
}
|
|
144
|
+
if (err.status === 403) {
|
|
145
|
+
process.stderr.write(`You don't own this ${cfg.label}. Only its author can update or delete it.\n`);
|
|
146
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
147
|
+
}
|
|
148
|
+
if (err.status === 409 && body.error === 'slug_taken' && allowSlugRetry) {
|
|
149
|
+
return await retryWithSuggestedSlug(cfg, opts, manifest, files, body);
|
|
150
|
+
}
|
|
151
|
+
(0, shared_1.reportApiErrorAndExit)(err);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function retryWithSuggestedSlug(cfg, opts, manifest, files, body) {
|
|
155
|
+
const suggested = body.suggested_slug;
|
|
156
|
+
if (!suggested) {
|
|
157
|
+
process.stderr.write(`Slug taken and the server didn't suggest an alternative.\n`);
|
|
158
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
159
|
+
}
|
|
160
|
+
const accept = opts.yes ||
|
|
161
|
+
(await (0, shared_1.promptYesNo)(`Slug '${manifest.slug ?? '?'}' is taken. Use '${suggested}' instead?`, true));
|
|
162
|
+
if (!accept) {
|
|
163
|
+
process.stderr.write(`Aborted: slug collision unresolved.\n`);
|
|
164
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
165
|
+
}
|
|
166
|
+
manifest.slug = suggested;
|
|
167
|
+
// Re-run client validation: the server's suggestion could in principle
|
|
168
|
+
// fail our slug grammar, and shipping a broken value to the server
|
|
169
|
+
// produces an opaque second error rather than a clean local message.
|
|
170
|
+
validateOrExit(cfg, manifest);
|
|
171
|
+
try {
|
|
172
|
+
return await cfg.upload(manifest, files);
|
|
173
|
+
}
|
|
174
|
+
catch (retryErr) {
|
|
175
|
+
(0, shared_1.reportApiErrorAndExit)(retryErr);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=publish-flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-flow.js","sourceRoot":"","sources":["../../../src/commands/graphics/publish-flow.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DH,wCAKC;AAED,sCAMC;AAzED,2CAA6B;AAC7B,mEAQqC;AACrC,yDAAoE;AACpE,qCAIkB;AA8BlB,SAAS,sBAAsB,CAAC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,CAAC;IAAC,OAAO,QAAQ,EAAE,CAAC;QAClB,IAAA,8BAAqB,EAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for the styles/formats command families.
|
|
3
|
+
*
|
|
4
|
+
* Exit codes follow the spec:
|
|
5
|
+
* 0 = success
|
|
6
|
+
* 1 = transient or auth error (network, 401, 5xx)
|
|
7
|
+
* 2 = user error (bad input, 400, 403, 404, declined 409)
|
|
8
|
+
*/
|
|
9
|
+
import { type Credentials } from '../../auth/credentials';
|
|
10
|
+
export declare const EXIT_OK = 0;
|
|
11
|
+
export declare const EXIT_TRANSIENT = 1;
|
|
12
|
+
export declare const EXIT_USER_ERROR = 2;
|
|
13
|
+
export declare function requireCredentials(): Credentials;
|
|
14
|
+
export declare function getOptionalCredentials(): Credentials | null;
|
|
15
|
+
/**
|
|
16
|
+
* Build the api-client options for read-only commands. Falls back to the
|
|
17
|
+
* compiled-in API_BASE when the user is not logged in, so anonymous reads
|
|
18
|
+
* still work.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clientOpts(): {
|
|
21
|
+
apiBase: string;
|
|
22
|
+
apiKey: string | null;
|
|
23
|
+
};
|
|
24
|
+
/** Build api-client options for commands that require auth (publish/update/delete). */
|
|
25
|
+
export declare function authedClientOpts(): {
|
|
26
|
+
apiBase: string;
|
|
27
|
+
apiKey: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Parse a non-negative integer command-line option. Exits with the user-error
|
|
31
|
+
* code if the value is malformed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseIntOpt(value: string | undefined, name: string): number | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Translate a thrown error from the API client into a stderr message + exit
|
|
36
|
+
* code. Never re-throws.
|
|
37
|
+
*/
|
|
38
|
+
export declare function reportApiErrorAndExit(err: unknown): never;
|
|
39
|
+
export declare function promptYesNo(question: string, defaultYes?: boolean): Promise<boolean>;
|
|
40
|
+
interface ColumnDef<T> {
|
|
41
|
+
header: string;
|
|
42
|
+
get: (row: T) => string;
|
|
43
|
+
pad?: 'left' | 'right';
|
|
44
|
+
}
|
|
45
|
+
export declare function renderTable<T>(rows: T[], columns: ColumnDef<T>[]): string;
|
|
46
|
+
export declare function truncate(s: string | null | undefined, max: number): string;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/graphics/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1E,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,wBAAgB,kBAAkB,IAAI,WAAW,CAOhD;AAED,wBAAgB,sBAAsB,IAAI,WAAW,GAAG,IAAI,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMvE;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAGtE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQvF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CA8BzD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBlF;AAED,UAAU,SAAS,CAAC,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAkBzE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI1E"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared helpers for the styles/formats command families.
|
|
4
|
+
*
|
|
5
|
+
* Exit codes follow the spec:
|
|
6
|
+
* 0 = success
|
|
7
|
+
* 1 = transient or auth error (network, 401, 5xx)
|
|
8
|
+
* 2 = user error (bad input, 400, 403, 404, declined 409)
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.EXIT_USER_ERROR = exports.EXIT_TRANSIENT = exports.EXIT_OK = void 0;
|
|
45
|
+
exports.requireCredentials = requireCredentials;
|
|
46
|
+
exports.getOptionalCredentials = getOptionalCredentials;
|
|
47
|
+
exports.clientOpts = clientOpts;
|
|
48
|
+
exports.authedClientOpts = authedClientOpts;
|
|
49
|
+
exports.parseIntOpt = parseIntOpt;
|
|
50
|
+
exports.reportApiErrorAndExit = reportApiErrorAndExit;
|
|
51
|
+
exports.promptYesNo = promptYesNo;
|
|
52
|
+
exports.renderTable = renderTable;
|
|
53
|
+
exports.truncate = truncate;
|
|
54
|
+
const readline = __importStar(require("readline"));
|
|
55
|
+
const credentials_1 = require("../../auth/credentials");
|
|
56
|
+
const config_1 = require("../../config");
|
|
57
|
+
const graphics_api_1 = require("../../lib/graphics-api");
|
|
58
|
+
exports.EXIT_OK = 0;
|
|
59
|
+
exports.EXIT_TRANSIENT = 1;
|
|
60
|
+
exports.EXIT_USER_ERROR = 2;
|
|
61
|
+
function requireCredentials() {
|
|
62
|
+
const creds = (0, credentials_1.getCredentials)();
|
|
63
|
+
if (!creds) {
|
|
64
|
+
process.stderr.write('Not authenticated. Run `gooseworks login` first.\n');
|
|
65
|
+
process.exit(exports.EXIT_TRANSIENT);
|
|
66
|
+
}
|
|
67
|
+
return creds;
|
|
68
|
+
}
|
|
69
|
+
function getOptionalCredentials() {
|
|
70
|
+
return (0, credentials_1.getCredentials)();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Build the api-client options for read-only commands. Falls back to the
|
|
74
|
+
* compiled-in API_BASE when the user is not logged in, so anonymous reads
|
|
75
|
+
* still work.
|
|
76
|
+
*/
|
|
77
|
+
function clientOpts() {
|
|
78
|
+
const creds = getOptionalCredentials();
|
|
79
|
+
return {
|
|
80
|
+
apiBase: creds?.api_base ?? config_1.API_BASE,
|
|
81
|
+
apiKey: creds?.api_key ?? null,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Build api-client options for commands that require auth (publish/update/delete). */
|
|
85
|
+
function authedClientOpts() {
|
|
86
|
+
const creds = requireCredentials();
|
|
87
|
+
return { apiBase: creds.api_base, apiKey: creds.api_key };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Parse a non-negative integer command-line option. Exits with the user-error
|
|
91
|
+
* code if the value is malformed.
|
|
92
|
+
*/
|
|
93
|
+
function parseIntOpt(value, name) {
|
|
94
|
+
if (value === undefined)
|
|
95
|
+
return undefined;
|
|
96
|
+
const n = Number.parseInt(value, 10);
|
|
97
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
98
|
+
process.stderr.write(`--${name} must be a non-negative integer\n`);
|
|
99
|
+
process.exit(exports.EXIT_USER_ERROR);
|
|
100
|
+
}
|
|
101
|
+
return n;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Translate a thrown error from the API client into a stderr message + exit
|
|
105
|
+
* code. Never re-throws.
|
|
106
|
+
*/
|
|
107
|
+
function reportApiErrorAndExit(err) {
|
|
108
|
+
if (err instanceof graphics_api_1.NetworkError) {
|
|
109
|
+
process.stderr.write(`Network error: ${err.message}\n`);
|
|
110
|
+
process.exit(exports.EXIT_TRANSIENT);
|
|
111
|
+
}
|
|
112
|
+
if (err instanceof graphics_api_1.ApiError) {
|
|
113
|
+
if (err.status === 401) {
|
|
114
|
+
process.stderr.write('Not authenticated. Run `gooseworks login` first.\n');
|
|
115
|
+
process.exit(exports.EXIT_TRANSIENT);
|
|
116
|
+
}
|
|
117
|
+
if (err.status >= 500) {
|
|
118
|
+
process.stderr.write(`Server error (${err.status}). Please try again later.\n`);
|
|
119
|
+
process.exit(exports.EXIT_TRANSIENT);
|
|
120
|
+
}
|
|
121
|
+
if (err.status === 403) {
|
|
122
|
+
process.stderr.write(`${err.message || 'Forbidden'}\n`);
|
|
123
|
+
process.exit(exports.EXIT_USER_ERROR);
|
|
124
|
+
}
|
|
125
|
+
if (err.status === 404) {
|
|
126
|
+
process.stderr.write(`Not found: ${err.message}\n`);
|
|
127
|
+
process.exit(exports.EXIT_USER_ERROR);
|
|
128
|
+
}
|
|
129
|
+
process.stderr.write(`Error (${err.status}): ${err.message}\n`);
|
|
130
|
+
process.exit(exports.EXIT_USER_ERROR);
|
|
131
|
+
}
|
|
132
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
133
|
+
process.stderr.write(`${message}\n`);
|
|
134
|
+
process.exit(exports.EXIT_TRANSIENT);
|
|
135
|
+
}
|
|
136
|
+
function promptYesNo(question, defaultYes = false) {
|
|
137
|
+
if (!process.stdin.isTTY) {
|
|
138
|
+
// Non-interactive context with no --yes — refuse rather than hang.
|
|
139
|
+
return Promise.resolve(false);
|
|
140
|
+
}
|
|
141
|
+
const rl = readline.createInterface({
|
|
142
|
+
input: process.stdin,
|
|
143
|
+
output: process.stderr,
|
|
144
|
+
});
|
|
145
|
+
const suffix = defaultYes ? '[Y/n]' : '[y/N]';
|
|
146
|
+
return new Promise((resolve) => {
|
|
147
|
+
rl.question(`${question} ${suffix} `, (answer) => {
|
|
148
|
+
rl.close();
|
|
149
|
+
const trimmed = answer.trim().toLowerCase();
|
|
150
|
+
if (trimmed === '')
|
|
151
|
+
resolve(defaultYes);
|
|
152
|
+
else
|
|
153
|
+
resolve(trimmed === 'y' || trimmed === 'yes');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function renderTable(rows, columns) {
|
|
158
|
+
if (rows.length === 0)
|
|
159
|
+
return '';
|
|
160
|
+
const widths = columns.map((c) => Math.max(c.header.length, ...rows.map((r) => c.get(r).length)));
|
|
161
|
+
const renderRow = (cells) => cells
|
|
162
|
+
.map((cell, i) => {
|
|
163
|
+
const pad = columns[i].pad ?? 'right';
|
|
164
|
+
return pad === 'left'
|
|
165
|
+
? cell.padStart(widths[i])
|
|
166
|
+
: cell.padEnd(widths[i]);
|
|
167
|
+
})
|
|
168
|
+
.join(' ');
|
|
169
|
+
const headerLine = renderRow(columns.map((c) => c.header));
|
|
170
|
+
const separatorLine = widths.map((w) => '─'.repeat(w)).join(' ');
|
|
171
|
+
const bodyLines = rows.map((r) => renderRow(columns.map((c) => c.get(r))));
|
|
172
|
+
return [headerLine, separatorLine, ...bodyLines].join('\n');
|
|
173
|
+
}
|
|
174
|
+
function truncate(s, max) {
|
|
175
|
+
if (!s)
|
|
176
|
+
return '';
|
|
177
|
+
if (s.length <= max)
|
|
178
|
+
return s;
|
|
179
|
+
return s.slice(0, max - 1) + '…';
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/graphics/shared.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYH,gDAOC;AAED,wDAEC;AAOD,gCAMC;AAGD,4CAGC;AAMD,kCAQC;AAMD,sDA8BC;AAED,kCAkBC;AAQD,kCAkBC;AAED,4BAIC;AA9ID,mDAAqC;AACrC,wDAA0E;AAC1E,yCA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,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,CAAC,UAAU,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED,SAAgB,QAAQ,CAAC,CAA4B,EAAE,GAAW;IAChE,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAClB,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/commands/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkMpC,eAAO,MAAM,aAAa,SAOF,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stylesCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
const graphics_manifest_1 = require("../lib/graphics-manifest");
|
|
7
|
+
const graphics_api_1 = require("../lib/graphics-api");
|
|
8
|
+
const shared_1 = require("./graphics/shared");
|
|
9
|
+
const publish_flow_1 = require("./graphics/publish-flow");
|
|
10
|
+
const get_flow_1 = require("./graphics/get-flow");
|
|
11
|
+
function renderListTable(rows) {
|
|
12
|
+
return (0, shared_1.renderTable)(rows, [
|
|
13
|
+
{ header: 'NAME', get: (r) => (0, shared_1.truncate)(r.name, 40) },
|
|
14
|
+
{ header: 'SLUG', get: (r) => r.slug },
|
|
15
|
+
{ header: 'MOOD', get: (r) => r.moodGroup ?? '' },
|
|
16
|
+
{ header: 'FEATURED', get: (r) => (r.featured ? '★' : '') },
|
|
17
|
+
{ header: 'AUTHOR', get: (r) => r.authorHandle ?? '' },
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
20
|
+
const listCmd = new commander_1.Command('list')
|
|
21
|
+
.description('List published graphic styles')
|
|
22
|
+
.option('--mood <mood>', 'Filter by mood group')
|
|
23
|
+
.option('--tag <tag>', 'Filter by tag')
|
|
24
|
+
.option('--featured', 'Only featured styles')
|
|
25
|
+
.option('--q <query>', 'Free-text query')
|
|
26
|
+
.option('--limit <n>', 'Max rows to return')
|
|
27
|
+
.option('--offset <n>', 'Skip the first N rows')
|
|
28
|
+
.option('--json', 'Print full JSON instead of a table')
|
|
29
|
+
.action(async (opts) => {
|
|
30
|
+
try {
|
|
31
|
+
const env = await (0, graphics_api_1.listStyles)((0, shared_1.clientOpts)(), {
|
|
32
|
+
q: opts.q,
|
|
33
|
+
mood: opts.mood,
|
|
34
|
+
tag: opts.tag,
|
|
35
|
+
featured: !!opts.featured,
|
|
36
|
+
limit: (0, shared_1.parseIntOpt)(opts.limit, 'limit'),
|
|
37
|
+
offset: (0, shared_1.parseIntOpt)(opts.offset, 'offset'),
|
|
38
|
+
});
|
|
39
|
+
if (opts.json) {
|
|
40
|
+
process.stdout.write(JSON.stringify(env.data, null, 2) + '\n');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (env.data.length === 0) {
|
|
44
|
+
process.stderr.write('No styles match.\n');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
process.stdout.write(renderListTable(env.data) + '\n');
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
(0, shared_1.reportApiErrorAndExit)(err);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const searchCmd = new commander_1.Command('search')
|
|
54
|
+
.description('Search graphic styles (alias for `list --q <query>`)')
|
|
55
|
+
.argument('<query>', 'Search query')
|
|
56
|
+
.option('--json', 'Print full JSON instead of a table')
|
|
57
|
+
.option('--limit <n>', 'Max rows to return')
|
|
58
|
+
.option('--offset <n>', 'Skip the first N rows')
|
|
59
|
+
.action(async (query, opts) => {
|
|
60
|
+
try {
|
|
61
|
+
const env = await (0, graphics_api_1.listStyles)((0, shared_1.clientOpts)(), {
|
|
62
|
+
q: query,
|
|
63
|
+
limit: (0, shared_1.parseIntOpt)(opts.limit, 'limit'),
|
|
64
|
+
offset: (0, shared_1.parseIntOpt)(opts.offset, 'offset'),
|
|
65
|
+
});
|
|
66
|
+
if (opts.json) {
|
|
67
|
+
process.stdout.write(JSON.stringify(env.data, null, 2) + '\n');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (env.data.length === 0) {
|
|
71
|
+
process.stderr.write(`No styles match "${query}".\n`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
process.stdout.write(renderListTable(env.data) + '\n');
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
(0, shared_1.reportApiErrorAndExit)(err);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const getCmd = new commander_1.Command('get')
|
|
81
|
+
.description('Print a style\'s design.md (default) or full JSON record')
|
|
82
|
+
.argument('<slug>', 'Style slug')
|
|
83
|
+
.option('--json', 'Print full JSON record instead of design.md')
|
|
84
|
+
.option('--include-examples', 'Also download example PNGs into ./<slug>/')
|
|
85
|
+
.option('--no-cache', 'Bypass local ETag cache')
|
|
86
|
+
.action(async (slug, opts) => {
|
|
87
|
+
const opt = (0, shared_1.clientOpts)();
|
|
88
|
+
await (0, get_flow_1.runGetFlow)({
|
|
89
|
+
resource: 'styles',
|
|
90
|
+
fetchMarkdown: (s, etag) => (0, graphics_api_1.getStyleDesignMd)(opt, s, etag),
|
|
91
|
+
fetchRecord: (s, etag) => (0, graphics_api_1.getStyleRecord)(opt, s, etag),
|
|
92
|
+
}, slug, {
|
|
93
|
+
json: opts.json,
|
|
94
|
+
includeExamples: opts.includeExamples,
|
|
95
|
+
// commander's --no-cache flips `cache` to false
|
|
96
|
+
noCache: opts.cache === false,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
const publishCmd = new commander_1.Command('publish')
|
|
100
|
+
.description('Publish a style from a directory containing gooseworks-style.json')
|
|
101
|
+
.argument('[path]', 'Directory containing the manifest', '.')
|
|
102
|
+
.option('--slug <slug>', 'Override the manifest slug')
|
|
103
|
+
.option('--yes', 'Skip the slug-collision prompt and accept the suggestion')
|
|
104
|
+
.action(async (dir, opts) => {
|
|
105
|
+
const auth = (0, shared_1.authedClientOpts)();
|
|
106
|
+
await (0, publish_flow_1.runPublishFlow)({
|
|
107
|
+
manifestFilename: graphics_manifest_1.STYLE_MANIFEST_FILENAME,
|
|
108
|
+
validate: graphics_manifest_1.validateStyleManifest,
|
|
109
|
+
hubUrl: (slug) => `${config_1.FRONTEND_URL}/styles/${slug}`,
|
|
110
|
+
label: 'style',
|
|
111
|
+
upload: (manifest, files) => (0, graphics_api_1.publishStyle)(auth, manifest, files),
|
|
112
|
+
}, { dir, slug: opts.slug, yes: opts.yes });
|
|
113
|
+
});
|
|
114
|
+
const updateCmd = new commander_1.Command('update')
|
|
115
|
+
.description('Update a style by slug')
|
|
116
|
+
.argument('<slug>', 'Style slug to update')
|
|
117
|
+
.argument('[path]', 'Directory containing the manifest', '.')
|
|
118
|
+
.action(async (slug, dir) => {
|
|
119
|
+
const auth = (0, shared_1.authedClientOpts)();
|
|
120
|
+
await (0, publish_flow_1.runUpdateFlow)({
|
|
121
|
+
manifestFilename: graphics_manifest_1.STYLE_MANIFEST_FILENAME,
|
|
122
|
+
validate: graphics_manifest_1.validateStyleManifest,
|
|
123
|
+
hubUrl: (s) => `${config_1.FRONTEND_URL}/styles/${s}`,
|
|
124
|
+
label: 'style',
|
|
125
|
+
upload: (manifest, files) => (0, graphics_api_1.updateStyle)(auth, slug, manifest, files),
|
|
126
|
+
}, { dir, slug, yes: true });
|
|
127
|
+
});
|
|
128
|
+
const deleteCmd = new commander_1.Command('delete')
|
|
129
|
+
.description('Delete a style by slug (owner only)')
|
|
130
|
+
.argument('<slug>', 'Style slug to delete')
|
|
131
|
+
.option('--yes', 'Skip the confirmation prompt')
|
|
132
|
+
.action(async (slug, opts) => {
|
|
133
|
+
const auth = (0, shared_1.authedClientOpts)();
|
|
134
|
+
if (!opts.yes) {
|
|
135
|
+
const ok = await (0, shared_1.promptYesNo)(`Delete style '${slug}'?`, false);
|
|
136
|
+
if (!ok) {
|
|
137
|
+
process.stderr.write('Aborted.\n');
|
|
138
|
+
process.exit(shared_1.EXIT_USER_ERROR);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
await (0, graphics_api_1.deleteStyle)(auth, slug);
|
|
143
|
+
process.stdout.write(`Deleted style '${slug}'.\n`);
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
(0, shared_1.reportApiErrorAndExit)(err);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
exports.stylesCommand = new commander_1.Command('styles')
|
|
150
|
+
.description('Browse and publish graphic styles')
|
|
151
|
+
.addCommand(listCmd)
|
|
152
|
+
.addCommand(searchCmd)
|
|
153
|
+
.addCommand(getCmd)
|
|
154
|
+
.addCommand(publishCmd)
|
|
155
|
+
.addCommand(updateCmd)
|
|
156
|
+
.addCommand(deleteCmd);
|
|
157
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/commands/styles.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,sCAAyC;AACzC,gEAGkC;AAClC,sDAS6B;AAC7B,8CAS2B;AAC3B,0DAAwE;AACxE,kDAAiD;AAYjD,SAAS,eAAe,CAAC,IAA+C;IACtE,OAAO,IAAA,oBAAW,EAAC,IAAI,EAAE;QACvB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,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AAO,CAAC,IAAI,CAAC,wBAAe,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAA,0BAAW,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,IAAI,MAAM,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAA,8BAAqB,EAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC,CAAC,CAAC;AAEQ,QAAA,aAAa,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,mCAAmC,CAAC;KAChD,UAAU,CAAC,OAAO,CAAC;KACnB,UAAU,CAAC,SAAS,CAAC;KACrB,UAAU,CAAC,MAAM,CAAC;KAClB,UAAU,CAAC,UAAU,CAAC;KACtB,UAAU,CAAC,SAAS,CAAC;KACrB,UAAU,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,8 @@ const logout_1 = require("./commands/logout");
|
|
|
8
8
|
const update_1 = require("./commands/update");
|
|
9
9
|
const credits_1 = require("./commands/credits");
|
|
10
10
|
const search_1 = require("./commands/search");
|
|
11
|
+
const styles_1 = require("./commands/styles");
|
|
12
|
+
const formats_1 = require("./commands/formats");
|
|
11
13
|
const version_1 = require("./version");
|
|
12
14
|
const program = new commander_1.Command();
|
|
13
15
|
program
|
|
@@ -20,5 +22,7 @@ program.addCommand(logout_1.logoutCommand);
|
|
|
20
22
|
program.addCommand(update_1.updateCommand);
|
|
21
23
|
program.addCommand(credits_1.creditsCommand);
|
|
22
24
|
program.addCommand(search_1.searchCommand);
|
|
25
|
+
program.addCommand(styles_1.stylesCommand);
|
|
26
|
+
program.addCommand(formats_1.formatsCommand);
|
|
23
27
|
program.parse();
|
|
24
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,gDAAoD;AACpD,4CAAgD;AAChD,8CAAkD;AAClD,8CAAkD;AAClD,gDAAoD;AACpD,8CAAkD;AAClD,uCAAuC;AAEvC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,yDAAyD,CAAC;KACtE,OAAO,CAAC,IAAA,oBAAU,GAAE,CAAC,CAAC;AAEzB,OAAO,CAAC,UAAU,CAAC,wBAAc,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,oBAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,wBAAc,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,gDAAoD;AACpD,4CAAgD;AAChD,8CAAkD;AAClD,8CAAkD;AAClD,gDAAoD;AACpD,8CAAkD;AAClD,8CAAkD;AAClD,gDAAoD;AACpD,uCAAuC;AAEvC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,yDAAyD,CAAC;KACtE,OAAO,CAAC,IAAA,oBAAU,GAAE,CAAC,CAAC;AAEzB,OAAO,CAAC,UAAU,CAAC,wBAAc,CAAC,CAAC;AACnC,OAAO,CAAC,UAAU,CAAC,oBAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,sBAA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