@pawabase/client 0.1.3 → 0.1.4

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 (138) hide show
  1. package/README.md +7 -10
  2. package/dist/cjs/admin.d.ts +70 -0
  3. package/dist/cjs/admin.d.ts.map +1 -1
  4. package/dist/cjs/admin.js +75 -1
  5. package/dist/cjs/admin.js.map +1 -1
  6. package/dist/cjs/ai.d.ts +73 -0
  7. package/dist/cjs/ai.d.ts.map +1 -0
  8. package/dist/cjs/ai.js +120 -0
  9. package/dist/cjs/ai.js.map +1 -0
  10. package/dist/cjs/auth.d.ts +38 -0
  11. package/dist/cjs/auth.d.ts.map +1 -1
  12. package/dist/cjs/auth.js +52 -0
  13. package/dist/cjs/auth.js.map +1 -1
  14. package/dist/cjs/client.d.ts +18 -3
  15. package/dist/cjs/client.d.ts.map +1 -1
  16. package/dist/cjs/client.js +30 -3
  17. package/dist/cjs/client.js.map +1 -1
  18. package/dist/cjs/data.d.ts +28 -0
  19. package/dist/cjs/data.d.ts.map +1 -1
  20. package/dist/cjs/data.js +42 -7
  21. package/dist/cjs/data.js.map +1 -1
  22. package/dist/cjs/errors.d.ts +1 -1
  23. package/dist/cjs/errors.d.ts.map +1 -1
  24. package/dist/cjs/errors.js +8 -1
  25. package/dist/cjs/errors.js.map +1 -1
  26. package/dist/cjs/functions.d.ts +0 -28
  27. package/dist/cjs/functions.d.ts.map +1 -1
  28. package/dist/cjs/functions.js +1 -42
  29. package/dist/cjs/functions.js.map +1 -1
  30. package/dist/cjs/index.d.ts +4 -2
  31. package/dist/cjs/index.d.ts.map +1 -1
  32. package/dist/cjs/index.js +3 -2
  33. package/dist/cjs/index.js.map +1 -1
  34. package/dist/cjs/manage/access.d.ts +3 -3
  35. package/dist/cjs/manage/access.d.ts.map +1 -1
  36. package/dist/cjs/manage/access.js +3 -3
  37. package/dist/cjs/manage/access.js.map +1 -1
  38. package/dist/cjs/manage/ai.d.ts +90 -0
  39. package/dist/cjs/manage/ai.d.ts.map +1 -0
  40. package/dist/cjs/manage/ai.js +101 -0
  41. package/dist/cjs/manage/ai.js.map +1 -0
  42. package/dist/cjs/manage/data.d.ts +1 -1
  43. package/dist/cjs/manage/data.d.ts.map +1 -1
  44. package/dist/cjs/manage/data.js +1 -1
  45. package/dist/cjs/manage/data.js.map +1 -1
  46. package/dist/cjs/manage/index.d.ts +2 -3
  47. package/dist/cjs/manage/index.d.ts.map +1 -1
  48. package/dist/cjs/manage/index.js +4 -4
  49. package/dist/cjs/manage/index.js.map +1 -1
  50. package/dist/cjs/manage/mail.d.ts +1 -1
  51. package/dist/cjs/manage/mail.d.ts.map +1 -1
  52. package/dist/cjs/manage/mail.js +1 -1
  53. package/dist/cjs/manage/mail.js.map +1 -1
  54. package/dist/cjs/types.d.ts +3 -3
  55. package/dist/cjs/types.d.ts.map +1 -1
  56. package/dist/cjs/version.d.ts +1 -1
  57. package/dist/cjs/version.js +1 -1
  58. package/dist/esm/admin.d.ts +70 -0
  59. package/dist/esm/admin.d.ts.map +1 -1
  60. package/dist/esm/admin.js +72 -0
  61. package/dist/esm/admin.js.map +1 -1
  62. package/dist/esm/ai.d.ts +73 -0
  63. package/dist/esm/ai.d.ts.map +1 -0
  64. package/dist/esm/ai.js +116 -0
  65. package/dist/esm/ai.js.map +1 -0
  66. package/dist/esm/auth.d.ts +38 -0
  67. package/dist/esm/auth.d.ts.map +1 -1
  68. package/dist/esm/auth.js +52 -0
  69. package/dist/esm/auth.js.map +1 -1
  70. package/dist/esm/client.d.ts +18 -3
  71. package/dist/esm/client.d.ts.map +1 -1
  72. package/dist/esm/client.js +31 -4
  73. package/dist/esm/client.js.map +1 -1
  74. package/dist/esm/data.d.ts +28 -0
  75. package/dist/esm/data.d.ts.map +1 -1
  76. package/dist/esm/data.js +42 -7
  77. package/dist/esm/data.js.map +1 -1
  78. package/dist/esm/errors.d.ts +1 -1
  79. package/dist/esm/errors.d.ts.map +1 -1
  80. package/dist/esm/errors.js +8 -1
  81. package/dist/esm/errors.js.map +1 -1
  82. package/dist/esm/functions.d.ts +0 -28
  83. package/dist/esm/functions.d.ts.map +1 -1
  84. package/dist/esm/functions.js +0 -40
  85. package/dist/esm/functions.js.map +1 -1
  86. package/dist/esm/index.d.ts +4 -2
  87. package/dist/esm/index.d.ts.map +1 -1
  88. package/dist/esm/index.js +2 -1
  89. package/dist/esm/index.js.map +1 -1
  90. package/dist/esm/manage/access.d.ts +3 -3
  91. package/dist/esm/manage/access.d.ts.map +1 -1
  92. package/dist/esm/manage/access.js +3 -3
  93. package/dist/esm/manage/access.js.map +1 -1
  94. package/dist/esm/manage/ai.d.ts +90 -0
  95. package/dist/esm/manage/ai.d.ts.map +1 -0
  96. package/dist/esm/manage/ai.js +97 -0
  97. package/dist/esm/manage/ai.js.map +1 -0
  98. package/dist/esm/manage/data.d.ts +1 -1
  99. package/dist/esm/manage/data.d.ts.map +1 -1
  100. package/dist/esm/manage/data.js +1 -1
  101. package/dist/esm/manage/data.js.map +1 -1
  102. package/dist/esm/manage/index.d.ts +2 -3
  103. package/dist/esm/manage/index.d.ts.map +1 -1
  104. package/dist/esm/manage/index.js +4 -4
  105. package/dist/esm/manage/index.js.map +1 -1
  106. package/dist/esm/manage/mail.d.ts +1 -1
  107. package/dist/esm/manage/mail.d.ts.map +1 -1
  108. package/dist/esm/manage/mail.js +1 -1
  109. package/dist/esm/manage/mail.js.map +1 -1
  110. package/dist/esm/types.d.ts +3 -3
  111. package/dist/esm/types.d.ts.map +1 -1
  112. package/dist/esm/version.d.ts +1 -1
  113. package/dist/esm/version.js +1 -1
  114. package/package.json +1 -1
  115. package/src/admin.ts +104 -0
  116. package/src/ai.ts +155 -0
  117. package/src/auth.ts +70 -0
  118. package/src/client.ts +31 -4
  119. package/src/data.ts +52 -5
  120. package/src/errors.ts +6 -1
  121. package/src/functions.ts +0 -49
  122. package/src/index.ts +4 -1
  123. package/src/manage/access.ts +3 -3
  124. package/src/manage/ai.ts +129 -0
  125. package/src/manage/data.ts +1 -1
  126. package/src/manage/index.ts +4 -4
  127. package/src/manage/mail.ts +1 -1
  128. package/src/types.ts +3 -3
  129. package/src/version.ts +1 -1
  130. package/dist/cjs/manage/functions.d.ts +0 -48
  131. package/dist/cjs/manage/functions.d.ts.map +0 -1
  132. package/dist/cjs/manage/functions.js +0 -61
  133. package/dist/cjs/manage/functions.js.map +0 -1
  134. package/dist/esm/manage/functions.d.ts +0 -48
  135. package/dist/esm/manage/functions.d.ts.map +0 -1
  136. package/dist/esm/manage/functions.js +0 -57
  137. package/dist/esm/manage/functions.js.map +0 -1
  138. package/src/manage/functions.ts +0 -69
