@contrail/cli 3.6.0-alpha-8-alpha.2ad94f7 → 3.6.0-alpha-8-alpha.5396d7b
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/README.md +3 -3
- package/dist/auth/login.js +13 -20
- package/dist/basecommand.d.ts +1 -3
- package/dist/basecommand.js +1 -1
- package/dist/commands/config/set.js +1 -1
- package/dist/helpers/config/config.d.ts +0 -1
- package/dist/helpers/config/config.js +1 -8
- package/node_modules/@contrail/sdk/lib/image-search/image-search.d.ts +34 -0
- package/node_modules/@contrail/sdk/lib/image-search/image-search.js +42 -0
- package/node_modules/@contrail/sdk/lib/image-search/index.d.ts +1 -0
- package/node_modules/@contrail/{org-config-migration/node_modules/@contrail/sdk/lib/assets → sdk/lib/image-search}/index.js +1 -1
- package/node_modules/@contrail/sdk/lib/index.d.ts +1 -0
- package/node_modules/@contrail/sdk/lib/index.js +1 -0
- package/node_modules/@contrail/sdk/package.json +1 -1
- package/oclif.manifest.json +2 -3
- package/package.json +2 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/pull_request_template.md +0 -31
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/check-code-formatting.yml +0 -34
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/empty.yml +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/generate-sdk-docs.yml +0 -32
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/publish-to-npm.yml +0 -117
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/sdk-lib.yml +0 -27
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.prettierrc.yaml +0 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/README.md +0 -72
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/home-hero.svg +0 -11
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/assets/assets.d.ts +0 -9
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/assets/assets.js +0 -54
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/assets/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/auth.d.ts +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/auth.js +0 -6
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/index.d.ts +0 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/index.js +0 -18
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/login.d.ts +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/login.js +0 -209
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/config.d.ts +0 -48
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/config.js +0 -42
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/content.d.ts +0 -12
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/content.js +0 -70
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/request.d.ts +0 -15
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/request.js +0 -241
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entities.client.d.ts +0 -101
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entities.client.js +0 -306
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference-expander.d.ts +0 -9
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference-expander.js +0 -86
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference.d.ts +0 -6
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference.js +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity.resource.registry.d.ts +0 -5
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity.resource.registry.js +0 -59
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/index.d.ts +0 -3
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/index.js +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/file-type-helper.d.ts +0 -3
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/file-type-helper.js +0 -24
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/files.d.ts +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/files.js +0 -151
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/index.d.ts +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/index.js +0 -26
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/notifications-dispatcher.d.ts +0 -16
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/notifications-dispatcher.js +0 -37
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies-cache.d.ts +0 -12
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies-cache.js +0 -55
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies.client.d.ts +0 -9
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies.client.js +0 -74
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/index.d.ts +0 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/index.js +0 -18
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/sub-types-helper.d.ts +0 -18
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/sub-types-helper.js +0 -98
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types-cache.d.ts +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types-cache.js +0 -73
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types.client.d.ts +0 -42
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types.client.js +0 -217
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/package.json +0 -64
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/scripts/replicate-bug.js +0 -69
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.6.0-alpha-8-alpha.
|
|
20
|
+
@contrail/cli/3.6.0-alpha-8-alpha.5396d7b linux-x64 node-v24.22.1
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -499,7 +499,7 @@ Set a variable in the configuration
|
|
|
499
499
|
```
|
|
500
500
|
USAGE
|
|
501
501
|
$ contrail config set [-l error|warn|info|debug] [-e true|false] [--orgSlug <value>] [--environment
|
|
502
|
-
dev|development|prod|production
|
|
502
|
+
dev|development|prod|production] [--apiUserToken <value>] [--config <value>]
|
|
503
503
|
|
|
504
504
|
FLAGS
|
|
505
505
|
-e, --alwaysConfirmEnv=<option> [default: true] The Environment variables
|
|
@@ -509,7 +509,7 @@ FLAGS
|
|
|
509
509
|
--apiUserToken=<value> The API User Token
|
|
510
510
|
--config=<value> The config name
|
|
511
511
|
--environment=<option> The Environment
|
|
512
|
-
<options: dev|development|prod|production
|
|
512
|
+
<options: dev|development|prod|production>
|
|
513
513
|
--orgSlug=<value> The org slug
|
|
514
514
|
|
|
515
515
|
DESCRIPTION
|
package/dist/auth/login.js
CHANGED
|
@@ -37,14 +37,7 @@ async function authUser() {
|
|
|
37
37
|
};
|
|
38
38
|
(0, sdk_1.setConfig)(sdk_1.Auth.config);
|
|
39
39
|
try {
|
|
40
|
-
|
|
41
|
-
return await refreshCurrentUserOrg().catch(async () => {
|
|
42
|
-
await (0, common_1.delay)(100);
|
|
43
|
-
return await refreshCurrentUserOrg().catch(async () => {
|
|
44
|
-
await (0, common_1.delay)(1000);
|
|
45
|
-
return await refreshCurrentUserOrg();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
40
|
+
return await refreshCurrentUserOrg();
|
|
48
41
|
}
|
|
49
42
|
catch (e) {
|
|
50
43
|
if (isNetworkConnectionError(e)) {
|
|
@@ -54,9 +47,7 @@ async function authUser() {
|
|
|
54
47
|
logger_1.default.info(`Failed to refresh token: ${e}. Requesting auth credentials...`);
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
|
-
|
|
58
|
-
await (0, config_1.storeConfig)(authContext);
|
|
59
|
-
return authContext;
|
|
50
|
+
return await authenticateWithUsernamePassword(config);
|
|
60
51
|
}
|
|
61
52
|
exports.authUser = authUser;
|
|
62
53
|
async function getOrgSlug(config) {
|
|
@@ -78,22 +69,21 @@ async function authenticateWithApiKey(config, apiKey, orgSlug) {
|
|
|
78
69
|
const apiGateway = getApiGateway(config);
|
|
79
70
|
sdk_1.Auth.config = {
|
|
80
71
|
apiUserToken: apiKey,
|
|
81
|
-
apiRefreshToken:
|
|
72
|
+
apiRefreshToken: null,
|
|
82
73
|
apiGateway,
|
|
83
74
|
orgSlug,
|
|
84
75
|
};
|
|
85
76
|
(0, sdk_1.setConfig)(sdk_1.Auth.config);
|
|
86
77
|
await (0, sdk_1.getCurrentUser)();
|
|
87
|
-
|
|
88
|
-
return Object.assign({}, sdk_1.Auth.config);
|
|
78
|
+
return returnAndStoreConfig(sdk_1.Auth.config);
|
|
89
79
|
}
|
|
90
80
|
async function authenticateWithUsernamePassword(config) {
|
|
91
81
|
const apiGateway = getApiGateway(config);
|
|
92
82
|
const environment = (0, config_1.findEnvironmentName)(apiGateway);
|
|
93
|
-
|
|
94
|
-
if (!environment || !cognitoConfig) {
|
|
83
|
+
if (!environment) {
|
|
95
84
|
throw new Error(`No Cognito user pool is known for ${apiGateway}. Email and password sign-in works for ${Object.keys(COGNITO_CONFIGS).join(' and ')}; use CONTRAIL_CLI_API_KEY for other environments.`);
|
|
96
85
|
}
|
|
86
|
+
const cognitoConfig = COGNITO_CONFIGS[environment];
|
|
97
87
|
const questions = [];
|
|
98
88
|
if (!process.env.CONTRAIL_CLI_EMAIL) {
|
|
99
89
|
questions.push({
|
|
@@ -172,9 +162,8 @@ async function setAuthContext(user, params) {
|
|
|
172
162
|
async function refreshCurrentUserOrg() {
|
|
173
163
|
logger_1.default.debug('refreshing current user org...');
|
|
174
164
|
const currentUser = await (0, sdk_1.getCurrentUser)().catch((e) => {
|
|
175
|
-
console.error('error getting current user', e.message);
|
|
176
165
|
if (isExpiredTokenError(e)) {
|
|
177
|
-
|
|
166
|
+
logger_1.default.debug('access token expired; attempting refresh');
|
|
178
167
|
return;
|
|
179
168
|
}
|
|
180
169
|
throw e;
|
|
@@ -194,12 +183,11 @@ async function refreshCurrentUserOrg() {
|
|
|
194
183
|
catch (e) {
|
|
195
184
|
throw Error(`Could not get refresh token: ${e}`);
|
|
196
185
|
}
|
|
197
|
-
await (0, config_1.storeConfig)(sdk_1.Auth.config);
|
|
198
186
|
}
|
|
199
187
|
// TODO: To uncomment when telemetry backend is developed.
|
|
200
188
|
// const current_Version = getVersionFromPackageJson();
|
|
201
189
|
// await checkTelemetry(current_Version);
|
|
202
|
-
return
|
|
190
|
+
return returnAndStoreConfig(sdk_1.Auth.config);
|
|
203
191
|
}
|
|
204
192
|
function isExpiredTokenError(e) {
|
|
205
193
|
return e?.message?.includes('token is expired');
|
|
@@ -250,6 +238,11 @@ function getVersionFromPackageJson() {
|
|
|
250
238
|
return packageJson.version;
|
|
251
239
|
}
|
|
252
240
|
exports.getVersionFromPackageJson = getVersionFromPackageJson;
|
|
241
|
+
async function returnAndStoreConfig(config) {
|
|
242
|
+
const configCopy = Object.assign({}, config);
|
|
243
|
+
await (0, config_1.storeConfig)(configCopy);
|
|
244
|
+
return configCopy;
|
|
245
|
+
}
|
|
253
246
|
function isNetworkConnectionError(e) {
|
|
254
247
|
const cause = e?.cause;
|
|
255
248
|
return cause?.code === 'ENOTFOUND' || cause?.code === 'ECONNREFUSED';
|
package/dist/basecommand.d.ts
CHANGED
|
@@ -8,9 +8,7 @@ export declare abstract class BaseCommand extends Command {
|
|
|
8
8
|
logLevel: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
9
|
};
|
|
10
10
|
protected flags: any;
|
|
11
|
-
protected args:
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
11
|
+
protected args: any;
|
|
14
12
|
init(): Promise<void>;
|
|
15
13
|
setLogLevel(logLevel: string, config?: any): void;
|
|
16
14
|
private confirmEnv;
|
package/dist/basecommand.js
CHANGED
|
@@ -15,7 +15,7 @@ class SetConfig extends basecommand_1.BaseCommand {
|
|
|
15
15
|
environment: core_1.Flags.string({
|
|
16
16
|
description: 'The Environment',
|
|
17
17
|
required: false,
|
|
18
|
-
options: ['dev', 'development', 'prod', 'production'
|
|
18
|
+
options: ['dev', 'development', 'prod', 'production'],
|
|
19
19
|
}),
|
|
20
20
|
apiUserToken: core_1.Flags.string({
|
|
21
21
|
description: 'The API User Token',
|
|
@@ -15,7 +15,6 @@ const defaultConfigFileLocation = (0, node_path_1.join)(configDirectoryLocation,
|
|
|
15
15
|
exports.ENVIRONMENTS = {
|
|
16
16
|
dev: 'https://api.dev.vibeiq.com/dev/api',
|
|
17
17
|
prod: 'https://api.vibeiq.com/prod/api',
|
|
18
|
-
local: 'http://localhost:3000/api',
|
|
19
18
|
};
|
|
20
19
|
function findEnvironmentName(apiGateway) {
|
|
21
20
|
const normalizedGateway = apiGateway?.trim().replace(/\/+$/, '').toLowerCase();
|
|
@@ -98,7 +97,7 @@ async function writeConfig(config, configName = null) {
|
|
|
98
97
|
const fileContent = await readVibeIQConfig();
|
|
99
98
|
configFileName = fileContent.configInUse;
|
|
100
99
|
}
|
|
101
|
-
|
|
100
|
+
await node_fs_1.promises.writeFile((0, node_path_1.join)(configDirectoryLocation, `${configFileName}.json`), JSON.stringify(config, null, 2));
|
|
102
101
|
}
|
|
103
102
|
catch (error) {
|
|
104
103
|
logger_1.default.error('Could not open config file for writing.');
|
|
@@ -106,12 +105,6 @@ async function writeConfig(config, configName = null) {
|
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
exports.writeConfig = writeConfig;
|
|
109
|
-
function atomicFileWriteSync(filePath, data) {
|
|
110
|
-
const randomId = Math.random().toString(36).substring(2, 15);
|
|
111
|
-
const tmpFilepath = `${filePath}.tmp-${randomId}`;
|
|
112
|
-
(0, node_fs_1.writeFileSync)(tmpFilepath, data);
|
|
113
|
-
(0, node_fs_1.renameSync)(tmpFilepath, filePath);
|
|
114
|
-
}
|
|
115
108
|
async function getConfig() {
|
|
116
109
|
let fileContent;
|
|
117
110
|
try {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { InvocationContext } from '../config';
|
|
2
|
+
export declare type ImageSearchSource = {
|
|
3
|
+
contentId: string;
|
|
4
|
+
} | {
|
|
5
|
+
fileId: string;
|
|
6
|
+
} | {
|
|
7
|
+
imageBase64: string;
|
|
8
|
+
};
|
|
9
|
+
export interface ImageSearchOptions {
|
|
10
|
+
limit?: number;
|
|
11
|
+
minScore?: number;
|
|
12
|
+
hydrate?: boolean;
|
|
13
|
+
filterContentIds?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface ImageSearchResult {
|
|
16
|
+
contentId: string;
|
|
17
|
+
fileId: string;
|
|
18
|
+
contentHolderReference: string;
|
|
19
|
+
fileName: string;
|
|
20
|
+
contentType: string;
|
|
21
|
+
primaryFileUrl: string;
|
|
22
|
+
score: number;
|
|
23
|
+
contentHolder?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface ImageSearchResponse {
|
|
26
|
+
results: ImageSearchResult[];
|
|
27
|
+
}
|
|
28
|
+
export declare class ImageSearch {
|
|
29
|
+
private ctx;
|
|
30
|
+
constructor(ctx?: InvocationContext);
|
|
31
|
+
searchByText(query: string, options?: ImageSearchOptions): Promise<ImageSearchResponse>;
|
|
32
|
+
searchSimilar(source: ImageSearchSource, options?: ImageSearchOptions): Promise<ImageSearchResponse>;
|
|
33
|
+
private post;
|
|
34
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ImageSearch = void 0;
|
|
13
|
+
const request_1 = require("../core/request");
|
|
14
|
+
const SEARCH_RESOURCE = '/image-search/search';
|
|
15
|
+
const SEARCH_BY_IMAGE_RESOURCE = '/image-search/search-by-image';
|
|
16
|
+
class ImageSearch {
|
|
17
|
+
constructor(ctx) {
|
|
18
|
+
this.ctx = ctx;
|
|
19
|
+
}
|
|
20
|
+
searchByText(query, options = {}) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return this.post(SEARCH_RESOURCE, Object.assign({ query }, options));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
searchSimilar(source, options = {}) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return this.post(SEARCH_BY_IMAGE_RESOURCE, Object.assign(Object.assign({}, source), options));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
post(resource, body) {
|
|
31
|
+
var _a;
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const response = (yield request_1.Request.request(resource, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
body: JSON.stringify(body),
|
|
36
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
|
|
37
|
+
}, this.ctx));
|
|
38
|
+
return { results: (_a = response === null || response === void 0 ? void 0 : response.results) !== null && _a !== void 0 ? _a : [] };
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.ImageSearch = ImageSearch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image-search';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./image-search"), exports);
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.6.0-alpha-8-alpha.
|
|
2
|
+
"version": "3.6.0-alpha-8-alpha.5396d7b",
|
|
3
3
|
"commands": {
|
|
4
4
|
"app:create": {
|
|
5
5
|
"id": "app:create",
|
|
@@ -604,8 +604,7 @@
|
|
|
604
604
|
"dev",
|
|
605
605
|
"development",
|
|
606
606
|
"prod",
|
|
607
|
-
"production"
|
|
608
|
-
"local"
|
|
607
|
+
"production"
|
|
609
608
|
]
|
|
610
609
|
},
|
|
611
610
|
"apiUserToken": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/cli",
|
|
3
|
-
"version": "3.6.0-alpha-8-alpha.
|
|
3
|
+
"version": "3.6.0-alpha-8-alpha.5396d7b",
|
|
4
4
|
"description": "VibeIQ's Contrail Platform CLI.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"contrail-cli": "./bin/run",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@contrail/entity-types": "^1.6.1",
|
|
34
34
|
"@contrail/loader": "^2.0.9",
|
|
35
35
|
"@contrail/org-config-migration": "^1.2.0",
|
|
36
|
-
"@contrail/sdk": "1.6.0
|
|
36
|
+
"@contrail/sdk": "^1.6.0",
|
|
37
37
|
"@contrail/types": "^3.1.5",
|
|
38
38
|
"@contrail/util": "^1.2.0",
|
|
39
39
|
"@oclif/core": "^2",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
## What
|
|
2
|
-
|
|
3
|
-
- [ ] Bugfix
|
|
4
|
-
- [ ] Feature
|
|
5
|
-
- [ ] Enhancement
|
|
6
|
-
|
|
7
|
-
Description:
|
|
8
|
-
|
|
9
|
-
<!--
|
|
10
|
-
Describe the functional changes of the PR.
|
|
11
|
-
|
|
12
|
-
If the mechanism of your change are complex, describe them in detail as you
|
|
13
|
-
would if you were explaining them to a team mate.
|
|
14
|
-
|
|
15
|
-
If the PR is simple, there is no need to repeat yourself. A small description
|
|
16
|
-
is sufficient.
|
|
17
|
-
-->
|
|
18
|
-
|
|
19
|
-
## Why
|
|
20
|
-
|
|
21
|
-
<!--
|
|
22
|
-
why is this change needed? Same rules as with #What
|
|
23
|
-
-->
|
|
24
|
-
|
|
25
|
-
## Testing added
|
|
26
|
-
|
|
27
|
-
<!--
|
|
28
|
-
Describe the testing you added to this PR
|
|
29
|
-
-->
|
|
30
|
-
|
|
31
|
-
## Link to Jira ticket(s)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
name: Check Code Formatting
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
paths:
|
|
5
|
-
- '**'
|
|
6
|
-
workflow_dispatch: # allow running in github actions manually
|
|
7
|
-
jobs:
|
|
8
|
-
check-formatting:
|
|
9
|
-
runs-on: ubuntu-24.04
|
|
10
|
-
steps:
|
|
11
|
-
- name: Node.js
|
|
12
|
-
uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version: 20
|
|
15
|
-
- uses: actions/checkout@v3
|
|
16
|
-
with:
|
|
17
|
-
lfs: true
|
|
18
|
-
- name: Checkout LFS objects
|
|
19
|
-
run: git lfs checkout
|
|
20
|
-
- name: NPM Install
|
|
21
|
-
env:
|
|
22
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
23
|
-
run: npm ci
|
|
24
|
-
- name: Check Format
|
|
25
|
-
working-directory: ./
|
|
26
|
-
run: npx prettier --check .
|
|
27
|
-
- name: Fail On Warnings
|
|
28
|
-
run: |
|
|
29
|
-
if [ $? -eq 0 ]; then
|
|
30
|
-
echo "No formatting issues found"
|
|
31
|
-
else
|
|
32
|
-
echo "Formatting issues found. Run 'npx prettier --write .' to fix them."
|
|
33
|
-
exit 1
|
|
34
|
-
fi
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: generate-sdk-docs
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- master
|
|
6
|
-
paths:
|
|
7
|
-
- '**'
|
|
8
|
-
workflow_dispatch: # allow running in github actions manually
|
|
9
|
-
jobs:
|
|
10
|
-
deploy-docs:
|
|
11
|
-
runs-on: ubuntu-24.04
|
|
12
|
-
steps:
|
|
13
|
-
- name: Node.js
|
|
14
|
-
uses: actions/setup-node@v3
|
|
15
|
-
with:
|
|
16
|
-
node-version: 16.17.0
|
|
17
|
-
|
|
18
|
-
- uses: actions/checkout@v3
|
|
19
|
-
|
|
20
|
-
- name: NPM Install
|
|
21
|
-
env:
|
|
22
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
23
|
-
run: npm ci
|
|
24
|
-
- name: Build SDK Docs
|
|
25
|
-
env:
|
|
26
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
27
|
-
run: npm run generate-docs
|
|
28
|
-
- name: Deploy 🚀
|
|
29
|
-
uses: JamesIves/github-pages-deploy-action@4.1.4
|
|
30
|
-
with:
|
|
31
|
-
branch: gh-pages
|
|
32
|
-
folder: docs
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [master]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: ['**']
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
check-version:
|
|
11
|
-
name: Verify version is available on npm
|
|
12
|
-
if: github.event_name == 'pull_request'
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Check version not already published
|
|
18
|
-
run: |
|
|
19
|
-
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
20
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
21
|
-
echo "Checking if ${PACKAGE_NAME}@${VERSION} exists on npm..."
|
|
22
|
-
if npm view "${PACKAGE_NAME}@${VERSION}" version 2>/dev/null; then
|
|
23
|
-
echo "::error::Version ${VERSION} is already published on npm. Bump the version in package.json before merging."
|
|
24
|
-
exit 1
|
|
25
|
-
else
|
|
26
|
-
echo "Version ${VERSION} is available."
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
check-dependencies:
|
|
30
|
-
name: Verify no private dependencies
|
|
31
|
-
runs-on: ubuntu-latest
|
|
32
|
-
steps:
|
|
33
|
-
- uses: actions/checkout@v4
|
|
34
|
-
|
|
35
|
-
- name: Verify no private dependencies
|
|
36
|
-
run: |
|
|
37
|
-
node -e "
|
|
38
|
-
const deps = require('./package.json').dependencies || {};
|
|
39
|
-
const { execSync } = require('child_process');
|
|
40
|
-
let failed = false;
|
|
41
|
-
for (const pkg of Object.keys(deps)) {
|
|
42
|
-
try {
|
|
43
|
-
execSync('npm view ' + pkg, { stdio: 'pipe' });
|
|
44
|
-
} catch {
|
|
45
|
-
console.error('::error::Dependency ' + pkg + ' is not publicly accessible on npm');
|
|
46
|
-
failed = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (failed) process.exit(1);
|
|
50
|
-
console.log('All ' + Object.keys(deps).length + ' dependencies are public.');
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
publish-alpha:
|
|
54
|
-
name: Publish alpha
|
|
55
|
-
needs: check-dependencies
|
|
56
|
-
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
|
57
|
-
runs-on: ubuntu-latest
|
|
58
|
-
permissions:
|
|
59
|
-
id-token: write
|
|
60
|
-
contents: read
|
|
61
|
-
outputs:
|
|
62
|
-
version: ${{ steps.publish.outputs.version }}
|
|
63
|
-
steps:
|
|
64
|
-
- uses: actions/checkout@v4
|
|
65
|
-
|
|
66
|
-
- uses: actions/setup-node@v4
|
|
67
|
-
with:
|
|
68
|
-
node-version: '24'
|
|
69
|
-
registry-url: 'https://registry.npmjs.org'
|
|
70
|
-
|
|
71
|
-
- name: Install and build
|
|
72
|
-
run: npm ci && npm run build
|
|
73
|
-
|
|
74
|
-
- name: Publish alpha
|
|
75
|
-
id: publish
|
|
76
|
-
run: |
|
|
77
|
-
SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)
|
|
78
|
-
VERSION=$(node -p "require('./package.json').version")-alpha.${SHORT_SHA}
|
|
79
|
-
npm version $VERSION --no-git-tag-version
|
|
80
|
-
OUTPUT=$(npm publish --tag alpha 2>&1) && {
|
|
81
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
82
|
-
} || {
|
|
83
|
-
if echo "$OUTPUT" | grep -q "You cannot publish over the previously published versions"; then
|
|
84
|
-
echo "::warning::Alpha ${VERSION} already published, skipping."
|
|
85
|
-
else
|
|
86
|
-
echo "::error::Failed to publish alpha ${VERSION}"
|
|
87
|
-
echo "$OUTPUT"
|
|
88
|
-
exit 1
|
|
89
|
-
fi
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
publish-release:
|
|
93
|
-
name: Publish release
|
|
94
|
-
needs: check-dependencies
|
|
95
|
-
if: github.event_name == 'push'
|
|
96
|
-
runs-on: ubuntu-latest
|
|
97
|
-
permissions:
|
|
98
|
-
id-token: write
|
|
99
|
-
contents: read
|
|
100
|
-
outputs:
|
|
101
|
-
version: ${{ steps.publish.outputs.version }}
|
|
102
|
-
steps:
|
|
103
|
-
- uses: actions/checkout@v4
|
|
104
|
-
|
|
105
|
-
- uses: actions/setup-node@v4
|
|
106
|
-
with:
|
|
107
|
-
node-version: '24'
|
|
108
|
-
registry-url: 'https://registry.npmjs.org'
|
|
109
|
-
|
|
110
|
-
- name: Install and build
|
|
111
|
-
run: npm ci && npm run build
|
|
112
|
-
|
|
113
|
-
- name: Publish release
|
|
114
|
-
id: publish
|
|
115
|
-
run: |
|
|
116
|
-
npm publish
|
|
117
|
-
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: sdk-lib-tests
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
# run this workflow when files these files change
|
|
5
|
-
paths:
|
|
6
|
-
- '**'
|
|
7
|
-
workflow_dispatch: # allow running in github actions manually
|
|
8
|
-
jobs:
|
|
9
|
-
test:
|
|
10
|
-
runs-on: ubuntu-24.04
|
|
11
|
-
steps:
|
|
12
|
-
- name: Node.js
|
|
13
|
-
uses: actions/setup-node@v3
|
|
14
|
-
with:
|
|
15
|
-
node-version: ${{ matrix.node-version }}
|
|
16
|
-
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
|
|
19
|
-
- name: NPM Install
|
|
20
|
-
env:
|
|
21
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
22
|
-
run: npm ci
|
|
23
|
-
|
|
24
|
-
- name: Unit Tests -
|
|
25
|
-
env:
|
|
26
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
27
|
-
run: npm test
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# [Contrail SDK](https://archergreysorg.github.io/contrail-lib/)
|
|
2
|
-
|
|
3
|
-
Functionality within the VibeIQ platform (Contrail) can be accessed and extended through a TypeScript SDK. The SDK is installable via the popular JavaScript Node Packages Manager `npm`.
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install @contrail/sdk --global
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
This will install the contrail SDK globally to your system, which will enable you to use it in any script, regardless of which directory it is in.
|
|
10
|
-
|
|
11
|
-
Alternatively, If you are using the SDK as part of a module you plan on packaging and sharing with other developers (or deploying to the cloud), you can add the SDK to your project:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @contrail/sdk
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Scripting vs App development
|
|
18
|
-
|
|
19
|
-
In the world of Javascript, code can be written as a one-off "script", run through the `node` interpreter, or packaged as part of an application. Below are examples on how to authenticate and print your username in each of these paradigms.
|
|
20
|
-
|
|
21
|
-
#### Scripting
|
|
22
|
-
|
|
23
|
-
To use the Contrail SDK as part of a one-off script, you can use the `require` javascript keyword.
|
|
24
|
-
|
|
25
|
-
```js title="script.js"
|
|
26
|
-
const contrail = require('@contrail/sdk');
|
|
27
|
-
|
|
28
|
-
// define an asynchronous function
|
|
29
|
-
const run = async () => {
|
|
30
|
-
await contrail.login({ orgSlug: 'YOUR-ORG-HERE', email: 'myEmail@example.com', password: 'neverInPlainText' });
|
|
31
|
-
|
|
32
|
-
// or using an api key like the one you can get from `contrail app getApiKey`
|
|
33
|
-
// await contrail.login({orgSlug: 'test-zone-1', apiKey: 'app:qwerty'})
|
|
34
|
-
|
|
35
|
-
const user = await contrail.getCurrentUser();
|
|
36
|
-
console.log('USER:', JSON.stringify(user, null, 2));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// run the function
|
|
40
|
-
run();
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
You can run your script using `node` in your shell.
|
|
44
|
-
|
|
45
|
-
```shell
|
|
46
|
-
node script.js
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
#### Packaged Module
|
|
50
|
-
|
|
51
|
-
If you intend on using the Contrail SDK as part of your packaging module, you may use the `import` keyword. You are more likely to use this when writing integrations as part of a web or server runtime.
|
|
52
|
-
|
|
53
|
-
```js title="someServerFile.js"
|
|
54
|
-
import { login, getCurrentUser } from '@contrail/sdk';
|
|
55
|
-
|
|
56
|
-
export async function run() {
|
|
57
|
-
await login({ orgSlug: 'YOUR-ORG-HERE', email: 'myEmail@example.com', password: 'neverInPlainText' });
|
|
58
|
-
|
|
59
|
-
// or using an api key like the one you can get from `contrail app getApiKey`
|
|
60
|
-
// await login({orgSlug: 'test-zone-1', apiKey: 'app:qwerty'})
|
|
61
|
-
|
|
62
|
-
const user = await getCurrentUser();
|
|
63
|
-
console.log('USER:', JSON.stringify(user, null, 2));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// run the function
|
|
67
|
-
run();
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
# General Documentation
|
|
71
|
-
|
|
72
|
-
Complete documentation for the VibeIQ platform lives on [https://docs.vibeiq.com/](https://docs.vibeiq.com/).
|