@k9o/core 0.0.0-stage → 1.0.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.
- package/CHANGELOG.md +76 -0
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +61 -2
- package/dist/chunk-2VSTF5UU.js +33 -0
- package/dist/chunk-2VSTF5UU.js.map +1 -0
- package/dist/chunk-FVWKL5UQ.js +234 -0
- package/dist/chunk-FVWKL5UQ.js.map +1 -0
- package/dist/chunk-OE2MMUIG.js +93 -0
- package/dist/chunk-OE2MMUIG.js.map +1 -0
- package/dist/chunk-YEYRP6PG.js +1 -0
- package/dist/chunk-YEYRP6PG.js.map +1 -0
- package/dist/envelope.d.ts +94 -0
- package/dist/envelope.js +2 -0
- package/dist/envelope.js.map +1 -0
- package/dist/http.d.ts +86 -0
- package/dist/http.js +12 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +2147 -0
- package/dist/index.js +1908 -0
- package/dist/index.js.map +1 -0
- package/dist/kerror.d.ts +73 -0
- package/dist/kerror.js +9 -0
- package/dist/kerror.js.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/url-grammar.d.ts +75 -0
- package/dist/url-grammar.js +18 -0
- package/dist/url-grammar.js.map +1 -0
- package/package.json +69 -4
- package/src/ai.ts +56 -0
- package/src/audit.ts +100 -0
- package/src/byos.ts +192 -0
- package/src/compute/llms.ts +154 -0
- package/src/data/from.ts +346 -0
- package/src/envelope.ts +101 -0
- package/src/extensions-bridge.ts +35 -0
- package/src/functions.ts +114 -0
- package/src/gate-bridge.ts +65 -0
- package/src/http.ts +286 -0
- package/src/index.ts +314 -0
- package/src/internal/sse.ts +91 -0
- package/src/kerror.ts +92 -0
- package/src/me.ts +162 -0
- package/src/metadata.ts +137 -0
- package/src/migrations.ts +265 -0
- package/src/org.ts +347 -0
- package/src/orgs.ts +74 -0
- package/src/policies.ts +138 -0
- package/src/projects.ts +107 -0
- package/src/provider-region.ts +54 -0
- package/src/realtime.ts +350 -0
- package/src/region.ts +5 -0
- package/src/retry.ts +110 -0
- package/src/storage-buckets.ts +248 -0
- package/src/storage-locations.ts +177 -0
- package/src/studio/dashboards.ts +178 -0
- package/src/studio/index.ts +18 -0
- package/src/studio/workflows.ts +268 -0
- package/src/types.ts +76 -0
- package/src/url-grammar.ts +168 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Changelog — @k9o/core
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- NEW `client.storage.locations.{list, create, get, update, retire, test}` — storage locations over `/@<projectSlug>/storage/locations`: register your own object store once per project from a pre-created `credentialRef`, then link it to buckets and Datasets. Provider-specific ids (`accountId` and `parentAccessKeyId` for r2, `bucketId` for b2) go in `providerParams`. New types: `StorageLocation`, `CreateStorageLocationInput`, `UpdateStorageLocationInput`, `StorageLocationProviderParams` and friends.
|
|
6
|
+
- REMOVED (breaking) `client.byos.{list, create, get}` and the types `ByosBinding`, `CreateByosBindingInput`, `ByosProvider`, `ByosCustodyMode`, `ByosPurpose`. The purpose-based `/@<projectSlug>/byos` routes are withdrawn and answer 404; a location has no purpose. The credential helpers in `@k9o/core/byos` are unchanged.
|
|
7
|
+
- REMOVED `client.policies.deactivate()` — the emergency-deactivate verb is retired per ch06 §9.4.4; use the publish-lockdown pattern instead.
|
|
8
|
+
|
|
9
|
+
## v0.5.0 — 2026-05-25 (org-plane + operator-self namespaces)
|
|
10
|
+
|
|
11
|
+
NEW `client.org.*` org-plane namespace + NEW `client.me.*` operator-self namespace.
|
|
12
|
+
|
|
13
|
+
- `client.org.members.{list, invite, get, remove}` per ch02 §6 + ask 1
|
|
14
|
+
- `client.org.groups.{list, create, get, delete}` per ch02 §6 + ask 2
|
|
15
|
+
- `client.org.auditLog.{query, tail}` per ch05 §4.4 + 6-event org family per ch05 §4.2 + ask 3 (distinct from project-plane `client.audit`)
|
|
16
|
+
- `client.org.gate.roles.{list, grant, get, revoke}` per ch02 §6.5 `_sys.org_role_grants` substrate + ask 4 (ORG_ADMIN / ORG_BILLING_ADMIN grants with soft-delete revocation)
|
|
17
|
+
- `client.org.gate.idpProviders.{list, create, get, configure, delete}` per ch02 §6.5 + ask 7
|
|
18
|
+
- `client.org.smtp.{get, set, test, unset}` per ch02 §6.6 + ask 5 (3-tier cascade platform→org→project; Kibo-enclave password sequestration; 5/hour test-email rate limit)
|
|
19
|
+
- `client.org.get()` — read bound org (mirrors `client.orgs.current()` for namespace symmetry)
|
|
20
|
+
- `client.me.profile.{get, update}` — operator profile per ch01 §5.4 `/me/*` cross-org canonical
|
|
21
|
+
- `client.me.sessions.{list, revoke, revokeAll}` — operator session management
|
|
22
|
+
- `client.me.apiTokens.{list, create, delete}` — personal scripting tokens (forward substrate)
|
|
23
|
+
- `client.me.notifications.{list, markRead, markAllRead}` — operator-targeted notifications (forward substrate)
|
|
24
|
+
- `client.me.auditLog.query()` — operator-self audit (actions performed BY this operator across orgs; distinct from project-plane + org-plane audit)
|
|
25
|
+
- `client.me.dataExport.{request, status}` — personal data export per GDPR-style flows (forward substrate)
|
|
26
|
+
|
|
27
|
+
27 new tests pass / 0 fail covering URL composition across all org-plane + me-plane methods. Total @k9o/core suite: 124 / 0 across 8 test files.
|
|
28
|
+
|
|
29
|
+
## v0.4.0 — 2026-05-25 (checkpoint D — retry + backoff)
|
|
30
|
+
|
|
31
|
+
- HTTP client now retries transient failures per `retryConfig: { maxRetries, backoff: "exponential" | "linear" | "none", initialDelayMs, maxDelayMs }`
|
|
32
|
+
- `createClient({ retryConfig: ... })` threads the config into the bound HTTP layer
|
|
33
|
+
- Retryable: transport failures (`K9O_UPSTREAM_UNAVAILABLE`); HTTP 502/503/504; HTTP 429 (rate-limit)
|
|
34
|
+
- Non-retryable: other 4xx (caller error); other 5xx (gateway-side bug; surface immediately); non-KError thrown values
|
|
35
|
+
- Idempotency gate: only GET / HEAD / OPTIONS / DELETE are retried. POST / PATCH / PUT are never retried automatically — callers can opt in via `idempotencyKey` header per ch01 §10.2 when they assert idempotency (future sub-cycle integrates the header-driven path)
|
|
36
|
+
- Backoff: exponential default (initialDelayMs * 2^attempt, capped, ±25% jitter); linear available; none for tight loops; defaults 100ms initial / 5000ms cap / 3 retries
|
|
37
|
+
- 19 new tests covering isRetryable predicate + computeDelay backoff variants + withRetry orchestration + end-to-end HTTP retry integration. Total @k9o/core suite: 97 pass / 0 fail.
|
|
38
|
+
|
|
39
|
+
## v0.3.0 — 2026-05-25 (checkpoint C — pillar composition: `client.gate` + `client.extensions`)
|
|
40
|
+
|
|
41
|
+
- `client.gate` composed from `@k9o/gate` via gate-bridge — shares baseUrl + projectSlug; mode defaults to `native`; partnerToken inherits from apiKey. Throws `K9O_MISSING_PROJECT_CONTEXT` when accessed without projectSlug bound.
|
|
42
|
+
- `client.extensions` composed from `@k9o/extensions` — `client.extensions.extension(slug)` factory returning typed Trailblazer/Anchor/Keystone class extension bindings per ch13 §8.1.
|
|
43
|
+
- `@k9o/gate` + `@k9o/extensions` added as workspace dependencies.
|
|
44
|
+
- 6 new composition tests pass: gate namespace exposed when projectSlug bound; gate throws K9O_MISSING_PROJECT_CONTEXT without it; gate routes against same baseUrl + projectSlug as K9oClient; extensions.extension factory + paperless + cairn binding types resolve.
|
|
45
|
+
- KError ↔ GateError alignment is still open. Until then both error types are shape-compatible; caller code narrowing on `.code` works against either.
|
|
46
|
+
- Total @k9o/core suite: 78 pass / 0 fail across 6 test files.
|
|
47
|
+
|
|
48
|
+
## v0.2.0 — 2026-05-25 (checkpoint B — migrations + functions + policies + audit + orgs)
|
|
49
|
+
|
|
50
|
+
5 new namespaces wired to gateway routes:
|
|
51
|
+
|
|
52
|
+
- `client.migrations` — apply / list / get / queue / listPending / applyPending / rejectPending / deletePending per ch04 §2 + gateway `routes/migrations.ts` (8 methods)
|
|
53
|
+
- `client.functions` — deploy / list / get / delete / invoke per ch07 + gateway `routes/{functions,invoke}.ts` (5 methods)
|
|
54
|
+
- `client.policies` — current / list / create / validate / get / update / delete / publish / deactivate per ch06 §9 + gateway `routes/policies.ts` (9 methods)
|
|
55
|
+
- `client.audit` — query / tail per ch05 §4 + gateway `routes/audit-log.ts` (2 methods)
|
|
56
|
+
- `client.orgs` — list / get / restore / current per ch02 + gateway `routes/orgs-crud.ts` (4 methods)
|
|
57
|
+
|
|
58
|
+
20 new unit tests pass / 0 fail (covers URL composition + HTTP method + body shape + query string serialisation across all 5 namespaces). Total @k9o/core suite: 72 pass.
|
|
59
|
+
|
|
60
|
+
Forward sub-cycles: pillar composition (client.gate + client.extensions re-exports), retry/backoff in HTTP client, subscription/streaming, kibo namespace (composes with future @k9o/kibo).
|
|
61
|
+
|
|
62
|
+
## v0.1.0 — 2026-05-25 (first-pass scaffold)
|
|
63
|
+
|
|
64
|
+
NEW package. Surfaces shipped:
|
|
65
|
+
|
|
66
|
+
- `createClient(options)` factory with baseUrl validation
|
|
67
|
+
- HTTP client (`request`) with envelope unwrap on 2xx + `KError` rehydration on non-2xx + bearer/project/org header injection + transport failure mapping per ch01 §1 + §2
|
|
68
|
+
- `KError` class + `KErrorWire` type + `kerrorFromWire` rehydration per ch01 §2 + ch11
|
|
69
|
+
- Envelope + meta accessor types (`Envelope<T>` / `MetaCursor` / `MetaSubscription` / `MetaIdempotency` / `MetaWarning` / `MetaCost` / `MetaTiming` / `MetaContext` / `PaginatedEnvelope<T>`) per ch01 §1 + ch13 §5
|
|
70
|
+
- URL grammar v2.5.68 helpers: `validateBaseUrl` (rejects path/scheme/query/fragment per ch13 §7.2 → `K9O_INVALID_BASE_URL`), `validateSlug`, `projectPath` (member-plane `/@<slug>/...`), `orgPath`, `platformPath` per ch01 §5.4
|
|
71
|
+
- Data-plane DSL `client.from(collection)` with chainable filter builder (eq / neq / gt / gte / lt / lte / in / notIn / like / ilike / is / filter), pagination (limit / cursor), counting (count: none / exact / estimated), and terminal verbs (select / insert / update / delete) per ch04 §3 + §6.4; `update` + `delete` require `.eq('id', '...')` filter (row-mass updates deferred)
|
|
72
|
+
- Project lifecycle (`client.projects.list / create / get / update`) per ch02
|
|
73
|
+
|
|
74
|
+
52 unit tests pass / 0 fail across 4 test files; tsc clean strict.
|
|
75
|
+
|
|
76
|
+
Forward sub-cycles add: `client.migrations`, `client.functions`, `client.policies`, `client.audit`, `client.orgs`, `client.gate` (composition), `client.kibo` (composition), `client.extensions` (composition), retry/backoff per ch13 §7.1, subscription/streaming per ch04 §8.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @k9o/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Kilimanjaro platform SDK for TypeScript / JavaScript.
|
|
4
|
+
|
|
5
|
+
`createClient` + data-plane DSL + project lifecycle + cross-cutting `KError` + meta accessor sugar. Composes with `@k9o/gate` (auth pillar) and `@k9o/extensions` (extension consumption pillar).
|
|
6
|
+
|
|
7
|
+
## Status
|
|
8
|
+
|
|
9
|
+
v0.1.0 — first-pass scaffold. Surfaces shipped:
|
|
10
|
+
|
|
11
|
+
- `createClient(options)` — factory + baseUrl validation per ch13 §7
|
|
12
|
+
- `client.from(collection)` — data-plane DSL: `.select()` / `.insert()` / `.update()` / `.delete()` with filter chain (eq / neq / gt / gte / lt / lte / in / notIn / like / ilike / is / filter) + pagination (limit / cursor / count) per ch04 §3 + §6.4
|
|
13
|
+
- `client.projects` — list / create / get / update per ch02
|
|
14
|
+
- `KError` — closed-taxonomy error class + `kerrorFromWire` rehydration per ch01 §2
|
|
15
|
+
- URL grammar v2.5.68 — `validateBaseUrl` / `validateSlug` / `projectPath` / `orgPath` / `platformPath` per ch01 §5.4
|
|
16
|
+
|
|
17
|
+
Forward sub-cycles add: `client.migrations`, `client.functions`, `client.policies`, `client.audit`, `client.orgs`, `client.gate` (composition with `@k9o/gate`), `client.kibo` (composition with future `@k9o/kibo`), `client.extensions` (composition with `@k9o/extensions`), retry/backoff, subscription/streaming.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun add @k9o/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { createClient, KError } from "@k9o/core";
|
|
29
|
+
|
|
30
|
+
const client = createClient({
|
|
31
|
+
baseUrl: "https://acme.api.k9o.io",
|
|
32
|
+
apiKey: process.env.K9O_API_KEY,
|
|
33
|
+
orgSlug: "acme",
|
|
34
|
+
projectSlug: "member-portal",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const { data, meta } = await client.from("posts").select().limit(10);
|
|
39
|
+
console.log(data);
|
|
40
|
+
console.log("next cursor:", (meta as { cursor?: { next: string | null } }).cursor?.next);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
if (e instanceof KError && e.code === "K9O_TIER_CAP_HIT") {
|
|
43
|
+
console.warn(e.message, e.recommendation);
|
|
44
|
+
} else {
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Architecture
|
|
51
|
+
|
|
52
|
+
`@k9o/core` is the umbrella TypeScript factory that:
|
|
53
|
+
|
|
54
|
+
- Constructs the `K9oClient` with cross-cutting HTTP, KError, and URL grammar
|
|
55
|
+
- Hosts pillars that don't have their own dedicated package (data-plane, projects, migrations, functions, policies, audit, orgs)
|
|
56
|
+
- Composes pillar packages (`@k9o/gate`, `@k9o/extensions`, future `@k9o/kibo`) under namespaces on the client
|
|
57
|
+
|
|
58
|
+
Customers may import pillar packages directly when they only need one slice — `@k9o/gate` standalone for Auth0-parity deployments, `@k9o/extensions` standalone for extension-only consumption — or import `@k9o/core` for the full platform surface.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Apache-2.0 © Formelo Inc. See `LICENSE` and `NOTICE`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/kerror.ts
|
|
2
|
+
var KError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
context;
|
|
5
|
+
recommendation;
|
|
6
|
+
status;
|
|
7
|
+
requestId;
|
|
8
|
+
constructor(init) {
|
|
9
|
+
super(init.message);
|
|
10
|
+
this.name = "KError";
|
|
11
|
+
this.code = init.code;
|
|
12
|
+
this.context = Object.freeze({ ...init.context ?? {} });
|
|
13
|
+
this.recommendation = init.recommendation ?? null;
|
|
14
|
+
this.status = init.status ?? null;
|
|
15
|
+
this.requestId = init.requestId ?? null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
function kerrorFromWire(wire, status) {
|
|
19
|
+
return new KError({
|
|
20
|
+
code: wire.code,
|
|
21
|
+
message: wire.message,
|
|
22
|
+
context: wire.context ?? {},
|
|
23
|
+
recommendation: wire.recommendation ?? null,
|
|
24
|
+
status,
|
|
25
|
+
requestId: wire.requestId ?? null
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
KError,
|
|
31
|
+
kerrorFromWire
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-2VSTF5UU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kerror.ts"],"sourcesContent":["/**\n * `KError` — the closed-taxonomy error class returned by every `@k9o/core`\n * surface on non-2xx gateway responses or SDK-side validation failures.\n *\n * TypeScript / JavaScript throw on error; the per-language SDKs deliver this same payload\n * via their idiomatic mechanism (Go tuple-return; Rust Result; Python\n * raise; etc.) without changing the field shape.\n *\n * Fields:\n * - `code` — closed-taxonomy string (e.g. `K9O_TIER_CAP_HIT`,\n * `K9O_PROJECT_NOT_FOUND`); unknown codes pass through\n * with `code` preserved + `INTERNAL_ERROR` family\n * classification recorded in `context.originalCode`.\n * - `message` — human-readable explanation.\n * - `context` — structured per-code payload (immutable; frozen).\n * - `recommendation` — actionable next step (may be null when the\n * gateway didn't return one).\n * - `status` — HTTP status the gateway returned (or null for\n * SDK-side construct-time errors like\n * `K9O_INVALID_BASE_URL` per ch13 §7.2).\n * - `requestId` — gateway-emitted trace ID for downstream correlation.\n *\n * Standalone `@k9o/gate` ships its own `GateError` for the Auth0-parity\n * deployment shape; when `@k9o/gate` is composed inside `@k9o/core`,\n * `GateError` semantics align with `KError extends KError` (alignment still open).\n * Until then `KError` is the canonical error type returned by `@k9o/core` surfaces; `GateError` thrown by\n * `@k9o/gate`-delegated surfaces remain `KError`-shape-compatible\n * (both expose the same `code` / `message` / `context` / `recommendation`\n * fields) so caller code that narrows on `code` works against either.\n */\n\n/**\n * Wire-shape sentinel matching the gateway's `KError` JSON payload. The HTTP client recognises this on non-2xx responses\n * and rehydrates it into a `KError` instance.\n */\nexport type KErrorWire = {\n code: string;\n message: string;\n context?: Record<string, unknown>;\n recommendation?: string | null;\n requestId?: string;\n};\n\n/**\n * The customer-facing error type. Every `@k9o/core` surface throws this\n * on non-2xx upstream responses, transport failures, or SDK-side\n * validation failures.\n */\nexport class KError extends Error {\n readonly code: string;\n readonly context: Readonly<Record<string, unknown>>;\n readonly recommendation: string | null;\n readonly status: number | null;\n readonly requestId: string | null;\n\n constructor(init: {\n code: string;\n message: string;\n context?: Record<string, unknown>;\n recommendation?: string | null;\n status?: number | null;\n requestId?: string | null;\n }) {\n super(init.message);\n this.name = \"KError\";\n this.code = init.code;\n this.context = Object.freeze({ ...(init.context ?? {}) });\n this.recommendation = init.recommendation ?? null;\n this.status = init.status ?? null;\n this.requestId = init.requestId ?? null;\n }\n}\n\n/**\n * Rehydrate a wire `KError` payload into a typed `KError` instance.\n * Unlike `@k9o/gate.gateErrorFromWire`, `@k9o/core` does not maintain\n * a hand-curated allow-list of known codes — the gateway's KError\n * code-space is open-ended and curated centrally per ch11; the SDK\n * preserves whatever code the gateway sends. Code-narrowing in caller\n * code uses string-literal comparison against the well-known codes\n * (e.g. `if (e.code === 'K9O_TIER_CAP_HIT')`).\n */\nexport function kerrorFromWire(wire: KErrorWire, status: number): KError {\n return new KError({\n code: wire.code,\n message: wire.message,\n context: wire.context ?? {},\n recommendation: wire.recommendation ?? null,\n status,\n requestId: wire.requestId ?? null,\n });\n}\n"],"mappings":";AAgDO,IAAM,SAAN,cAAqB,MAAM;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,MAOT;AACD,UAAM,KAAK,OAAO;AAClB,SAAK,OAAO;AACZ,SAAK,OAAO,KAAK;AACjB,SAAK,UAAU,OAAO,OAAO,EAAE,GAAI,KAAK,WAAW,CAAC,EAAG,CAAC;AACxD,SAAK,iBAAiB,KAAK,kBAAkB;AAC7C,SAAK,SAAS,KAAK,UAAU;AAC7B,SAAK,YAAY,KAAK,aAAa;AAAA,EACrC;AACF;AAWO,SAAS,eAAe,MAAkB,QAAwB;AACvE,SAAO,IAAI,OAAO;AAAA,IAChB,MAAM,KAAK;AAAA,IACX,SAAS,KAAK;AAAA,IACd,SAAS,KAAK,WAAW,CAAC;AAAA,IAC1B,gBAAgB,KAAK,kBAAkB;AAAA,IACvC;AAAA,IACA,WAAW,KAAK,aAAa;AAAA,EAC/B,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KError,
|
|
3
|
+
kerrorFromWire
|
|
4
|
+
} from "./chunk-2VSTF5UU.js";
|
|
5
|
+
|
|
6
|
+
// src/retry.ts
|
|
7
|
+
var RETRYABLE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS", "DELETE"]);
|
|
8
|
+
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
9
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
10
|
+
maxRetries: 3,
|
|
11
|
+
backoff: "exponential",
|
|
12
|
+
initialDelayMs: 100,
|
|
13
|
+
maxDelayMs: 5e3
|
|
14
|
+
};
|
|
15
|
+
function isRetryable(error, method) {
|
|
16
|
+
if (!RETRYABLE_METHODS.has(method.toUpperCase())) return false;
|
|
17
|
+
if (!(error instanceof KError)) return false;
|
|
18
|
+
if (error.code === "K9O_UPSTREAM_UNAVAILABLE") return true;
|
|
19
|
+
if (error.status !== null && RETRYABLE_STATUS.has(error.status)) return true;
|
|
20
|
+
if (error.status === 429) return true;
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function computeDelay(config, attempt) {
|
|
24
|
+
let base;
|
|
25
|
+
if (config.backoff === "none") return 0;
|
|
26
|
+
if (config.backoff === "linear") base = config.initialDelayMs * (attempt + 1);
|
|
27
|
+
else base = config.initialDelayMs * Math.pow(2, attempt);
|
|
28
|
+
const capped = Math.min(base, config.maxDelayMs);
|
|
29
|
+
const jitter = capped * 0.25 * (Math.random() * 2 - 1);
|
|
30
|
+
return Math.max(0, Math.floor(capped + jitter));
|
|
31
|
+
}
|
|
32
|
+
function sleep(ms) {
|
|
33
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
34
|
+
}
|
|
35
|
+
async function withRetry(fn, method, config, sleepImpl = sleep) {
|
|
36
|
+
const c = {
|
|
37
|
+
...DEFAULT_RETRY_CONFIG,
|
|
38
|
+
...config ?? {}
|
|
39
|
+
};
|
|
40
|
+
let lastError;
|
|
41
|
+
for (let attempt = 0; attempt <= c.maxRetries; attempt++) {
|
|
42
|
+
try {
|
|
43
|
+
return await fn();
|
|
44
|
+
} catch (e) {
|
|
45
|
+
lastError = e;
|
|
46
|
+
if (attempt === c.maxRetries) break;
|
|
47
|
+
if (!isRetryable(e, method)) break;
|
|
48
|
+
const delay = computeDelay(c, attempt);
|
|
49
|
+
if (delay > 0) await sleepImpl(delay);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw lastError;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/region.ts
|
|
56
|
+
import { resolveRegionalOrigin, regionalOriginFromLocation } from "@k9o/gate";
|
|
57
|
+
|
|
58
|
+
// src/http.ts
|
|
59
|
+
async function request(config, init) {
|
|
60
|
+
return withRetry(() => requestOnce(config, init), init.method, config.retryConfig);
|
|
61
|
+
}
|
|
62
|
+
async function requestOnce(config, init) {
|
|
63
|
+
const fetchImpl = config.fetch ?? globalThis.fetch;
|
|
64
|
+
if (typeof fetchImpl !== "function") {
|
|
65
|
+
throw new KError({
|
|
66
|
+
code: "K9O_INTERNAL_ERROR",
|
|
67
|
+
message: "No fetch implementation available \u2014 pass {fetch} in createClient options for runtimes without a global fetch",
|
|
68
|
+
context: {},
|
|
69
|
+
recommendation: "Use Node 18+, Bun 1.1+, or a modern browser; otherwise supply a fetch polyfill via the fetch option."
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const url = buildUrl(await resolveRegionalOrigin(config), init.path, init.query);
|
|
73
|
+
const headers = {
|
|
74
|
+
accept: "application/json",
|
|
75
|
+
...config.defaultHeaders ?? {},
|
|
76
|
+
...config.projectSlug ? { "x-k9o-project-slug": config.projectSlug } : {},
|
|
77
|
+
...config.orgSlug ? { "x-k9o-org-slug": config.orgSlug } : {},
|
|
78
|
+
...init.headers ?? {}
|
|
79
|
+
};
|
|
80
|
+
const bearer = init.bearerToken ?? config.apiKey;
|
|
81
|
+
if (typeof bearer === "string" && bearer.length > 0) {
|
|
82
|
+
headers["authorization"] = `Bearer ${bearer}`;
|
|
83
|
+
}
|
|
84
|
+
const requestInit = {
|
|
85
|
+
method: init.method,
|
|
86
|
+
headers
|
|
87
|
+
};
|
|
88
|
+
if (init.body !== void 0) {
|
|
89
|
+
if (typeof FormData !== "undefined" && init.body instanceof FormData) {
|
|
90
|
+
requestInit["body"] = init.body;
|
|
91
|
+
} else {
|
|
92
|
+
headers["content-type"] = "application/json";
|
|
93
|
+
requestInit["body"] = JSON.stringify(init.body);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
let response;
|
|
97
|
+
try {
|
|
98
|
+
response = await fetchImpl(url, requestInit);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
throw new KError({
|
|
101
|
+
code: "K9O_UPSTREAM_UNAVAILABLE",
|
|
102
|
+
message: `Network error reaching ${url}: ${e instanceof Error ? e.message : String(e)}`,
|
|
103
|
+
context: { url },
|
|
104
|
+
recommendation: "Check connectivity to the gateway; retry with backoff if transient."
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (response.status === 204) {
|
|
108
|
+
return { data: void 0, meta: {} };
|
|
109
|
+
}
|
|
110
|
+
let parsed;
|
|
111
|
+
try {
|
|
112
|
+
parsed = await response.json();
|
|
113
|
+
} catch (e) {
|
|
114
|
+
throw new KError({
|
|
115
|
+
code: "K9O_INTERNAL_ERROR",
|
|
116
|
+
message: `Failed to parse JSON response from ${url}: ${e instanceof Error ? e.message : String(e)}`,
|
|
117
|
+
context: { url, status: response.status },
|
|
118
|
+
status: response.status
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (response.status >= 200 && response.status < 300) {
|
|
122
|
+
if (!isEnvelope(parsed)) {
|
|
123
|
+
throw new KError({
|
|
124
|
+
code: "K9O_INTERNAL_ERROR",
|
|
125
|
+
message: `Malformed envelope from ${url}: expected {data, meta}`,
|
|
126
|
+
context: { url, status: response.status },
|
|
127
|
+
status: response.status
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return parsed;
|
|
131
|
+
}
|
|
132
|
+
if (isKErrorWire(parsed)) {
|
|
133
|
+
throw kerrorFromWire(parsed, response.status);
|
|
134
|
+
}
|
|
135
|
+
throw new KError({
|
|
136
|
+
code: "K9O_INTERNAL_ERROR",
|
|
137
|
+
message: `Upstream returned ${response.status} with non-KError body`,
|
|
138
|
+
context: { url, status: response.status, body: parsed },
|
|
139
|
+
status: response.status
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async function requestStream(config, init) {
|
|
143
|
+
const fetchImpl = config.fetch ?? globalThis.fetch;
|
|
144
|
+
if (typeof fetchImpl !== "function") {
|
|
145
|
+
throw new KError({
|
|
146
|
+
code: "K9O_INTERNAL_ERROR",
|
|
147
|
+
message: "No fetch implementation available \u2014 pass {fetch} in createClient options",
|
|
148
|
+
context: {},
|
|
149
|
+
recommendation: "Use Node 18+, Bun 1.1+, or a modern browser; otherwise supply a fetch polyfill via the fetch option."
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const url = buildUrl(await resolveRegionalOrigin(config), init.path, init.query);
|
|
153
|
+
const headers = {
|
|
154
|
+
accept: init.accept ?? "text/event-stream",
|
|
155
|
+
...config.defaultHeaders ?? {},
|
|
156
|
+
...config.projectSlug ? { "x-k9o-project-slug": config.projectSlug } : {},
|
|
157
|
+
...config.orgSlug ? { "x-k9o-org-slug": config.orgSlug } : {},
|
|
158
|
+
...init.headers ?? {}
|
|
159
|
+
};
|
|
160
|
+
const bearer = init.bearerToken ?? config.apiKey;
|
|
161
|
+
if (typeof bearer === "string" && bearer.length > 0) {
|
|
162
|
+
headers["authorization"] = `Bearer ${bearer}`;
|
|
163
|
+
}
|
|
164
|
+
const requestInit = { method: init.method, headers };
|
|
165
|
+
if (init.body !== void 0) {
|
|
166
|
+
headers["content-type"] = "application/json";
|
|
167
|
+
requestInit["body"] = JSON.stringify(init.body);
|
|
168
|
+
}
|
|
169
|
+
let response;
|
|
170
|
+
try {
|
|
171
|
+
response = await fetchImpl(url, requestInit);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
throw new KError({
|
|
174
|
+
code: "K9O_UPSTREAM_UNAVAILABLE",
|
|
175
|
+
message: `Network error reaching ${url}: ${e instanceof Error ? e.message : String(e)}`,
|
|
176
|
+
context: { url },
|
|
177
|
+
recommendation: "Check connectivity to the gateway; retry with backoff if transient."
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (response.status < 200 || response.status >= 300) {
|
|
181
|
+
let parsed = null;
|
|
182
|
+
try {
|
|
183
|
+
parsed = await response.json();
|
|
184
|
+
} catch {
|
|
185
|
+
}
|
|
186
|
+
if (isKErrorWire(parsed)) throw kerrorFromWire(parsed, response.status);
|
|
187
|
+
throw new KError({
|
|
188
|
+
code: "K9O_INTERNAL_ERROR",
|
|
189
|
+
message: `Upstream returned ${response.status} opening stream`,
|
|
190
|
+
context: { url, status: response.status, body: parsed },
|
|
191
|
+
status: response.status
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
if (response.body === null) {
|
|
195
|
+
throw new KError({
|
|
196
|
+
code: "K9O_INTERNAL_ERROR",
|
|
197
|
+
message: `Stream response from ${url} has no body`,
|
|
198
|
+
context: { url, status: response.status },
|
|
199
|
+
status: response.status
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return response;
|
|
203
|
+
}
|
|
204
|
+
function buildUrl(baseUrl, path, query) {
|
|
205
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
206
|
+
const trimmedPath = path.startsWith("/") ? path : `/${path}`;
|
|
207
|
+
let url = `${trimmedBase}${trimmedPath}`;
|
|
208
|
+
if (query !== void 0) {
|
|
209
|
+
const params = new URLSearchParams();
|
|
210
|
+
for (const [k, v] of Object.entries(query)) {
|
|
211
|
+
if (v !== void 0) params.set(k, String(v));
|
|
212
|
+
}
|
|
213
|
+
const qs = params.toString();
|
|
214
|
+
if (qs.length > 0) url += `?${qs}`;
|
|
215
|
+
}
|
|
216
|
+
return url;
|
|
217
|
+
}
|
|
218
|
+
function isEnvelope(value) {
|
|
219
|
+
if (value === null || typeof value !== "object") return false;
|
|
220
|
+
const v = value;
|
|
221
|
+
return "data" in v && "meta" in v && typeof v.meta === "object" && v.meta !== null;
|
|
222
|
+
}
|
|
223
|
+
function isKErrorWire(value) {
|
|
224
|
+
if (value === null || typeof value !== "object") return false;
|
|
225
|
+
const v = value;
|
|
226
|
+
return typeof v.code === "string" && typeof v.message === "string";
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
request,
|
|
231
|
+
requestOnce,
|
|
232
|
+
requestStream
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=chunk-FVWKL5UQ.js.map
|