@@ -0,0 +1,129 @@
1
+ import { Service, seg, type Api, type Body } from "./base.js";
2
+
3
+ /**
4
+ * The AI gateway of the environment: connect providers (OpenAI, Anthropic, Gemini, Mistral, Groq, or any OpenAI-compatible server), expose
5
+ * models by name, try them, and read what they cost. Provider keys are sealed on arrival and never returned.
6
+ */
7
+ export class Ai extends Service {
8
+ protected override path(suffix = ""): string {
9
+ return super.path(`/ai${suffix}`);
10
+ }
11
+
12
+ /** The kinds of provider that can be connected, with suggested models. */
13
+ catalog(): Promise<Api> {
14
+ return this.get("/catalog");
15
+ }
16
+
17
+ providers(): Promise<Api> {
18
+ return this.get("/providers");
19
+ }
20
+
21
+ /** The models a connected provider offers this key, asked live: `{ data: [{ id, kind, label }], source: "provider" | "catalog", error }`. */
22
+ providerModels(name: string): Promise<Api> {
23
+ return this.get(seg("providers", name, "models"));
24
+ }
25
+
26
+ /** Connect a provider. `kind` is `openai`, `anthropic`, `gemini`, `mistral`, `groq` or `openai_compatible` (which needs `baseUrl`). */
27
+ connect(input: { name: string; kind: string; key?: string; baseUrl?: string }): Promise<Api> {
28
+ return this.post("/providers", { name: input.name, kind: input.kind, key: input.key ?? "", base_url: input.baseUrl ?? "" });
29
+ }
30
+
31
+ updateProvider(name: string, input: { key?: string; baseUrl?: string; enabled?: boolean }): Promise<Api> {
32
+ return this.patch(seg("providers", name), { key: input.key, base_url: input.baseUrl, enabled: input.enabled });
33
+ }
34
+
35
+ /** Disconnect a provider and every model on it. */
36
+ disconnect(name: string): Promise<Api> {
37
+ return this.del(seg("providers", name));
38
+ }
39
+
40
+ models(): Promise<Api> {
41
+ return this.get("/models");
42
+ }
43
+
44
+ /**
45
+ * Expose a model under `alias`. `policy` is who may call it: `service` (servers only, the default), `authenticated`, `public`, or a
46
+ * named policy. `params` are defaults such as `system` and `temperature`; prices are USD per million tokens.
47
+ */
48
+ addModel(input: {
49
+ alias: string;
50
+ provider: string;
51
+ upstream: string;
52
+ kind?: "chat" | "embedding";
53
+ description?: string;
54
+ policy?: unknown;
55
+ params?: Body;
56
+ dimensions?: number;
57
+ inputPrice?: number;
58
+ outputPrice?: number;
59
+ fallback?: string;
60
+ enabled?: boolean;
61
+ }): Promise<Api> {
62
+ return this.post("/models", {
63
+ alias: input.alias,
64
+ provider: input.provider,
65
+ upstream: input.upstream,
66
+ kind: input.kind ?? "chat",
67
+ description: input.description ?? "",
68
+ policy: input.policy ?? "service",
69
+ params: input.params ?? {},
70
+ dimensions: input.dimensions,
71
+ input_price: input.inputPrice,
72
+ output_price: input.outputPrice,
73
+ fallback: input.fallback,
74
+ enabled: input.enabled ?? true,
75
+ });
76
+ }
77
+
78
+ updateModel(
79
+ alias: string,
80
+ input: { provider?: string; upstream?: string; description?: string; policy?: unknown; params?: Body; dimensions?: number | null; inputPrice?: number | null; outputPrice?: number | null; fallback?: string | null; enabled?: boolean },
81
+ ): Promise<Api> {
82
+ return this.patch(seg("models", alias), {
83
+ provider: input.provider,
84
+ upstream: input.upstream,
85
+ description: input.description,
86
+ policy: input.policy,
87
+ params: input.params,
88
+ dimensions: input.dimensions,
89
+ input_price: input.inputPrice,
90
+ output_price: input.outputPrice,
91
+ fallback: input.fallback,
92
+ enabled: input.enabled,
93
+ });
94
+ }
95
+
96
+ removeModel(alias: string): Promise<Api> {
97
+ return this.del(seg("models", alias));
98
+ }
99
+
100
+ /** Send one request to a model, the way Studio's playground does. Returns `{ text, usage, ms }`, or `{ error }`. */
101
+ tryModel(alias: string, input: { messages?: Body[]; input?: string[]; maxTokens?: number } = {}): Promise<Api> {
102
+ return this.post(seg("models", alias, "try"), { messages: input.messages, input: input.input, max_tokens: input.maxTokens });
103
+ }
104
+
105
+ /** Calls, tokens, cost and latency over `days` (1 to 90), in all and per model. */
106
+ usage(options: { days?: number } = {}): Promise<Api> {
107
+ return this.get("/usage", { days: options.days ?? 7 });
108
+ }
109
+
110
+ /** Recent calls. Never includes what was asked or answered. */
111
+ requests(options: { alias?: string; failed?: boolean; limit?: number } = {}): Promise<Api> {
112
+ return this.get("/requests", { alias: options.alias, failed: options.failed ? "true" : undefined, limit: options.limit ?? 50 });
113
+ }
114
+
115
+ /** Vector fields in the environment, and how many records have no vector yet. */
116
+ vectors(): Promise<Api> {
117
+ return this.get("/vectors");
118
+ }
119
+
120
+ /** Embed up to `limit` records of a resource that have no vector. Call again while `embedded` is above zero. */
121
+ backfill(resource: string, options: { limit?: number } = {}): Promise<Api> {
122
+ return this.post(seg("backfill", resource), undefined, { limit: options.limit ?? 100 });
123
+ }
124
+
125
+ /** Search a resource by meaning, as the Studio does: with `text` or a `vector`. */
126
+ search(resource: string, input: { text?: string; vector?: number[]; field?: string; metric?: "cosine" | "l2" | "ip"; limit?: number }): Promise<Api> {
127
+ return this.post(seg("search", resource), { text: input.text, vector: input.vector, field: input.field, metric: input.metric ?? "cosine", limit: input.limit ?? 10 });
128
+ }
129
+ }
@@ -100,7 +100,7 @@ export class Schema extends Service {
100
100
  }
