@liquidmetal-ai/raindrop 0.2.7 → 0.2.8
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 +67 -53
- package/dist/base-command.d.ts +9 -15
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +1 -17
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +6 -0
- package/dist/commands/auth/login.d.ts.map +1 -1
- package/dist/commands/auth/login.js +2 -1
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +4 -2
- package/dist/commands/build/list.d.ts.map +1 -1
- package/dist/commands/build/list.js +11 -6
- package/dist/commands/build/status.d.ts.map +1 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +31 -20
- package/dist/index.d.ts +14 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +859 -859
- package/package.json +4 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
1
2
|
import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
3
|
import { Flags } from '@oclif/core';
|
|
3
4
|
import { BaseCommand } from '../../base-command.js';
|
|
5
|
+
import { EPOCH_TS } from '../../index.js';
|
|
4
6
|
export default class Find extends BaseCommand {
|
|
5
7
|
static args = {};
|
|
6
8
|
static description = 'find resources in Raindrop';
|
|
@@ -72,7 +74,7 @@ export default class Find extends BaseCommand {
|
|
|
72
74
|
console.table(resp.resources.reduce((acc, v) => {
|
|
73
75
|
acc[v.name] = {
|
|
74
76
|
...v,
|
|
75
|
-
attributes: JSON.stringify(v.attributes
|
|
77
|
+
attributes: JSON.stringify(v.attributes, null, 2),
|
|
76
78
|
};
|
|
77
79
|
return acc;
|
|
78
80
|
},
|
|
@@ -84,7 +86,7 @@ export default class Find extends BaseCommand {
|
|
|
84
86
|
}
|
|
85
87
|
else {
|
|
86
88
|
for (const r of resp.resources) {
|
|
87
|
-
console.log(`${r.name} ${r.resourceId} ${r.applicationName} ${r.applicationVersionId} ${r.type} ${r.createdAt
|
|
89
|
+
console.log(`${r.name} ${r.resourceId} ${r.applicationName} ${r.applicationVersionId} ${r.type} ${timestampDate(r.createdAt || EPOCH_TS).toISOString()} ${timestampDate(r.updatedAt || EPOCH_TS).toISOString()} ${JSON.stringify(r.attributes)}`);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAGtH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,gCAAgC,CAAC;IAC9C,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAqC;IAEvD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;MAsBV;IAEF,gBAAgB,CAAC,YAAY,EAAE,gCAAgC,EAAE;;;;IAkCjE,iBAAiB,CAAC,YAAY,EAAE,gCAAgC,EAAE;IAqH5D,gBAAgB;IAyChB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { UnitState } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
2
|
+
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
2
3
|
import { Flags } from '@oclif/core';
|
|
3
4
|
import { BaseCommand } from '../../base-command.js';
|
|
5
|
+
import { EPOCH_TS } from '../../index.js';
|
|
4
6
|
export const statusString = {
|
|
5
7
|
[UnitState.UNSPECIFIED]: '<unknown>',
|
|
6
8
|
[UnitState.PENDING]: 'pending...',
|
|
@@ -109,8 +111,8 @@ List Raindrop catalog resources.
|
|
|
109
111
|
rootNodes.forEach((root) => flatten(root));
|
|
110
112
|
// Sort flattened nodes by timestamp (newest first)
|
|
111
113
|
flattenedNodes.sort((a, b) => {
|
|
112
|
-
const aTime = a.application.createdAt
|
|
113
|
-
const bTime = b.application.createdAt
|
|
114
|
+
const aTime = timestampDate(a.application.createdAt || EPOCH_TS).getTime() || 0;
|
|
115
|
+
const bTime = timestampDate(b.application.createdAt || EPOCH_TS).getTime() || 0;
|
|
114
116
|
return bTime - aTime;
|
|
115
117
|
});
|
|
116
118
|
// Generate graph lines
|
|
@@ -124,7 +126,8 @@ List Raindrop catalog resources.
|
|
|
124
126
|
const column = columnMap.get(node.versionId) || 0;
|
|
125
127
|
linesInUse.add(column);
|
|
126
128
|
// Format timestamp like git
|
|
127
|
-
const
|
|
129
|
+
const date = timestampDate(app.createdAt || EPOCH_TS);
|
|
130
|
+
const timestamp = date.toLocaleString('en-US', {
|
|
128
131
|
weekday: 'short',
|
|
129
132
|
month: 'short',
|
|
130
133
|
day: 'numeric',
|
|
@@ -187,8 +190,10 @@ List Raindrop catalog resources.
|
|
|
187
190
|
this.log(this.renderGitLogStyle(resp.applications));
|
|
188
191
|
}
|
|
189
192
|
else if (this.flags.output === 'table') {
|
|
190
|
-
console.table(resp.applications.reduce(
|
|
191
|
-
|
|
193
|
+
console.table(resp.applications.reduce(
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
195
|
+
(acc, a) => {
|
|
196
|
+
const dateStr = a.createdAt ? timestampDate(a.createdAt).toISOString() : '';
|
|
192
197
|
acc[dateStr] = {
|
|
193
198
|
...a,
|
|
194
199
|
status: statusString[a.state],
|
|
@@ -203,7 +208,7 @@ List Raindrop catalog resources.
|
|
|
203
208
|
}
|
|
204
209
|
else {
|
|
205
210
|
for (const a of resp.applications) {
|
|
206
|
-
console.log(`${a.createdAt
|
|
211
|
+
console.log(`${timestampDate(a.createdAt || EPOCH_TS).toISOString()} ${a.organizationId} ${a.versionId} ${a.name} (${a.isActive ? 'active' : 'inactive'})`);
|
|
207
212
|
}
|
|
208
213
|
}
|
|
209
214
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAIpG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAsCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAIpG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAsCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgE1B,iBAAiB,SAAK;IAEhB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BxD"}
|
package/dist/deploy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,OAAO,WAAW;IAEzD,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAGxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,MAAM,CAAC,CAAC,SAAS,OAAO,WAAW,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAoHrG"}
|
package/dist/deploy.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { create } from '@bufbuild/protobuf';
|
|
2
|
+
import { Code, ConnectError } from '@connectrpc/connect';
|
|
1
3
|
import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
4
|
import { listEnvVars } from '@liquidmetal-ai/drizzle/appify/index';
|
|
3
5
|
import { archive } from '@liquidmetal-ai/drizzle/codestore';
|
|
4
|
-
import { BundleArchiveType,
|
|
6
|
+
import { BundleArchiveType, ReleaseRequest_LockSchema, } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
5
7
|
import { FileSystemBundle } from '@liquidmetal-ai/drizzle/unsafe/codestore';
|
|
6
8
|
import fs from 'node:fs/promises';
|
|
7
9
|
import * as path from 'node:path';
|
|
@@ -27,24 +29,33 @@ export async function deploy(options) {
|
|
|
27
29
|
const { client: catalogService, userId, organizationId: defaultOrganizationId } = await command.catalogService();
|
|
28
30
|
const organizationId = options.impersonate ?? defaultOrganizationId;
|
|
29
31
|
// Deploy the application
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
let deployResp;
|
|
33
|
+
try {
|
|
34
|
+
deployResp = await catalogService.deploy({
|
|
35
|
+
userId,
|
|
36
|
+
organizationId,
|
|
37
|
+
applications: [
|
|
38
|
+
{
|
|
39
|
+
application: valueOf(app.name),
|
|
40
|
+
previousVersionId: options.previousVersionId,
|
|
41
|
+
currentVersionId: options.currentVersionId,
|
|
42
|
+
branch: options.branch,
|
|
43
|
+
amend: options.amend,
|
|
44
|
+
metadata: {
|
|
45
|
+
runtimeVersion,
|
|
46
|
+
},
|
|
47
|
+
manifest: manifestContents,
|
|
48
|
+
lock: options.lock,
|
|
42
49
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
if (err instanceof ConnectError && err.code === Code.FailedPrecondition) {
|
|
55
|
+
command.error(`Failed to ${options.amend ? 'amend' : 'deploy'} ${valueOf(app.name)}@${options.previousVersionId}=>${options.currentVersionId}: ${err.message}`);
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
48
59
|
if (deployResp.applications[0] === undefined) {
|
|
49
60
|
command.error('Failed to deploy application');
|
|
50
61
|
}
|
|
@@ -82,7 +93,7 @@ export async function deploy(options) {
|
|
|
82
93
|
await catalogService.release({
|
|
83
94
|
userId,
|
|
84
95
|
organizationId,
|
|
85
|
-
locks: deployResp.applications.map((a) =>
|
|
96
|
+
locks: deployResp.applications.map((a) => create(ReleaseRequest_LockSchema, {
|
|
86
97
|
applicationName: a.applicationName,
|
|
87
98
|
currentVersionId: a.currentVersionId,
|
|
88
99
|
lock: a.lock,
|
|
@@ -102,7 +113,7 @@ async function checkEnvironmentVariables(command, app, catalogService, userId, o
|
|
|
102
113
|
envs: Object.keys(envVars).map((key) => ({
|
|
103
114
|
applicationName: valueOf(app.name),
|
|
104
115
|
currentVersionId,
|
|
105
|
-
key
|
|
116
|
+
key,
|
|
106
117
|
})),
|
|
107
118
|
});
|
|
108
119
|
let unset = false;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type DescService } from '@bufbuild/protobuf';
|
|
2
|
+
import { type Client, Interceptor } from '@connectrpc/connect';
|
|
3
3
|
import { Application } from '@liquidmetal-ai/drizzle/appify/build';
|
|
4
|
-
import { CatalogService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/
|
|
5
|
-
import { RainbowAuthService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { SearchAgentService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/search_agent_connect';
|
|
4
|
+
import { CatalogService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
5
|
+
import { RainbowAuthService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/rainbow_auth_pb';
|
|
6
|
+
import { type RaindropState } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/raindrop_pb';
|
|
7
|
+
import { ObjectService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/resource_interface_pb';
|
|
8
|
+
import { SearchAgentService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/search_agent_pb';
|
|
10
9
|
export { run } from '@oclif/core';
|
|
10
|
+
export declare const EPOCH_TS: import("@bufbuild/protobuf/wkt").Timestamp;
|
|
11
11
|
export declare function configFromAppFile(appFile: string): Promise<Application[]>;
|
|
12
12
|
export declare function joinPath(...parts: string[]): string;
|
|
13
13
|
export type ServiceIdentity = {
|
|
@@ -16,29 +16,28 @@ export type ServiceIdentity = {
|
|
|
16
16
|
userId: string;
|
|
17
17
|
};
|
|
18
18
|
export declare function selectedOrganization(configDir: string): Promise<ServiceIdentity>;
|
|
19
|
-
export declare function createAuthenticateInterceptor(configDir: string, rainbowAuth:
|
|
19
|
+
export declare function createAuthenticateInterceptor(configDir: string, rainbowAuth: Client<typeof RainbowAuthService>, overrideAuthToken?: string): {
|
|
20
20
|
authenticate: Interceptor;
|
|
21
21
|
};
|
|
22
22
|
export declare function readState(configDir: string): Promise<RaindropState>;
|
|
23
23
|
export declare function replaceState(configDir: string, state: RaindropState): Promise<void>;
|
|
24
24
|
export declare function ensureDirectory(dir: string): Promise<void>;
|
|
25
25
|
export declare function rainbowAuthService(baseUrl: string): Promise<{
|
|
26
|
-
client:
|
|
26
|
+
client: Client<typeof RainbowAuthService>;
|
|
27
27
|
}>;
|
|
28
28
|
export declare function catalogService(opts: ServiceClientOptions): Promise<ServiceClient<typeof CatalogService>>;
|
|
29
29
|
export declare function searchAgentService(opts: ServiceClientOptions): Promise<ServiceClient<typeof SearchAgentService>>;
|
|
30
|
-
export declare function rainbowPublicService(opts: ServiceClientOptions): Promise<ServiceClient<typeof RainbowPublicService>>;
|
|
31
30
|
export declare function objectService(opts: ServiceClientOptions): Promise<ServiceClient<typeof ObjectService>>;
|
|
32
31
|
export type ServiceClientOptions = {
|
|
33
|
-
rainbowAuth:
|
|
32
|
+
rainbowAuth: Client<typeof RainbowAuthService>;
|
|
34
33
|
configDir: string;
|
|
35
34
|
identity: ServiceIdentity;
|
|
36
35
|
overrideAuthToken?: string;
|
|
37
36
|
};
|
|
38
|
-
export type ServiceClient<T extends
|
|
39
|
-
client:
|
|
37
|
+
export type ServiceClient<T extends DescService> = {
|
|
38
|
+
client: Client<T>;
|
|
40
39
|
userId: string;
|
|
41
40
|
organizationId: string;
|
|
42
41
|
};
|
|
43
|
-
export declare function serviceClient<T extends
|
|
42
|
+
export declare function serviceClient<T extends DescService>(service: T, { rainbowAuth, configDir, identity, overrideAuthToken }: ServiceClientOptions): Promise<ServiceClient<T>>;
|
|
44
43
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { create, toJsonString, fromJsonString } from '@bufbuild/protobuf';
|
|
2
|
+
import { timestampDate, timestampFromDate } from '@bufbuild/protobuf/wkt';
|
|
3
|
+
import { createClient } from '@connectrpc/connect';
|
|
2
4
|
import { createConnectTransport } from '@connectrpc/connect-web';
|
|
3
5
|
import { mustManifestFromString } from '@liquidmetal-ai/drizzle/appify/index';
|
|
4
|
-
import { CatalogService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/
|
|
5
|
-
import { RainbowAuthService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { SearchAgentService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/search_agent_connect';
|
|
6
|
+
import { CatalogService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
7
|
+
import { RainbowAuthService, RefreshAccessTokenRequestSchema, } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/rainbow_auth_pb';
|
|
8
|
+
import { RaindropStateSchema } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/raindrop_pb';
|
|
9
|
+
import { ObjectService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/resource_interface_pb';
|
|
10
|
+
import { SearchAgentService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/search_agent_pb';
|
|
10
11
|
import { Mutex } from 'async-mutex';
|
|
11
12
|
import { subSeconds, isAfter } from 'date-fns';
|
|
12
13
|
import * as fs from 'node:fs/promises';
|
|
13
14
|
import * as path from 'node:path';
|
|
14
15
|
export { run } from '@oclif/core';
|
|
16
|
+
export const EPOCH_TS = timestampFromDate(new Date(0));
|
|
15
17
|
export async function configFromAppFile(appFile) {
|
|
16
18
|
const contents = await fs.readFile(appFile, 'utf8');
|
|
17
19
|
return mustManifestFromString(contents);
|
|
@@ -43,15 +45,16 @@ async function bearerTokenAndRefresh(configDir, rainbowAuth) {
|
|
|
43
45
|
}
|
|
44
46
|
// Add 60 second buffer before expiration to ensure smooth token refresh
|
|
45
47
|
const EXPIRATION_BUFFER_SECONDS = 60; // 1 minute
|
|
46
|
-
const expirationDate = token.accessTokenExpiresAt
|
|
48
|
+
const expirationDate = timestampDate(token.accessTokenExpiresAt);
|
|
47
49
|
const earlierExpirationDate = subSeconds(expirationDate, EXPIRATION_BUFFER_SECONDS);
|
|
48
50
|
const now = new Date();
|
|
49
51
|
// expired is true if the current time is after the earlier expiration date
|
|
50
52
|
const expired = isAfter(now, earlierExpirationDate);
|
|
51
53
|
if (expired) {
|
|
52
|
-
const next = await rainbowAuth.refreshAccessToken({
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const next = await rainbowAuth.refreshAccessToken(create(RefreshAccessTokenRequestSchema, {
|
|
55
|
+
refreshToken: token.refreshToken,
|
|
56
|
+
organizationId: token.organizationId,
|
|
57
|
+
}));
|
|
55
58
|
if (!next.bearerToken) {
|
|
56
59
|
throw new Error('unable to refresh login');
|
|
57
60
|
}
|
|
@@ -99,14 +102,14 @@ export async function readState(configDir) {
|
|
|
99
102
|
await fs.access(filename, fs.constants.F_OK);
|
|
100
103
|
}
|
|
101
104
|
catch {
|
|
102
|
-
await replaceState(configDir,
|
|
105
|
+
await replaceState(configDir, create(RaindropStateSchema, {}));
|
|
103
106
|
}
|
|
104
107
|
const data = await fs.readFile(filename, { encoding: 'utf8' });
|
|
105
|
-
return
|
|
108
|
+
return fromJsonString(RaindropStateSchema, data);
|
|
106
109
|
}
|
|
107
110
|
export async function replaceState(configDir, state) {
|
|
108
111
|
const filename = path.join(configDir, configBasename);
|
|
109
|
-
const data =
|
|
112
|
+
const data = toJsonString(RaindropStateSchema, state, {
|
|
110
113
|
prettySpaces: 2,
|
|
111
114
|
});
|
|
112
115
|
// Ensure config directory exists as well
|
|
@@ -129,7 +132,7 @@ export async function ensureDirectory(dir) {
|
|
|
129
132
|
}
|
|
130
133
|
export async function rainbowAuthService(baseUrl) {
|
|
131
134
|
return {
|
|
132
|
-
client:
|
|
135
|
+
client: createClient(RainbowAuthService, createConnectTransport({
|
|
133
136
|
baseUrl,
|
|
134
137
|
})),
|
|
135
138
|
};
|
|
@@ -140,9 +143,6 @@ export async function catalogService(opts) {
|
|
|
140
143
|
export async function searchAgentService(opts) {
|
|
141
144
|
return serviceClient(SearchAgentService, opts);
|
|
142
145
|
}
|
|
143
|
-
export async function rainbowPublicService(opts) {
|
|
144
|
-
return serviceClient(RainbowPublicService, opts);
|
|
145
|
-
}
|
|
146
146
|
export async function objectService(opts) {
|
|
147
147
|
return serviceClient(ObjectService, opts);
|
|
148
148
|
}
|
|
@@ -150,7 +150,7 @@ export async function serviceClient(service, { rainbowAuth, configDir, identity,
|
|
|
150
150
|
const { baseUrl, organizationId, userId } = identity;
|
|
151
151
|
const { authenticate } = createAuthenticateInterceptor(configDir, rainbowAuth, overrideAuthToken);
|
|
152
152
|
return {
|
|
153
|
-
client:
|
|
153
|
+
client: createClient(service, createConnectTransport({
|
|
154
154
|
baseUrl,
|
|
155
155
|
interceptors: [authenticate],
|
|
156
156
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/base-command.ts","../src/build.test.ts","../src/build.ts","../src/codegen.test.ts","../src/codegen.ts","../src/config.test.ts","../src/config.ts","../src/deploy.ts","../src/index.test.ts","../src/index.ts","../src/commands/tail.ts","../src/commands/auth/list.ts","../src/commands/auth/login.ts","../src/commands/auth/logout.ts","../src/commands/auth/select.ts","../src/commands/build/branch.ts","../src/commands/build/checkout.ts","../src/commands/build/delete.ts","../src/commands/build/deploy.ts","../src/commands/build/find.ts","../src/commands/build/generate.ts","../src/commands/build/init.ts","../src/commands/build/list.ts","../src/commands/build/sandbox.ts","../src/commands/build/start.ts","../src/commands/build/status.ts","../src/commands/build/stop.ts","../src/commands/build/unsandbox.ts","../src/commands/build/upload.ts","../src/commands/build/validate.ts","../src/commands/build/env/get.ts","../src/commands/build/env/set.ts","../src/commands/build/tools/check.ts","../src/commands/build/tools/fmt.ts","../src/commands/object/delete.ts","../src/commands/object/get.ts","../src/commands/object/list.ts","../src/commands/object/put.ts","../src/commands/query/chunk-search.ts","../src/commands/query/register-retriever.ts","../src/commands/query/search.ts"],"version":"5.
|
|
1
|
+
{"root":["../src/base-command.ts","../src/build.test.ts","../src/build.ts","../src/codegen.test.ts","../src/codegen.ts","../src/config.test.ts","../src/config.ts","../src/deploy.ts","../src/index.test.ts","../src/index.ts","../src/commands/tail.ts","../src/commands/auth/list.ts","../src/commands/auth/login.ts","../src/commands/auth/logout.ts","../src/commands/auth/select.ts","../src/commands/build/branch.ts","../src/commands/build/checkout.ts","../src/commands/build/delete.ts","../src/commands/build/deploy.ts","../src/commands/build/find.ts","../src/commands/build/generate.ts","../src/commands/build/init.ts","../src/commands/build/list.ts","../src/commands/build/sandbox.ts","../src/commands/build/start.ts","../src/commands/build/status.ts","../src/commands/build/stop.ts","../src/commands/build/unsandbox.ts","../src/commands/build/upload.ts","../src/commands/build/validate.ts","../src/commands/build/env/get.ts","../src/commands/build/env/set.ts","../src/commands/build/tools/check.ts","../src/commands/build/tools/fmt.ts","../src/commands/object/delete.ts","../src/commands/object/get.ts","../src/commands/object/list.ts","../src/commands/object/put.ts","../src/commands/query/chunk-search.ts","../src/commands/query/register-retriever.ts","../src/commands/query/search.ts"],"version":"5.8.2"}
|