@revos/cli 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +59 -0
  2. package/dist/adapters/oclif/commands/action-runs/get.d.mts +6 -0
  3. package/dist/adapters/oclif/commands/action-runs/get.mjs +8 -0
  4. package/dist/adapters/oclif/commands/action-runs/list.d.mts +6 -0
  5. package/dist/adapters/oclif/commands/action-runs/list.mjs +8 -0
  6. package/dist/adapters/oclif/commands/actions/get-input-schema.d.mts +6 -0
  7. package/dist/adapters/oclif/commands/actions/get-input-schema.mjs +23 -0
  8. package/dist/adapters/oclif/commands/actions/get-params-schema.d.mts +6 -0
  9. package/dist/adapters/oclif/commands/actions/get-params-schema.mjs +23 -0
  10. package/dist/adapters/oclif/commands/actions/get.d.mts +6 -0
  11. package/dist/adapters/oclif/commands/actions/get.mjs +8 -0
  12. package/dist/adapters/oclif/commands/actions/list.d.mts +6 -0
  13. package/dist/adapters/oclif/commands/actions/list.mjs +27 -0
  14. package/dist/adapters/oclif/commands/ai-instructions/create.d.mts +6 -0
  15. package/dist/adapters/oclif/commands/ai-instructions/create.mjs +8 -0
  16. package/dist/adapters/oclif/commands/ai-instructions/delete.d.mts +6 -0
  17. package/dist/adapters/oclif/commands/ai-instructions/delete.mjs +8 -0
  18. package/dist/adapters/oclif/commands/ai-instructions/get.d.mts +6 -0
  19. package/dist/adapters/oclif/commands/ai-instructions/get.mjs +8 -0
  20. package/dist/adapters/oclif/commands/ai-instructions/list.d.mts +6 -0
  21. package/dist/adapters/oclif/commands/ai-instructions/list.mjs +8 -0
  22. package/dist/adapters/oclif/commands/ai-instructions/update.d.mts +6 -0
  23. package/dist/adapters/oclif/commands/ai-instructions/update.mjs +8 -0
  24. package/dist/adapters/oclif/commands/auth/login.d.mts +2 -2
  25. package/dist/adapters/oclif/commands/auth/login.mjs +2 -2
  26. package/dist/adapters/oclif/commands/auth/logout.d.mts +1 -1
  27. package/dist/adapters/oclif/commands/auth/logout.mjs +2 -2
  28. package/dist/adapters/oclif/commands/auth/status.d.mts +2 -2
  29. package/dist/adapters/oclif/commands/auth/status.mjs +2 -2
  30. package/dist/adapters/oclif/commands/gservice-account-keys/get.d.mts +6 -0
  31. package/dist/adapters/oclif/commands/gservice-account-keys/get.mjs +8 -0
  32. package/dist/adapters/oclif/commands/gservice-account-keys/reveal.d.mts +6 -0
  33. package/dist/adapters/oclif/commands/gservice-account-keys/reveal.mjs +14 -0
  34. package/dist/adapters/oclif/commands/gservice-accounts/create.d.mts +6 -0
  35. package/dist/adapters/oclif/commands/gservice-accounts/create.mjs +8 -0
  36. package/dist/adapters/oclif/commands/gservice-accounts/delete.d.mts +6 -0
  37. package/dist/adapters/oclif/commands/gservice-accounts/delete.mjs +8 -0
  38. package/dist/adapters/oclif/commands/gservice-accounts/get.d.mts +6 -0
  39. package/dist/adapters/oclif/commands/gservice-accounts/get.mjs +8 -0
  40. package/dist/adapters/oclif/commands/gservice-accounts/list.d.mts +6 -0
  41. package/dist/adapters/oclif/commands/gservice-accounts/list.mjs +8 -0
  42. package/dist/adapters/oclif/commands/init.d.mts +1 -1
  43. package/dist/adapters/oclif/commands/init.mjs +2 -2
  44. package/dist/adapters/oclif/commands/org/create.d.mts +6 -0
  45. package/dist/adapters/oclif/commands/org/create.mjs +8 -0
  46. package/dist/adapters/oclif/commands/org/current.d.mts +2 -2
  47. package/dist/adapters/oclif/commands/org/current.mjs +2 -2
  48. package/dist/adapters/oclif/commands/org/get.d.mts +6 -0
  49. package/dist/adapters/oclif/commands/org/get.mjs +8 -0
  50. package/dist/adapters/oclif/commands/org/list.d.mts +2 -2
  51. package/dist/adapters/oclif/commands/org/list.mjs +2 -2
  52. package/dist/adapters/oclif/commands/org/switch.d.mts +1 -1
  53. package/dist/adapters/oclif/commands/org/switch.mjs +2 -2
  54. package/dist/adapters/oclif/commands/overlays/diff.d.mts +2 -2
  55. package/dist/adapters/oclif/commands/overlays/diff.mjs +2 -2
  56. package/dist/adapters/oclif/commands/overlays/pull.d.mts +2 -2
  57. package/dist/adapters/oclif/commands/overlays/pull.mjs +2 -2
  58. package/dist/adapters/oclif/commands/overlays/push.d.mts +2 -2
  59. package/dist/adapters/oclif/commands/overlays/push.mjs +2 -2
  60. package/dist/adapters/oclif/commands/overlays/status.d.mts +2 -2
  61. package/dist/adapters/oclif/commands/overlays/status.mjs +2 -2
  62. package/dist/adapters/oclif/commands/score-groups/create.d.mts +6 -0
  63. package/dist/adapters/oclif/commands/score-groups/create.mjs +8 -0
  64. package/dist/adapters/oclif/commands/score-groups/delete.d.mts +6 -0
  65. package/dist/adapters/oclif/commands/score-groups/delete.mjs +8 -0
  66. package/dist/adapters/oclif/commands/score-groups/get.d.mts +6 -0
  67. package/dist/adapters/oclif/commands/score-groups/get.mjs +8 -0
  68. package/dist/adapters/oclif/commands/score-groups/list.d.mts +6 -0
  69. package/dist/adapters/oclif/commands/score-groups/list.mjs +8 -0
  70. package/dist/adapters/oclif/commands/score-groups/update.d.mts +6 -0
  71. package/dist/adapters/oclif/commands/score-groups/update.mjs +8 -0
  72. package/dist/adapters/oclif/commands/scores/create.d.mts +6 -0
  73. package/dist/adapters/oclif/commands/scores/create.mjs +8 -0
  74. package/dist/adapters/oclif/commands/scores/delete.d.mts +6 -0
  75. package/dist/adapters/oclif/commands/scores/delete.mjs +8 -0
  76. package/dist/adapters/oclif/commands/scores/list.d.mts +6 -0
  77. package/dist/adapters/oclif/commands/scores/list.mjs +8 -0
  78. package/dist/adapters/oclif/commands/scores/update.d.mts +6 -0
  79. package/dist/adapters/oclif/commands/scores/update.mjs +8 -0
  80. package/dist/adapters/oclif/commands/segments/create.d.mts +6 -0
  81. package/dist/adapters/oclif/commands/segments/create.mjs +8 -0
  82. package/dist/adapters/oclif/commands/segments/delete.d.mts +6 -0
  83. package/dist/adapters/oclif/commands/segments/delete.mjs +8 -0
  84. package/dist/adapters/oclif/commands/segments/evaluate.d.mts +6 -0
  85. package/dist/adapters/oclif/commands/segments/evaluate.mjs +14 -0
  86. package/dist/adapters/oclif/commands/segments/get-evaluation-history.d.mts +6 -0
  87. package/dist/adapters/oclif/commands/segments/get-evaluation-history.mjs +14 -0
  88. package/dist/adapters/oclif/commands/segments/get-version.d.mts +6 -0
  89. package/dist/adapters/oclif/commands/segments/get-version.mjs +23 -0
  90. package/dist/adapters/oclif/commands/segments/get.d.mts +6 -0
  91. package/dist/adapters/oclif/commands/segments/get.mjs +8 -0
  92. package/dist/adapters/oclif/commands/segments/list-versions.d.mts +6 -0
  93. package/dist/adapters/oclif/commands/segments/list-versions.mjs +29 -0
  94. package/dist/adapters/oclif/commands/segments/list.d.mts +6 -0
  95. package/dist/adapters/oclif/commands/segments/list.mjs +8 -0
  96. package/dist/adapters/oclif/commands/segments/restore-version.d.mts +6 -0
  97. package/dist/adapters/oclif/commands/segments/restore-version.mjs +23 -0
  98. package/dist/adapters/oclif/commands/segments/update.d.mts +6 -0
  99. package/dist/adapters/oclif/commands/segments/update.mjs +8 -0
  100. package/dist/adapters/oclif/commands/table-views/create.d.mts +6 -0
  101. package/dist/adapters/oclif/commands/table-views/create.mjs +8 -0
  102. package/dist/adapters/oclif/commands/table-views/delete.d.mts +6 -0
  103. package/dist/adapters/oclif/commands/table-views/delete.mjs +8 -0
  104. package/dist/adapters/oclif/commands/table-views/list.d.mts +6 -0
  105. package/dist/adapters/oclif/commands/table-views/list.mjs +8 -0
  106. package/dist/adapters/oclif/commands/table-views/update.d.mts +6 -0
  107. package/dist/adapters/oclif/commands/table-views/update.mjs +8 -0
  108. package/dist/adapters/oclif/commands/tables/create.d.mts +6 -0
  109. package/dist/adapters/oclif/commands/tables/create.mjs +8 -0
  110. package/dist/adapters/oclif/commands/tables/delete.d.mts +6 -0
  111. package/dist/adapters/oclif/commands/tables/delete.mjs +8 -0
  112. package/dist/adapters/oclif/commands/tables/get.d.mts +6 -0
  113. package/dist/adapters/oclif/commands/tables/get.mjs +8 -0
  114. package/dist/adapters/oclif/commands/tables/list.d.mts +6 -0
  115. package/dist/adapters/oclif/commands/tables/list.mjs +8 -0
  116. package/dist/adapters/oclif/commands/tables/update.d.mts +6 -0
  117. package/dist/adapters/oclif/commands/tables/update.mjs +8 -0
  118. package/dist/{base.command-CaFn9EwG.mjs → base.command-DlVQ9Cqa.mjs} +1 -1
  119. package/dist/{core-BSLZ9hQU.mjs → core-gKJ_V-K5.mjs} +1 -1
  120. package/dist/factory-D9sR_S_g.mjs +90 -0
  121. package/dist/{index-B8n2GxTc.d.mts → index-KAzwt5vr.d.mts} +2 -2
  122. package/dist/index.d.mts +3 -3
  123. package/dist/index.mjs +1 -1
  124. package/dist/presets-Cvazkjmu.mjs +98 -0
  125. package/dist/templates/dbt/profiles.yml +12 -0
  126. package/dist/templates/gitignore +19 -0
  127. package/package.json +2 -2
  128. /package/dist/{base.command-BjFWMIzL.d.mts → base.command-d7VW6WTp.d.mts} +0 -0
  129. /package/dist/{types-DmuJzN0Z.d.mts → types-C_p_6rkj.d.mts} +0 -0
  130. /package/dist/{types-DsQtGF-c.d.mts → types-Y_ht_ja5.d.mts} +0 -0