101
101
  }
102
102
 
103
- /** Named access policies (conditions) that resources, buckets, channels and functions refer to. */
103
+ /** Named access policies (conditions) that resources, buckets and channels refer to. */
104
104
  export class Policies extends Definitions {
105
105
  protected override readonly kind = "policies";
106
106
  }
@@ -15,10 +15,10 @@ import type { PawabaseClient } from "../client.js";
15
15
  import { ConfigError } from "../errors.js";
16
16
  import { isSecretKey } from "../util.js";
17
17
  import { Domains, Firewall, Keys, Secrets } from "./access.js";
18
+ import { Ai } from "./ai.js";
18
19
  import { Events, Flows, InboundHooks, Jobs, Schedules, Subscriptions, Webhooks } from "./automation.js";
19
20
  import { Database, Policies, Resources, Routes, Runtime, Schema, Schemas, Transformers } from "./data.js";
20
21
  import { Buckets, Cache } from "./files.js";
21
- import { Functions } from "./functions.js";
22
22
  import { Backups, Environments, Releases } from "./lifecycle.js";
23
23
  import { Mail, MailTemplates } from "./mail.js";
24
24
  import { Alarms, Health, Observability, StatusPage } from "./observe.js";
@@ -42,7 +42,6 @@ export class Manage {
42
42
  readonly webhooks: Webhooks;
43
43
  readonly inboundHooks: InboundHooks;
44
44
  readonly jobs: Jobs;
45
- readonly functions: Functions;
46
45
  // files and mail
47
46
  readonly buckets: Buckets;
48
47
  readonly cache: Cache;
@@ -61,6 +60,8 @@ export class Manage {
61
60
  readonly alarms: Alarms;
62
61
  readonly statusPage: StatusPage;
63
62
  readonly health: Health;
63
+ // ai
64
+ readonly ai: Ai;
64
65
  // lifecycle
65
66
  readonly environments: Environments;
66
67
  readonly releases: Releases;
@@ -86,7 +87,6 @@ export class Manage {
86
87
  this.webhooks = new Webhooks(http, environment);
87
88
  this.inboundHooks = new InboundHooks(http, environment);
88
89
  this.jobs = new Jobs(http, environment);
89
- this.functions = new Functions(http, environment);
90
90
  this.buckets = new Buckets(http, environment);
91
91
  this.cache = new Cache(http, environment);
92
92
  this.mail = new Mail(http, environment);
@@ -101,6 +101,7 @@ export class Manage {
101
101
  this.alarms = new Alarms(http, environment);
102
102
  this.statusPage = new StatusPage(http, environment);
103
103
  this.health = new Health(http, environment);
104
+ this.ai = new Ai(http, environment);
104
105
  this.environments = new Environments(http, environment);
105
106
  this.releases = new Releases(http, environment);
106
107
  this.backups = new Backups(http, environment);
@@ -125,7 +126,6 @@ export * from "./automation.js";
125
126
  export * from "./base.js";
126
127
  export * from "./data.js";
127
128
  export * from "./files.js";
128
- export * from "./functions.js";
129
129
  export * from "./lifecycle.js";
130
130
  export * from "./mail.js";
131
131
  export * from "./observe.js";
@@ -1,6 +1,6 @@
1
1
  import { Definitions, Service, type Api } from "./base.js";
2
2
 
3
- /** Templates (subject, HTML, text) for the mail flows, functions and sign-in send. */
3
+ /** Templates (subject, HTML, text) for the mail flows and sign-in send. */
4
4
  export class MailTemplates extends Definitions {
5
5
  protected override readonly kind = "mail-templates";
6
6
  }
package/src/types.ts CHANGED
@@ -127,9 +127,9 @@ export interface Team {
127
127
  /** One page of a list. */
128
128
  export interface Page<T> {
129
129
  data: T[];
130
- /** The 1-based page number. */
131
- page: number;
132
- per_page: number;
130
+ /** The 1-based page number; `null` when the query turned paging off. */
131
+ page: number | null;
132
+ per_page: number | null;
133
133
  /**
134
134
  * How many records match for this caller. `null` when a per-row policy makes it unknowable
135
135
  * (and then pages can be short, or empty, with more behind them).
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.1.3";
1
+ export const VERSION = "0.1.4";
@@ -1,48 +0,0 @@
1
- import { Service, type Api, type Body } from "./base.js";
2
- /** Deployed functions (Python or TypeScript; a project's functions are one language). */
3
- export declare class Functions extends Service {
4
- /** Functions visible to the environment (and `branch`), each saying whether it came from a branch, a deployment or mounted code. */
5
- list(options?: {
6
- branch?: string;
7
- }): Promise<Api>;
8
- /** Run a function now as an operator (or `asUser`), bypassing its HTTP policy: `{ status, result | error }`. */
9
- run(name: string, input?: unknown, options?: {
10
- branch?: string;
11
- asUser?: Body;
12
- }): Promise<Api>;
13
- /** Upload a base64 `.tar.gz` bundle (`functions/*.py` or `functions/*.ts`) and activate it. The `pawabase deploy` command builds the bundle. */
14
- deploy(archive: string, options?: {
15
- branch?: string;
16
- manifest?: Body;
17
- runtime?: string;
18
- limits?: Body;
19
- }): Promise<Api>;
20
- deployments(options?: {
21
- branch?: string;
22
- limit?: number;
23
- }): Promise<Api>;
24
- deployment(deploymentId: string): Promise<Api>;
25
- /** Make an earlier deployment the active one again (a rollback). */
26
- activate(deploymentId: string): Promise<Api>;
27
- removeDeployment(deploymentId: string): Promise<Api>;
28
- branches(): Promise<Api>;
29
- /** Delete the functions deployed on `branch`. The environment's own are untouched. */
30
- removeBranch(branch: string): Promise<Api>;
31
- runs(options?: {
32
- function?: string;
33
- branch?: string;
34
- status?: string;
35
- after?: string;
36
- limit?: number;
37
- }): Promise<Api>;
38
- /** One run with its input, output, error and logs. */
39
- runDetail(runId: string): Promise<Api>;
40
- /** The files of the live deployment. */
41
- source(options?: {
42
- branch?: string;
43
- }): Promise<Api>;
44
- sourceFile(path: string, options?: {
45
- branch?: string;
46
- }): Promise<Api>;
47
- }
48
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/manage/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAO,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE9D,yFAAyF;AACzF,qBAAa,SAAU,SAAQ,OAAO;IACpC,oIAAoI;IACpI,IAAI,CAAC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrD,gHAAgH;IAChH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,IAAI,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIlG,gJAAgJ;IAChJ,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,IAAI,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAU1H,WAAW,CAAC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAI5E,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI9C,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI5C,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIpD,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC;IAIxB,sFAAsF;IACtF,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI1C,IAAI,CAAC,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIzH,sDAAsD;IACtD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAItC,wCAAwC;IACxC,MAAM,CAAC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;CAG1E"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Functions = void 0;
4
- const base_js_1 = require("./base.js");
5
- /** Deployed functions (Python or TypeScript; a project's functions are one language). */
6
- class Functions extends base_js_1.Service {
7
- /** Functions visible to the environment (and `branch`), each saying whether it came from a branch, a deployment or mounted code. */
8
- list(options = {}) {
9
- return this.get("/functions", options);
10
- }
11
- /** Run a function now as an operator (or `asUser`), bypassing its HTTP policy: `{ status, result | error }`. */
12
- run(name, input, options = {}) {
13
- return this.post((0, base_js_1.seg)("functions", name, "invoke"), { input, branch: options.branch ?? null, as_user: options.asUser ?? null });
14
- }
15
- /** Upload a base64 `.tar.gz` bundle (`functions/*.py` or `functions/*.ts`) and activate it. The `pawabase deploy` command builds the bundle. */
16
- deploy(archive, options = {}) {
17
- return this.post("/function-deployments", {
18
- archive,
19
- branch: options.branch ?? "main",
20
- manifest: options.manifest ?? {},
21
- runtime: options.runtime ?? "python3.11",
22
- limits: options.limits ?? {},
23
- });
24
- }
25
- deployments(options = {}) {
26
- return this.get("/function-deployments", { limit: 50, ...options });
27
- }
28
- deployment(deploymentId) {
29
- return this.get((0, base_js_1.seg)("function-deployments", deploymentId));
30
- }
31
- /** Make an earlier deployment the active one again (a rollback). */
32
- activate(deploymentId) {
33
- return this.post((0, base_js_1.seg)("function-deployments", deploymentId, "activate"));
34
- }
35
- removeDeployment(deploymentId) {
36
- return this.del((0, base_js_1.seg)("function-deployments", deploymentId));
37
- }
38
- branches() {
39
- return this.get("/function-branches");
40
- }
41
- /** Delete the functions deployed on `branch`. The environment's own are untouched. */
42
- removeBranch(branch) {
43
- return this.del((0, base_js_1.seg)("function-branches", branch));
44
- }
45
- runs(options = {}) {
46
- return this.get("/function-runs", { limit: 50, ...options });
47
- }
48
- /** One run with its input, output, error and logs. */
49
- runDetail(runId) {
50
- return this.get((0, base_js_1.seg)("function-runs", runId));
51
- }
52
- /** The files of the live deployment. */
53
- source(options = {}) {
54
- return this.get("/function-source", options);
55
- }
56
- sourceFile(path, options = {}) {
57
- return this.get("/function-source/file", { path, ...options });
58
- }
59
- }
60
- exports.Functions = Functions;
61
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/manage/functions.ts"],"names":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AsB,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,gBAAgB,CAAC,YAAoB;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAA,aAAG,EAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,sFAAsF;IACtF,YAAY,CAAC,MAAc;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAA,aAAG,EAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,UAAmG,EAAE;QACxG,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,sDAAsD;IACtD,SAAS,CAAC,KAAa;QACrB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAA,aAAG,EAAC,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,wCAAwC;IACxC,MAAM,CAAC,UAA+B,EAAE;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU,CAAC,IAAY,EAAE,UAA+B,EAAE;QACxD,OAAO,IAAI,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAjED,8BAiEC"}
@@ -1,48 +0,0 @@
1
- import { Service, type Api, type Body } from "./base.js";
2
- /** Deployed functions (Python or TypeScript; a project's functions are one language). */
3
- export declare class Functions extends Service {
4
- /** Functions visible to the environment (and `branch`), each saying whether it came from a branch, a deployment or mounted code. */
5
- list(options?: {
6
- branch?: string;
7
- }): Promise<Api>;
8
- /** Run a function now as an operator (or `asUser`), bypassing its HTTP policy: `{ status, result | error }`. */
9
- run(name: string, input?: unknown, options?: {
10
- branch?: string;
11
- asUser?: Body;
12
- }): Promise<Api>;
13
- /** Upload a base64 `.tar.gz` bundle (`functions/*.py` or `functions/*.ts`) and activate it. The `pawabase deploy` command builds the bundle. */
14
- deploy(archive: string, options?: {
15
- branch?: string;
16
- manifest?: Body;
17
- runtime?: string;
18
- limits?: Body;
19
- }): Promise<Api>;
20
- deployments(options?: {
21
- branch?: string;
22
- limit?: number;
23
- }): Promise<Api>;
24
- deployment(deploymentId: string): Promise<Api>;
25
- /** Make an earlier deployment the active one again (a rollback). */
26
- activate(deploymentId: string): Promise<Api>;
27
- removeDeployment(deploymentId: string): Promise<Api>;
28
- branches(): Promise<Api>;
29
- /** Delete the functions deployed on `branch`. The environment's own are untouched. */
30
- removeBranch(branch: string): Promise<Api>;
31
- runs(options?: {
32
- function?: string;
33
- branch?: string;
34
- status?: string;
35
- after?: string;
36
- limit?: number;
37
- }): Promise<Api>;
38
- /** One run with its input, output, error and logs. */
39
- runDetail(runId: string): Promise<Api>;
40
- /** The files of the live deployment. */
41
- source(options?: {
42
- branch?: string;
43
- }): Promise<Api>;
44
- sourceFile(path: string, options?: {
45
- branch?: string;
46
- }): Promise<Api>;
47
- }
48
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/manage/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAO,KAAK,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE9D,yFAAyF;AACzF,qBAAa,SAAU,SAAQ,OAAO;IACpC,oIAAoI;IACpI,IAAI,CAAC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrD,gHAAgH;IAChH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE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AAC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;CAG1E"}
@@ -1,57 +0,0 @@
1
- import { Service, seg } from "./base.js";
2
- /** Deployed functions (Python or TypeScript; a project's functions are one language). */
3
- export class Functions extends Service {
4
- /** Functions visible to the environment (and `branch`), each saying whether it came from a branch, a deployment or mounted code. */
5
- list(options = {}) {
6
- return this.get("/functions", options);
7
- }
8
- /** Run a function now as an operator (or `asUser`), bypassing its HTTP policy: `{ status, result | error }`. */
9
- run(name, input, options = {}) {
10
- return this.post(seg("functions", name, "invoke"), { input, branch: options.branch ?? null, as_user: options.asUser ?? null });
11
- }
12
- /** Upload a base64 `.tar.gz` bundle (`functions/*.py` or `functions/*.ts`) and activate it. The `pawabase deploy` command builds the bundle. */
13
- deploy(archive, options = {}) {
14
- return this.post("/function-deployments", {
15
- archive,
16
- branch: options.branch ?? "main",
17
- manifest: options.manifest ?? {},
18
- runtime: options.runtime ?? "python3.11",
19
- limits: options.limits ?? {},
20
- });
21
- }
22
- deployments(options = {}) {
23
- return this.get("/function-deployments", { limit: 50, ...options });
24
- }
25
- deployment(deploymentId) {
26
- return this.get(seg("function-deployments", deploymentId));
27
- }
28
- /** Make an earlier deployment the active one again (a rollback). */
29
- activate(deploymentId) {
30
- return this.post(seg("function-deployments", deploymentId, "activate"));
31
- }
32
- removeDeployment(deploymentId) {
33
- return this.del(seg("function-deployments", deploymentId));
34
- }
35
- branches() {
36
- return this.get("/function-branches");
37
- }
38
- /** Delete the functions deployed on `branch`. The environment's own are untouched. */
39
- removeBranch(branch) {
40
- return this.del(seg("function-branches", branch));
41
- }
42
- runs(options = {}) {
43
- return this.get("/function-runs", { limit: 50, ...options });
44
- }
45
- /** One run with its input, output, error and logs. */
46
- runDetail(runId) {
47
- return this.get(seg("function-runs", runId));
48
- }
49
- /** The files of the live deployment. */
50
- source(options = {}) {
51
- return this.get("/function-source", options);
52
- }
53
- sourceFile(path, options = {}) {
54
- return this.get("/function-source/file", { path, ...options });
55
- }
56
- }
57
- //# sourceMappingURL=functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/manage/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAuB,MAAM,WAAW,CAAC;AAE9D,yFAAyF;AACzF,MAAM,OAAO,SAAU,SAAQ,OAAO;IACpC,oIAAoI;IACpI,IAAI,CAAC,UAA+B,EAAE;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,gHAAgH;IAChH,GAAG,CAAC,IAAY,EAAE,KAAe,EAAE,UAA8C,EAAE;QACjF,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;IACjI,CAAC;IAED,gJAAgJ;IAChJ,MAAM,CAAC,OAAe,EAAE,UAAiF,EAAE;QACzG,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACxC,OAAO;YACP,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,MAAM;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;YAChC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,YAAY;YACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,WAAW,CAAC,UAA+C,EAAE;QAC3D,OAAO,IAAI,CAAC,GAAG,CA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AE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF"}
@@ -1,69 +0,0 @@
1
- import { Service, seg, type Api, type Body } from "./base.js";
2
-
3
- /** Deployed functions (Python or TypeScript; a project's functions are one language). */
4
- export class Functions extends Service {
5
- /** Functions visible to the environment (and `branch`), each saying whether it came from a branch, a deployment or mounted code. */
6
- list(options: { branch?: string } = {}): Promise<Api> {
7
- return this.get("/functions", options);
8
- }
9
-
10
- /** Run a function now as an operator (or `asUser`), bypassing its HTTP policy: `{ status, result | error }`. */
11
- run(name: string, input?: unknown, options: { branch?: string; asUser?: Body } = {}): Promise<Api> {
12
- return this.post(seg("functions", name, "invoke"), { input, branch: options.branch ?? null, as_user: options.asUser ?? null });
13
- }
14
-
15
- /** Upload a base64 `.tar.gz` bundle (`functions/*.py` or `functions/*.ts`) and activate it. The `pawabase deploy` command builds the bundle. */
16
- deploy(archive: string, options: { branch?: string; manifest?: Body; runtime?: string; limits?: Body } = {}): Promise<Api> {
17
- return this.post("/function-deployments", {
18
- archive,
19
- branch: options.branch ?? "main",
20
- manifest: options.manifest ?? {},
21
- runtime: options.runtime ?? "python3.11",
22
- limits: options.limits ?? {},
23
- });
24
- }
25
-
26
- deployments(options: { branch?: string; limit?: number } = {}): Promise<Api> {
27
- return this.get("/function-deployments", { limit: 50, ...options });
28
- }
29
-
30
- deployment(deploymentId: string): Promise<Api> {
31
- return this.get(seg("function-deployments", deploymentId));
32
- }
33
-
34
- /** Make an earlier deployment the active one again (a rollback). */
35
- activate(deploymentId: string): Promise<Api> {
36
- return this.post(seg("function-deployments", deploymentId, "activate"));
37
- }
38
-
39
- removeDeployment(deploymentId: string): Promise<Api> {
40
- return this.del(seg("function-deployments", deploymentId));
41
- }
42
-
43
- branches(): Promise<Api> {
44
- return this.get("/function-branches");
45
- }
46
-
47
- /** Delete the functions deployed on `branch`. The environment's own are untouched. */
48
- removeBranch(branch: string): Promise<Api> {
49
- return this.del(seg("function-branches", branch));
50
- }
51
-
52
- runs(options: { function?: string; branch?: string; status?: string; after?: string; limit?: number } = {}): Promise<Api> {
53
- return this.get("/function-runs", { limit: 50, ...options });
54
- }
55
-
56
- /** One run with its input, output, error and logs. */
57
- runDetail(runId: string): Promise<Api> {
58
- return this.get(seg("function-runs", runId));
59
- }
60
-
61
- /** The files of the live deployment. */
62
- source(options: { branch?: string } = {}): Promise<Api> {
63
- return this.get("/function-source", options);
64
- }
65
-
66
- sourceFile(path: string, options: { branch?: string } = {}): Promise<Api> {
67
- return this.get("/function-source/file", { path, ...options });
68
- }
69
- }