@@ -924,7 +924,7 @@ var InitService = class InitService {
924
924
  }),
925
925
  ".devcontainer/Dockerfile": this.renderTemplate(".devcontainer/Dockerfile", {}),
926
926
  ".devcontainer/setup.sh": this.renderTemplate(".devcontainer/setup.sh", {}),
927
- ".gitignore": this.renderTemplate(".gitignore", {}),
927
+ ".gitignore": this.renderTemplate("gitignore", {}),
928
928
  "README.md": this.renderTemplate("README.md", {
929
929
  projectName,
930
930
  orgName: org.name
@@ -0,0 +1,90 @@
1
+ import { p as createApiClient, y as getConfig } from "./core-gKJ_V-K5.mjs";
2
+ import { t as BaseCommand } from "./base.command-DlVQ9Cqa.mjs";
3
+ import * as fs from "fs";
4
+ import * as path from "path";
5
+ import chalk from "chalk";
6
+ import { Flags } from "@oclif/core";
7
+ //#region src/adapters/oclif/factory.ts
8
+ const bodyFlag = Flags.string({
9
+ description: "Request body. Inline JSON, '@path' to read a file, or '-' to read stdin.",
10
+ helpValue: "JSON|@file|-"
11
+ });
12
+ function defineApiCommand(spec) {
13
+ class ApiCmd extends BaseCommand {
14
+ static description = spec.description;
15
+ static examples = spec.examples ?? [];
16
+ static args = spec.args ?? {};
17
+ static flags = spec.flags ?? {};
18
+ async run() {
19
+ const api = createApiClient(await getConfig());
20
+ const flags = this.flags;
21
+ const body = await parseBody(typeof flags.body === "string" ? flags.body : void 0);
22
+ const result = await spec.call({
23
+ api,
24
+ args: this.args,
25
+ flags: this.flags,
26
+ body,
27
+ command: this
28
+ });
29
+ if (!this.jsonEnabled()) this.render(result);
30
+ return result;
31
+ }
32
+ render(data) {
33
+ if (spec.render) {
34
+ spec.render(data, this);
35
+ return;
36
+ }
37
+ defaultRender(this, data);
38
+ }
39
+ }
40
+ return ApiCmd;
41
+ }
42
+ async function parseBody(value) {
43
+ if (value === void 0) return void 0;
44
+ let raw;
45
+ if (value === "-") raw = await readStdin();
46
+ else if (value.startsWith("@")) {
47
+ const filePath = path.resolve(process.cwd(), value.slice(1));
48
+ raw = fs.readFileSync(filePath, "utf8");
49
+ } else raw = value;
50
+ try {
51
+ return JSON.parse(raw);
52
+ } catch (err) {
53
+ throw new Error(`--body is not valid JSON: ${err.message}`, { cause: err });
54
+ }
55
+ }
56
+ async function readStdin() {
57
+ const chunks = [];
58
+ for await (const chunk of process.stdin) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
59
+ return Buffer.concat(chunks).toString("utf8");
60
+ }
61
+ function defaultRender(cmd, data) {
62
+ if (data == null) return;
63
+ if (Array.isArray(data)) {
64
+ if (data.length === 0) {
65
+ cmd.log("(no results)");
66
+ return;
67
+ }
68
+ const rows = data.map((d) => toRow(d));
69
+ cmd.table(rows);
70
+ return;
71
+ }
72
+ if (typeof data === "object") {
73
+ for (const [k, v] of Object.entries(data)) cmd.log(`${chalk.bold(k)}: ${formatValue(v)}`);
74
+ return;
75
+ }
76
+ cmd.log(String(data));
77
+ }
78
+ function toRow(d) {
79
+ if (d == null || typeof d !== "object") return { value: d };
80
+ const out = {};
81
+ for (const [k, v] of Object.entries(d)) out[k] = formatValue(v);
82
+ return out;
83
+ }
84
+ function formatValue(v) {
85
+ if (v == null) return "";
86
+ if (typeof v === "object") return JSON.stringify(v);
87
+ return String(v);
88
+ }
89
+ //#endregion
90
+ export { defineApiCommand as n, bodyFlag as t };
@@ -1,5 +1,5 @@
1
- import { d as PushResult, f as StatusResult, o as DiffResult, r as CubeOverlay, s as OverlayFile, t as Config, u as PullResult } from "./types-DmuJzN0Z.mjs";
2
- import { c as StoredCredentials, i as OAuthCallbackResult, l as TokenResponse, r as ClerkUserInfo, s as OrganizationInfo } from "./types-DsQtGF-c.mjs";
1
+ import { d as PushResult, f as StatusResult, o as DiffResult, r as CubeOverlay, s as OverlayFile, t as Config, u as PullResult } from "./types-C_p_6rkj.mjs";
2
+ import { c as StoredCredentials, i as OAuthCallbackResult, l as TokenResponse, r as ClerkUserInfo, s as OrganizationInfo } from "./types-Y_ht_ja5.mjs";
3
3
  import { Client } from "@revos/api-client";
4
4
 
5
5
  //#region src/core/errors.d.ts
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as DiffEntry, c as OverlayFileData, d as PushResult, f as StatusResult, i as DiffChange, l as OverlayStatusInfo, n as CubeDefinition, o as DiffResult, p as SyncStatus, r as CubeOverlay, s as OverlayFile, t as Config, u as PullResult } from "./types-DmuJzN0Z.mjs";
2
- import { A as ClerkEnv, B as tokenResponseToCredentials, C as LoadedOverlay, D as loadOverlaysByNames, E as loadOverlays, F as generatePKCEChallenge, G as isTokenExpired, H as startOAuthServer, I as getUserInfo, J as getConfig, K as loadCredentials, L as refreshAccessToken, M as PKCEChallenge, N as buildAuthorizationUrl, O as loadOverlaysFromDir, P as exchangeCodeForTokens, R as setClerkConfig, S as sanitizeFileName, T as loadOverlayFile, U as deleteCredentials, V as OAuthServerResult, W as getCredentialsPath, Y as ApiError, _ as createApiClient, a as DiffOptions, b as formatError, c as StatusOptions, d as PullOptions, f as PullService, g as ApiClient, h as PushService, i as DiffContext, j as ClerkOAuthConfig, k as saveOverlayToFile, l as StatusService, m as PushOptions, n as InitResult, o as DiffService, p as PushContext, q as saveCredentials, r as InitService, s as StatusContext, t as InitOptions, u as PullContext, v as unwrap, w as getLocalOverlayNames, x as isContentEqual, y as findRemoteOnlyOverlays, z as setClerkEnv } from "./index-B8n2GxTc.mjs";
3
- import { a as OrgListResult, c as StoredCredentials, i as OAuthCallbackResult, l as TokenResponse, n as AuthStatusInfo, o as OrgSwitchResult, r as ClerkUserInfo, s as OrganizationInfo, t as AuthResult } from "./types-DsQtGF-c.mjs";
1
+ import { a as DiffEntry, c as OverlayFileData, d as PushResult, f as StatusResult, i as DiffChange, l as OverlayStatusInfo, n as CubeDefinition, o as DiffResult, p as SyncStatus, r as CubeOverlay, s as OverlayFile, t as Config, u as PullResult } from "./types-C_p_6rkj.mjs";
2
+ import { A as ClerkEnv, B as tokenResponseToCredentials, C as LoadedOverlay, D as loadOverlaysByNames, E as loadOverlays, F as generatePKCEChallenge, G as isTokenExpired, H as startOAuthServer, I as getUserInfo, J as getConfig, K as loadCredentials, L as refreshAccessToken, M as PKCEChallenge, N as buildAuthorizationUrl, O as loadOverlaysFromDir, P as exchangeCodeForTokens, R as setClerkConfig, S as sanitizeFileName, T as loadOverlayFile, U as deleteCredentials, V as OAuthServerResult, W as getCredentialsPath, Y as ApiError, _ as createApiClient, a as DiffOptions, b as formatError, c as StatusOptions, d as PullOptions, f as PullService, g as ApiClient, h as PushService, i as DiffContext, j as ClerkOAuthConfig, k as saveOverlayToFile, l as StatusService, m as PushOptions, n as InitResult, o as DiffService, p as PushContext, q as saveCredentials, r as InitService, s as StatusContext, t as InitOptions, u as PullContext, v as unwrap, w as getLocalOverlayNames, x as isContentEqual, y as findRemoteOnlyOverlays, z as setClerkEnv } from "./index-KAzwt5vr.mjs";
3
+ import { a as OrgListResult, c as StoredCredentials, i as OAuthCallbackResult, l as TokenResponse, n as AuthStatusInfo, o as OrgSwitchResult, r as ClerkUserInfo, s as OrganizationInfo, t as AuthResult } from "./types-Y_ht_ja5.mjs";
4
4
  export { ApiClient, ApiError, AuthResult, AuthStatusInfo, ClerkEnv, ClerkOAuthConfig, ClerkUserInfo, Config, CubeDefinition, CubeOverlay, DiffChange, DiffContext, DiffEntry, DiffOptions, DiffResult, DiffService, InitOptions, InitResult, InitService, LoadedOverlay, OAuthCallbackResult, OAuthServerResult, OrgListResult, OrgSwitchResult, OrganizationInfo, OverlayFile, OverlayFileData, OverlayStatusInfo, PKCEChallenge, PullContext, PullOptions, PullResult, PullService, PushContext, PushOptions, PushResult, PushService, StatusContext, StatusOptions, StatusResult, StatusService, StoredCredentials, SyncStatus, TokenResponse, buildAuthorizationUrl, createApiClient, deleteCredentials, exchangeCodeForTokens, findRemoteOnlyOverlays, formatError, generatePKCEChallenge, getConfig, getCredentialsPath, getLocalOverlayNames, getUserInfo, isContentEqual, isTokenExpired, loadCredentials, loadOverlayFile, loadOverlays, loadOverlaysByNames, loadOverlaysFromDir, refreshAccessToken, sanitizeFileName, saveCredentials, saveOverlayToFile, setClerkConfig, setClerkEnv, startOAuthServer, tokenResponseToCredentials, unwrap };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { A as getCredentialsPath, C as getUserInfo, D as tokenResponseToCredentials, E as setClerkEnv, M as loadCredentials, N as saveCredentials, O as startOAuthServer, P as ApiError, S as generatePKCEChallenge, T as setClerkConfig, _ as isContentEqual, a as PullService, b as buildAuthorizationUrl, c as loadOverlayFile, d as loadOverlaysFromDir, f as saveOverlayToFile, g as formatError, h as findRemoteOnlyOverlays, i as StatusService, j as isTokenExpired, k as deleteCredentials, l as loadOverlays, m as unwrap, o as PushService, p as createApiClient, r as DiffService, s as getLocalOverlayNames, t as InitService, u as loadOverlaysByNames, v as sanitizeFileName, w as refreshAccessToken, x as exchangeCodeForTokens, y as getConfig } from "./core-BSLZ9hQU.mjs";
1
+ import { A as getCredentialsPath, C as getUserInfo, D as tokenResponseToCredentials, E as setClerkEnv, M as loadCredentials, N as saveCredentials, O as startOAuthServer, P as ApiError, S as generatePKCEChallenge, T as setClerkConfig, _ as isContentEqual, a as PullService, b as buildAuthorizationUrl, c as loadOverlayFile, d as loadOverlaysFromDir, f as saveOverlayToFile, g as formatError, h as findRemoteOnlyOverlays, i as StatusService, j as isTokenExpired, k as deleteCredentials, l as loadOverlays, m as unwrap, o as PushService, p as createApiClient, r as DiffService, s as getLocalOverlayNames, t as InitService, u as loadOverlaysByNames, v as sanitizeFileName, w as refreshAccessToken, x as exchangeCodeForTokens, y as getConfig } from "./core-gKJ_V-K5.mjs";
2
2
  export { ApiError, DiffService, InitService, PullService, PushService, StatusService, buildAuthorizationUrl, createApiClient, deleteCredentials, exchangeCodeForTokens, findRemoteOnlyOverlays, formatError, generatePKCEChallenge, getConfig, getCredentialsPath, getLocalOverlayNames, getUserInfo, isContentEqual, isTokenExpired, loadCredentials, loadOverlayFile, loadOverlays, loadOverlaysByNames, loadOverlaysFromDir, refreshAccessToken, sanitizeFileName, saveCredentials, saveOverlayToFile, setClerkConfig, setClerkEnv, startOAuthServer, tokenResponseToCredentials, unwrap };
@@ -0,0 +1,98 @@
1
+ import { m as unwrap } from "./core-gKJ_V-K5.mjs";
2
+ import { n as defineApiCommand, t as bodyFlag } from "./factory-D9sR_S_g.mjs";
3
+ import { Args, Flags } from "@oclif/core";
4
+ //#region src/adapters/oclif/presets.ts
5
+ const listFlags = {
6
+ "page-size": Flags.integer({ description: "Maximum number of items to return" }),
7
+ "page-token": Flags.string({ description: "Token for the next page (from previous response)" }),
8
+ "order-by": Flags.string({ description: "Field to order results by (e.g. 'createdAt desc')" }),
9
+ filter: Flags.string({ description: "Filter expression" }),
10
+ fields: Flags.string({ description: "Comma-separated list of fields to include" })
11
+ };
12
+ function getResource(api, key) {
13
+ return api[key];
14
+ }
15
+ function listCommand(spec) {
16
+ return defineApiCommand({
17
+ description: spec.description,
18
+ flags: listFlags,
19
+ call: async ({ api, flags }) => {
20
+ const resource = getResource(api, spec.resource);
21
+ if (!resource.list) throw new Error(`Resource '${String(spec.resource)}' has no list method`);
22
+ const params = {};
23
+ if (flags["page-size"] !== void 0) params.pageSize = flags["page-size"];
24
+ if (flags["page-token"] !== void 0) params.pageToken = flags["page-token"];
25
+ if (flags["order-by"] !== void 0) params.orderBy = flags["order-by"];
26
+ if (flags.filter !== void 0) params.filter = flags.filter;
27
+ if (flags.fields !== void 0) params.fields = flags.fields;
28
+ return unwrap(await resource.list(Object.keys(params).length > 0 ? params : void 0));
29
+ }
30
+ });
31
+ }
32
+ function getCommand(spec) {
33
+ return defineApiCommand({
34
+ description: spec.description,
35
+ args: { id: Args.string({
36
+ description: "Resource ID",
37
+ required: true
38
+ }) },
39
+ call: async ({ api, args }) => {
40
+ const resource = getResource(api, spec.resource);
41
+ if (!resource.get) throw new Error(`Resource '${String(spec.resource)}' has no get method`);
42
+ return unwrap(await resource.get({ id: args.id }));
43
+ }
44
+ });
45
+ }
46
+ function createCommand(spec) {
47
+ return defineApiCommand({
48
+ description: spec.description,
49
+ flags: { body: bodyFlag },
50
+ call: async ({ api, body }) => {
51
+ const resource = getResource(api, spec.resource);
52
+ if (!resource.create) throw new Error(`Resource '${String(spec.resource)}' has no create method`);
53
+ if (body === void 0) throw new Error("--body is required (inline JSON, '@path' for file, or '-' for stdin)");
54
+ return unwrap(await resource.create({ body }));
55
+ }
56
+ });
57
+ }
58
+ function updateCommand(spec) {
59
+ return defineApiCommand({
60
+ description: spec.description,
61
+ args: { id: Args.string({
62
+ description: "Resource ID",
63
+ required: true
64
+ }) },
65
+ flags: { body: bodyFlag },
66
+ call: async ({ api, args, body }) => {
67
+ const resource = getResource(api, spec.resource);
68
+ if (!resource.update) throw new Error(`Resource '${String(spec.resource)}' has no update method`);
69
+ if (body === void 0) throw new Error("--body is required (inline JSON, '@path' for file, or '-' for stdin)");
70
+ return unwrap(await resource.update({
71
+ id: args.id,
72
+ body
73
+ }));
74
+ }
75
+ });
76
+ }
77
+ function deleteCommand(spec) {
78
+ return defineApiCommand({
79
+ description: spec.description,
80
+ args: { id: Args.string({
81
+ description: "Resource ID",
82
+ required: true
83
+ }) },
84
+ call: async ({ api, args }) => {
85
+ const resource = getResource(api, spec.resource);
86
+ if (!resource.delete) throw new Error(`Resource '${String(spec.resource)}' has no delete method`);
87
+ return unwrap(await resource.delete({ id: args.id })) ?? {
88
+ id: args.id,
89
+ deleted: true
90
+ };
91
+ },
92
+ render: (_data, command) => {
93
+ command.log(`Deleted.`);
94
+ }
95
+ });
96
+ }
97
+ //#endregion
98
+ export { updateCommand as a, listCommand as i, deleteCommand as n, getCommand as r, createCommand as t };
@@ -0,0 +1,12 @@
1
+ revos:
2
+ target: dev
3
+ outputs:
4
+ dev:
5
+ type: bigquery
6
+ method: service-account
7
+ project: "{{ env_var('GOOGLE_CLOUD_PROJECT') }}"
8
+ dataset: "{{ env_var('REVOS_BQ_DATASET') }}"
9
+ keyfile: "{{ env_var('GOOGLE_APPLICATION_CREDENTIALS') }}"
10
+ threads: 4
11
+ timeout_seconds: 300
12
+ location: <%=bqLocation%>
@@ -0,0 +1,19 @@
1
+ # dbt
2
+ dbt/target/
3
+ dbt/logs/
4
+ dbt/dbt_packages/
5
+ dbt/profiles.yml
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ .venv/
11
+ venv/
12
+
13
+ # Node
14
+ node_modules/
15
+
16
+ # Local env
17
+ .env
18
+ .env.*
19
+ !.env.example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revos/cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "RevOS CLI for managing RevOS platform resources",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -57,7 +57,7 @@
57
57
  "jest": "^29.7.0",
58
58
  "tsdown": "^0.21.9",
59
59
  "typescript": "^5.7.2",
60
- "@revosai/config-eslint": "0.0.0"
60
+ "@revos/config-eslint": "0.0.0"
61
61
  },
62
62
  "publishConfig": {
63
63
  "registry": "https://registry.npmjs.org",