@standards/client 1.0.0-alpha.419 → 1.0.0-alpha.425

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.
@@ -1,6 +1,7 @@
1
1
 
2
- import { r as MultipartRequestOptions, s as TransportConfig, t as HttpTransport } from "./http-transport-BxJhcXjy.mjs";
3
- import { AggregateRecordsOptions, BundleBuilder, DocumentFile, ExtractRecord, ExtractRecordInputStrict, ExtractRecordUpdateStrict, FilterRule, ObjectBuilderLike, RecordAccessRole, RecordAggregates, RecordAudience, RuleValue, SchemaSourceResolution, SyncBundleResult, UsageReport, UsageScope } from "@standards/schema";
2
+ import { C as OperationTransport, T as TransportConfig, r as InProcessTransport, t as AppClient, v as HttpTransport } from "./app-_CiXRLoD.mjs";
3
+ import { AggregateRecordsOptions, BundleBuilder, ExtractRecord, ExtractRecordInputStrict, ExtractRecordUpdateStrict, FilterRule, ObjectBuilderLike, RecordAccessRole, RecordAggregates, RecordAudience, RuleValue, SchemaSourceResolution, SyncBundleResult } from "@standards/schema";
4
+ import { ActorId } from "@standards/schema/api";
4
5
  /**
5
6
  * What a sync carries besides the bundle itself.
6
7
  *
@@ -12,123 +13,10 @@ import { AggregateRecordsOptions, BundleBuilder, DocumentFile, ExtractRecord, Ex
12
13
  interface SyncBundleOptions {
13
14
  resolutions?: SchemaSourceResolution[];
14
15
  }
15
- /**
16
- * The two verbs a sync needs, typed non-generically: the real `Transport`
17
- * satisfies it, and so does a hand-rolled stub, which a `Pick` of the generic
18
- * signatures would reject.
19
- */
20
- interface SyncTransport {
21
- get(path: string): Promise<unknown>;
22
- put(path: string, body?: unknown): Promise<unknown>;
23
- }
16
+ /** Both calls are contract operations, on any transport. */
17
+ type SyncTransport = Pick<HttpTransport, "call">;
24
18
  /** GET the installed summary; PUT the built bundle when its hash, label, description or uses differ, or it was never synced. */
25
19
  declare function syncBundle(transport: SyncTransport, bundle: BundleBuilder<string, readonly ObjectBuilderLike[]>, options?: SyncBundleOptions): Promise<SyncBundleResult>;
26
- /**
27
- * What the files and documents methods upload: a `File` (or any `Blob` carrying
28
- * a `name`) with a non-empty filename and MIME type. The server checks the MIME
29
- * type, the extension and the file signature against each other, so all three
30
- * travel with the bytes. A `Buffer` or a path is not an input: wrap the bytes in
31
- * `new File([bytes], "name.png", { type: "image/png" })`.
32
- */
33
- type FileInput = Blob & {
34
- readonly name: string;
35
- };
36
- /**
37
- * The timeout of one upload's request, in ms (#4741). A large file on a slow
38
- * link outlives the client's `timeoutMs` (30 s by default) and surfaces as a
39
- * connection failure, possibly after the server stored it — so raise it for
40
- * large uploads rather than retrying a timed-out attach.
41
- */
42
- interface UploadTimeoutOption {
43
- timeoutMs?: number;
44
- }
45
- interface AttachToRecordInput extends UploadTimeoutOption {
46
- objectName: string;
47
- recordId: string;
48
- /** The record's `document` attribute; the server defaults to `attachments`. */
49
- attributeName?: string;
50
- /** Append to this existing document's pack instead of creating a document. */
51
- documentId?: string;
52
- /** The new document's title; the server defaults to the filename without its extension. */
53
- title?: string;
54
- /**
55
- * The bytes to upload, private, in the same request — the input
56
- * `files.upload` takes. The attach route takes one file per call: append
57
- * more by passing the returned `document.id` as `documentId`. An
58
- * already-uploaded file is not an input, so a public upload can never end up
59
- * in a document.
60
- */
61
- file: FileInput;
62
- }
63
- interface AttachToRecordResult {
64
- document: {
65
- id: string;
66
- title: string;
67
- };
68
- file: DocumentFile;
69
- /** `created`: a new document on the record; `appended`: added to `documentId`'s pack. */
70
- action: "created" | "appended";
71
- }
72
- interface DocumentsApi {
73
- /**
74
- * Upload a file and attach it to a record's document attribute in ONE
75
- * multipart `POST /records/:object/:id/documents/attach`. The server
76
- * validates the file against the attribute and deletes the upload if the
77
- * attach fails, so an error never leaves an orphaned file.
78
- */
79
- attachToRecord(input: AttachToRecordInput): Promise<AttachToRecordResult>;
80
- /** The document's files in pack order (`GET /documents/:id/files`). */
81
- listFiles(documentId: string): Promise<DocumentFile[]>;
82
- }
83
- /** The two verbs this module needs, typed non-generically so a stub satisfies it. */
84
- interface DocumentsTransport {
85
- get(path: string): Promise<unknown>;
86
- postMultipart(path: string, form: FormData, options?: MultipartRequestOptions): Promise<unknown>;
87
- }
88
- declare function createDocumentsApi(transport: DocumentsTransport): DocumentsApi;
89
- interface UploadFileBase extends UploadTimeoutOption {
90
- file: FileInput;
91
- /** Stored as the file's folder (`folderPath` on `POST /files/upload`). */
92
- folderPath?: string;
93
- }
94
- /** Anyone holding the returned `publicUrl` can open the file. A public file never joins a document. */
95
- interface UploadPublicFileInput extends UploadFileBase {
96
- public: true;
97
- }
98
- /** The default: readable through a signed URL from `getDownloadUrl`. */
99
- interface UploadPrivateFileInput extends UploadFileBase {
100
- public?: false;
101
- }
102
- type UploadFileInput = UploadPublicFileInput | UploadPrivateFileInput;
103
- interface UploadedFileBase {
104
- id: string;
105
- /** The stored (sanitized) filename. */
106
- name: string;
107
- mimeType: string;
108
- size: number;
109
- }
110
- interface PublicUploadedFile extends UploadedFileBase {
111
- isPublic: true;
112
- /** `{publicFilesUrl}/{id}`: permanent, and never carries a credential. */
113
- publicUrl: string;
114
- }
115
- interface PrivateUploadedFile extends UploadedFileBase {
116
- isPublic: false;
117
- publicUrl?: never;
118
- }
119
- /** Discriminated on `isPublic`: only the public branch has a `publicUrl`. */
120
- type UploadedFile = PublicUploadedFile | PrivateUploadedFile;
121
- interface FilesApi {
122
- /** One multipart `POST /files/upload`. */
123
- upload(input: UploadPublicFileInput): Promise<PublicUploadedFile>;
124
- upload(input: UploadPrivateFileInput): Promise<PrivateUploadedFile>;
125
- upload(input: UploadFileInput): Promise<UploadedFile>;
126
- /** A fresh signed read URL (`GET /files/:id/url`); it expires, so ask again each time. */
127
- getDownloadUrl(fileId: string): Promise<string>;
128
- }
129
- /** The one verb this module needs: the `files` operations. */
130
- type FilesTransport = Pick<HttpTransport, "call">;
131
- declare function createFilesApi(transport: FilesTransport): FilesApi;
132
20
  /** `daily-stats` → `dailyStats`. Object names are kebab-case (enforced by the builder). */
133
21
  type CamelCase<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${Head}${Capitalize<CamelCase<Tail>>}` : S;
134
22
  type Attr<TBuilder> = keyof ExtractRecord<TBuilder> & string;
@@ -145,6 +33,33 @@ type RecordInput<TBuilder> = ExtractRecordInputStrict<TBuilder> & {
145
33
  type RecordUpdate<TBuilder> = ExtractRecordUpdateStrict<TBuilder> & {
146
34
  [key: string]: unknown;
147
35
  };
36
+ /** What `create()` takes beside the values. */
37
+ interface RecordCreateOptions {
38
+ /**
39
+ * Create the record even when required attributes are missing. The values
40
+ * given are still validated.
41
+ * @default false
42
+ */
43
+ allowDraft?: boolean;
44
+ /**
45
+ * The record's `metadata`: application state kept beside its values, never
46
+ * shown as an attribute. System keys are dropped.
47
+ */
48
+ metadata?: Record<string, unknown>;
49
+ }
50
+ /**
51
+ * What `update()` takes beside the patch. No `allowDraft`: the server already
52
+ * validates every update as a draft, so a required attribute the patch leaves
53
+ * out is never refused.
54
+ */
55
+ interface RecordUpdateOptions {
56
+ /**
57
+ * Keys shallow-merged into the record's `metadata`: each one replaced whole,
58
+ * `null` removes it, the keys not named stay. Written with the patch in one
59
+ * transaction.
60
+ */
61
+ metadata?: Record<string, unknown>;
62
+ }
148
63
  /** What `export()` takes beside its columns. */
149
64
  interface RecordsExportOptions {
150
65
  /** Export only these records (at most `EXPORT_MAX_IDS`, 20 000). */
@@ -257,8 +172,27 @@ interface RecordsQuery<TBuilder> {
257
172
  all(): Promise<ExtractRecord<TBuilder>[]>;
258
173
  single(): Promise<ExtractRecord<TBuilder> | null>;
259
174
  get(id: string): Promise<ExtractRecord<TBuilder>>;
260
- create(input: RecordInput<TBuilder>): Promise<ExtractRecord<TBuilder>>;
261
- update(id: string, patch: RecordUpdate<TBuilder>): Promise<ExtractRecord<TBuilder>>;
175
+ /**
176
+ * `POST /records/<object>`. `allowDraft` creates the record with required
177
+ * attributes missing (so its input types every attribute as optional);
178
+ * `metadata` is the record's application state.
179
+ */
180
+ create(input: RecordInput<TBuilder>, options?: RecordCreateOptions): Promise<ExtractRecord<TBuilder>>;
181
+ create(input: RecordUpdate<TBuilder>, options: RecordCreateOptions & {
182
+ allowDraft: true;
183
+ }): Promise<ExtractRecord<TBuilder>>;
184
+ /**
185
+ * `PUT /records/<object>/<id>`: merges the patch into the record. The server
186
+ * validates every update as a draft, so there is no `allowDraft`.
187
+ *
188
+ * With `metadata`, the patch and the metadata are written together by one
189
+ * `record.set` step of `POST /operations`, in one transaction; the record is
190
+ * read first (`GET /records/<object>/<id>`) for the object id the step
191
+ * names. A refused step rejects with the `StandardsRequestError` its code
192
+ * maps to (`StandardsAuthError` for a 403), with that code and status but
193
+ * no field `details`, which the same refusal on `PUT` carries.
194
+ */
195
+ update(id: string, patch: RecordUpdate<TBuilder>, options?: RecordUpdateOptions): Promise<ExtractRecord<TBuilder>>;
262
196
  delete(id: string): Promise<void>;
263
197
  /**
264
198
  * `POST /records/<object>/bulk-create`, 100 inputs per request, sent one after
@@ -299,38 +233,16 @@ interface UntypedBuilder {
299
233
  /** What `standards.from("object-name")` hands back. */
300
234
  type UntypedRecordsQuery = RecordsQuery<UntypedBuilder>;
301
235
  /**
302
- * The verbs this module needs, typed non-generically: the real `Transport`
303
- * satisfies it, and so does a hand-rolled stub, which a `Pick` of the generic
304
- * signatures would reject. `postRaw` only serves `export()`, which refuses
305
- * when a stub leaves it out. Each path is its contract operation's
306
- * (`buildOperationPath`, every parameter one encoded segment); the verbs stay
307
- * the transport's.
236
+ * Every records call is a contract operation (`call`), on any transport, the
237
+ * in-process one included. `export()` alone reads the CSV as it streams, so it
238
+ * needs an HTTP transport's `postRaw`.
308
239
  */
309
- interface RecordsTransport {
310
- get(path: string): Promise<unknown>;
311
- post(path: string, body?: unknown): Promise<unknown>;
240
+ type RecordsTransport = Pick<HttpTransport, "call"> & {
312
241
  postRaw?(path: string, body: unknown): Promise<Response>;
313
- put(path: string, body?: unknown): Promise<unknown>;
314
- delete(path: string): Promise<unknown>;
315
- }
242
+ };
316
243
  /** A builder gives typed records; a bare object name is the untyped escape hatch. */
317
244
  declare function createRecordsQuery<TBuilder extends ObjectBuilderLike>(transport: RecordsTransport, target: TBuilder): RecordsQuery<TBuilder>;
318
245
  declare function createRecordsQuery(transport: RecordsTransport, target: string): UntypedRecordsQuery;
319
- interface UsageReportInput {
320
- /** First day of the window, `YYYY-MM-DD` (UTC, inclusive). */
321
- from: string;
322
- /** Last day of the window, `YYYY-MM-DD` (UTC, inclusive); at most 366 days after `from`. */
323
- to: string;
324
- /** `me` (the default): the caller's own usage. `workspace`: every member's, gated on `billing:read`. */
325
- scope?: UsageScope;
326
- }
327
- interface UsageApi {
328
- /** AI usage and cost over an inclusive UTC day window (`GET /ai/usage`). */
329
- report(input: UsageReportInput): Promise<UsageReport>;
330
- }
331
- /** The one verb this module needs: the `ai.usage` operation. */
332
- type UsageTransport = Pick<HttpTransport, "call">;
333
- declare function createUsageApi(transport: UsageTransport): UsageApi;
334
246
  type NameOf<B> = B extends {
335
247
  _types: {
336
248
  name: infer N extends string;
@@ -342,28 +254,82 @@ type ObjectsOf<TObjects extends readonly ObjectBuilderLike[]> = { readonly [B in
342
254
  type AnyBundle = BundleBuilder<string, readonly ObjectBuilderLike[]>;
343
255
  /** The object builders of every bundle in a tuple: what the typed client infers from. */
344
256
  type ObjectsOfBundles<TBundles extends readonly AnyBundle[]> = TBundles[number]["objectBuilders"];
345
- interface Standards {
346
- bundles: {
347
- /** Sync a bundle to the workspace; a no-op (`applied: false`) when it already holds this version. */
348
- sync(bundle: AnyBundle, options?: SyncBundleOptions): Promise<SyncBundleResult>;
257
+ type ContractSync = AppClient["bundles"]["sync"];
258
+ /** `bundles.sync`, either way: from your bundle's builder, or the contract's call. */
259
+ interface BundlesSync {
260
+ /**
261
+ * Build `bundle`, compare it with the version the workspace holds, and put
262
+ * it only when it changed: `{ applied: false }` when it already holds it.
263
+ */
264
+ (bundle: AnyBundle, options?: SyncBundleOptions): Promise<SyncBundleResult>;
265
+ /** The contract's call, with an artifact you built yourself. */
266
+ (...args: Parameters<ContractSync>): ReturnType<ContractSync>;
267
+ }
268
+ /**
269
+ * The client: every operation of the contract at the root, by group and
270
+ * verb (`decisions.list`, `users.get`, `files.upload`…), with your bundles'
271
+ * objects beside them as typed queries (see {@link StandardsOf}).
272
+ */
273
+ type Standards = Omit<AppClient, "bundles"> & {
274
+ readonly bundles: Omit<AppClient["bundles"], "sync"> & {
275
+ readonly sync: BundlesSync;
349
276
  };
350
277
  /** Untyped access to an object the code does not declare (created at runtime). */
351
278
  from(objectName: string): UntypedRecordsQuery;
352
- /** Upload files (private or public) and read them back through signed URLs. */
353
- files: FilesApi;
354
- /** Attach uploads to a record's document attribute and list a document's files. */
355
- documents: DocumentsApi;
356
- /** AI usage and cost of the caller or the whole workspace. */
357
- usage: UsageApi;
358
- }
279
+ /**
280
+ * Every operation of the contract, under its own name only: the way to a
281
+ * group one of your objects shares a name with, since the object wins at
282
+ * the root.
283
+ */
284
+ readonly contract: AppClient;
285
+ };
286
+ /**
287
+ * The client with your objects: each one a typed query at the root. An object
288
+ * named like a contract group takes its place there (the group stays under
289
+ * `contract`), so a group Standards adds later never changes what your code
290
+ * reads.
291
+ */
292
+ type StandardsOf<TObjects extends readonly ObjectBuilderLike[]> = Omit<Standards, keyof ObjectsOf<TObjects>> & ObjectsOf<TObjects>;
293
+ /**
294
+ * A client in a server that embeds Standards: the same client, plus `as` to
295
+ * name who acts. Absent over HTTP, where the identity is the API key's.
296
+ */
297
+ type ActingStandards<S> = S & {
298
+ /**
299
+ * The same client, every call acting as `actor`: an actor id, or `"system"`
300
+ * for the workspace's system actor. Permissions and visibility are that
301
+ * actor's; the actor the context implies, if any, is recorded as the one
302
+ * who triggered the call. Without `as`, a call acts as the context implies:
303
+ * the request's user, the job's enqueuer, the write's author, else the
304
+ * system.
305
+ */
306
+ as(actor: ActorId | "system"): ActingStandards<S>;
307
+ };
308
+ /**
309
+ * Every call `createStandards` makes is a contract operation (`call`, and
310
+ * `stream` for an `"events"` one); a records `export()` also
311
+ * needs an HTTP transport's `postRaw`, and `as` the in-process transport's
312
+ * `withCaller`.
313
+ */
314
+ type StandardsTransport = OperationTransport & Partial<Pick<HttpTransport, "postRaw">> & Partial<Pick<InProcessTransport, "withCaller">>;
359
315
  /**
360
- * The options `createStandards` takes. Every field of `TransportConfig` is
361
- * optional here: on the server a missing `baseUrl` / `apiKey` is read from
362
- * `STANDARDS_API_URL` / `STANDARDS_API_KEY`, and an explicit value always wins.
316
+ * The options `createStandards` takes: an API key's HTTP connection
317
+ * (`baseUrl`, `apiKey`, read from the environment when absent), or a
318
+ * `transport` of your own (the in-process one in a server that embeds
319
+ * Standards, `createInProcessTransport`), never both.
363
320
  */
364
- type StandardsConfig = Partial<TransportConfig>;
321
+ type StandardsConfig = Partial<TransportConfig> & {
322
+ transport?: StandardsTransport;
323
+ };
324
+ declare function createStandards<const TBundles extends readonly AnyBundle[]>(config: StandardsConfig & {
325
+ transport: InProcessTransport;
326
+ bundles: TBundles;
327
+ }): ActingStandards<StandardsOf<ObjectsOfBundles<TBundles>>>;
328
+ declare function createStandards(config: StandardsConfig & {
329
+ transport: InProcessTransport;
330
+ }): ActingStandards<Standards>;
365
331
  declare function createStandards<const TBundles extends readonly AnyBundle[]>(config: StandardsConfig & {
366
332
  bundles: TBundles;
367
- }): Standards & ObjectsOf<ObjectsOfBundles<TBundles>>;
333
+ }): StandardsOf<ObjectsOfBundles<TBundles>>;
368
334
  declare function createStandards(config?: StandardsConfig): Standards;
369
- export { PrivateUploadedFile as A, DocumentsTransport as B, UpdateManyEntry as C, CamelCase as D, createRecordsQuery as E, UploadedFile as F, SyncTransport as G, FileInput as H, createFilesApi as I, syncBundle as K, AttachToRecordInput as L, UploadFileInput as M, UploadPrivateFileInput as N, FilesApi as O, UploadPublicFileInput as P, AttachToRecordResult as R, UntypedRecordsQuery as S, UpdateManyResult as T, UploadTimeoutOption as U, createDocumentsApi as V, SyncBundleOptions as W, RecordUpdate as _, StandardsConfig as a, RecordsQuery as b, UsageReportInput as c, CreateManyError as d, CreateManyResult as f, RecordInput as g, FetchResult as h, Standards as i, PublicUploadedFile as j, FilesTransport as k, UsageTransport as l, DeleteManyResult as m, ObjectsOf as n, createStandards as o, DeleteManyError as p, ObjectsOfBundles as r, UsageApi as s, AnyBundle as t, createUsageApi as u, RecordsAggregateOptions as v, UpdateManyError as w, UntypedBuilder as x, RecordsExportOptions as y, DocumentsApi as z };
335
+ export { SyncBundleOptions as A, UntypedBuilder as C, UpdateManyResult as D, UpdateManyError as E, syncBundle as M, createRecordsQuery as O, RecordsQuery as S, UpdateManyEntry as T, RecordInput as _, ObjectsOfBundles as a, RecordsAggregateOptions as b, StandardsOf as c, CreateManyError as d, CreateManyResult as f, RecordCreateOptions as g, FetchResult as h, ObjectsOf as i, SyncTransport as j, CamelCase as k, StandardsTransport as l, DeleteManyResult as m, AnyBundle as n, Standards as o, DeleteManyError as p, BundlesSync as r, StandardsConfig as s, ActingStandards as t, createStandards as u, RecordUpdate as v, UntypedRecordsQuery as w, RecordsExportOptions as x, RecordUpdateOptions as y };
package/dist/index.d.mts CHANGED
@@ -1,18 +1,35 @@
1
1
 
2
- import { A as PrivateUploadedFile, B as DocumentsTransport, C as UpdateManyEntry, D as CamelCase, E as createRecordsQuery, F as UploadedFile, G as SyncTransport, H as FileInput, I as createFilesApi, K as syncBundle, L as AttachToRecordInput, M as UploadFileInput, N as UploadPrivateFileInput, O as FilesApi, P as UploadPublicFileInput, R as AttachToRecordResult, S as UntypedRecordsQuery, T as UpdateManyResult, U as UploadTimeoutOption, V as createDocumentsApi, W as SyncBundleOptions, _ as RecordUpdate, a as StandardsConfig, b as RecordsQuery, c as UsageReportInput, d as CreateManyError, f as CreateManyResult, g as RecordInput, h as FetchResult, i as Standards, j as PublicUploadedFile, k as FilesTransport, l as UsageTransport, m as DeleteManyResult, n as ObjectsOf, o as createStandards, p as DeleteManyError, r as ObjectsOfBundles, s as UsageApi, t as AnyBundle, u as createUsageApi, v as RecordsAggregateOptions, w as UpdateManyError, x as UntypedBuilder, y as RecordsExportOptions, z as DocumentsApi } from "./create-standards-HiWpTAlP.mjs";
3
- import { _ as StandardsRequestError, g as StandardsConfigurationError, h as StandardsAuthError, m as BundleValidationError, o as Transport, p as BundleConflictError, r as MultipartRequestOptions, s as TransportConfig, u as createTransport } from "./http-transport-BxJhcXjy.mjs";
4
- import { ActorType, Attribute, BUNDLE_NAME_PATTERN, BuiltBundle, BundleBuilder, BundlePiece, CollectionPage, CollectionResponse, ContentViewDefinition, DuplicateError, ExtractRecord, ExtractRecordInput, ExtractRecordInputStrict, ExtractRecordStrict, ExtractRecordUpdate, ExtractRecordUpdateStrict, FilterCombinator, FilterOperator, FilterRule, FilterState, ForbiddenError, InstalledBundleSummary, NotFoundError, ObjectBuilderLike, ObjectDefinition, ObjectDefinition as ObjectDefinition$1, RecordAccessRole, RecordAudience, RecordMetadata, SchemaError, SchemaErrorCode, SchemaSourceCurrencyRetype, SchemaSourcePhoneRetype, SchemaSourceRename, SchemaSourceResolution, SchemaSourceRetype, SortDirection, SortRule, SyncBundleResult, UsageBucket, UsageModality, UsageReport, UsageScope, ValidationError, ViewContentDefinition, ViewDeclaration, ViewerAccess, WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, currency, currentActor, date, detailView, document, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, text, today, user } from "@standards/schema";
5
- import { encodePathSegment } from "@standards/schema/api";
2
+ import { A as SyncBundleOptions, C as UntypedBuilder, D as UpdateManyResult, E as UpdateManyError, M as syncBundle, O as createRecordsQuery, S as RecordsQuery, T as UpdateManyEntry, _ as RecordInput, a as ObjectsOfBundles, b as RecordsAggregateOptions, c as StandardsOf, d as CreateManyError, f as CreateManyResult, g as RecordCreateOptions, h as FetchResult, i as ObjectsOf, j as SyncTransport, k as CamelCase, l as StandardsTransport, m as DeleteManyResult, n as AnyBundle, o as Standards, p as DeleteManyError, r as BundlesSync, s as StandardsConfig, t as ActingStandards, u as createStandards, v as RecordUpdate, w as UntypedRecordsQuery, x as RecordsExportOptions, y as RecordUpdateOptions } from "./create-standards-lDN6ru8u.mjs";
3
+ import { F as StandardsRequestError, M as BundleValidationError, N as StandardsAuthError, O as createTransport, P as StandardsConfigurationError, T as TransportConfig, b as MultipartRequestOptions, j as BundleConflictError, w as Transport } from "./app-_CiXRLoD.mjs";
4
+ import { ActorType, Attribute, BUNDLE_NAME_PATTERN, BuiltBundle, BundleBuilder, BundlePiece, CollectionPage, CollectionResponse, ContentViewDefinition, DuplicateError, ExtractRecord, ExtractRecordInput, ExtractRecordInputStrict, ExtractRecordStrict, ExtractRecordUpdate, ExtractRecordUpdateStrict, FilterCombinator, FilterOperator, FilterRule, FilterState, ForbiddenError, InstalledBundleSummary, NotFoundError, ObjectBuilderLike, ObjectDefinition, RecordAccessRole, RecordAudience, RecordMetadata, SchemaError, SchemaErrorCode, SchemaSourceCurrencyRetype, SchemaSourcePhoneRetype, SchemaSourceRename, SchemaSourceResolution, SchemaSourceRetype, SortDirection, SortRule, SyncBundleResult, UsageBucket, UsageModality, UsageReport, UsageScope, ValidationError, ViewContentDefinition, ViewDeclaration, ViewerAccess, WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, currency, currentActor, date, detailView, document, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, text, today, user } from "@standards/schema";
5
+ import { ActorId, OperationCaller, encodePathSegment } from "@standards/schema/api";
6
6
  /**
7
- * JSON delivers dates as ISO strings; the client knows the definition, so it
8
- * revives system timestamps and every `date` attribute so `ExtractRecord` tells
9
- * the truth on the wire. Nothing else is transformed.
7
+ * Declare your bundle once, and the default `standards` instance is typed by
8
+ * it:
9
+ *
10
+ * ```ts
11
+ * declare module "@standards/client" {
12
+ * interface Register { bundle: typeof crm }
13
+ * }
14
+ * ```
10
15
  */
11
- export declare function reviveRecord<T extends Record<string, unknown>>(definition: ObjectDefinition$1 | null, raw: T): T;
16
+ interface Register {}
17
+ type RegisteredObjects = Register extends {
18
+ bundle: infer B extends AnyBundle;
19
+ } ? B["objectBuilders"] : readonly [];
20
+ /** The default instance's type: the registered bundle's objects, and `as`. */
21
+ type DefaultStandards = ActingStandards<StandardsOf<RegisteredObjects>>;
22
+ /**
23
+ * The ready instance: `import { standards } from "@standards/client"` and
24
+ * call it. Its transport is resolved on first use (see {@link resolved}); its
25
+ * types come from {@link Register}. `createStandards` stays for several
26
+ * instances or another workspace.
27
+ */
28
+ export declare const standards: DefaultStandards;
12
29
  /**
13
30
  * Every caller-supplied path segment is percent-encoded: `objectName` and `id`
14
31
  * come from the application, and an id such as `../../bundles/x` must
15
32
  * never leave `/records/<object>/`.
16
33
  */
17
34
  export declare function recordsPath(objectName: string, ...segments: string[]): string;
18
- export { type ActorType, type AnyBundle, type AttachToRecordInput, type AttachToRecordResult, type Attribute, BUNDLE_NAME_PATTERN, type BuiltBundle, type BundleBuilder, BundleConflictError, type BundlePiece, BundleValidationError, type CamelCase, type CollectionPage, type CollectionResponse, type ContentViewDefinition, type CreateManyError, type CreateManyResult, type DeleteManyError, type DeleteManyResult, type DocumentsApi, type DocumentsTransport, DuplicateError, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, type FetchResult, type FileInput, type FilesApi, type FilesTransport, type FilterCombinator, type FilterOperator, type FilterRule, type FilterState, ForbiddenError, type InstalledBundleSummary, type MultipartRequestOptions, NotFoundError, type ObjectBuilderLike, type ObjectDefinition, type ObjectsOf, type ObjectsOfBundles, type PrivateUploadedFile, type PublicUploadedFile, type RecordAccessRole, type RecordAudience, type RecordInput, type RecordMetadata, type RecordUpdate, type RecordsAggregateOptions, type RecordsExportOptions, type RecordsQuery, SchemaError, SchemaErrorCode, type SchemaSourceCurrencyRetype, type SchemaSourcePhoneRetype, type SchemaSourceRename, type SchemaSourceResolution, type SchemaSourceRetype, type SortDirection, type SortRule, type Standards, StandardsAuthError, type StandardsConfig, StandardsConfigurationError, StandardsRequestError, type SyncBundleOptions, type SyncBundleResult, type SyncTransport, type Transport, type TransportConfig, type UntypedBuilder, type UntypedRecordsQuery, type UpdateManyEntry, type UpdateManyError, type UpdateManyResult, type UploadFileInput, type UploadPrivateFileInput, type UploadPublicFileInput, type UploadTimeoutOption, type UploadedFile, type UsageApi, type UsageBucket, type UsageModality, type UsageReport, type UsageReportInput, type UsageScope, type UsageTransport, ValidationError, type ViewContentDefinition, type ViewDeclaration, type ViewerAccess, type WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, createDocumentsApi, createFilesApi, createRecordsQuery, createStandards, createTransport, createUsageApi, currency, currentActor, date, detailView, document, encodePathSegment, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, syncBundle, text, today, user };
35
+ export { type ActingStandards, type ActorId, type ActorType, type AnyBundle, type Attribute, BUNDLE_NAME_PATTERN, type BuiltBundle, type BundleBuilder, BundleConflictError, type BundlePiece, BundleValidationError, type BundlesSync, type CamelCase, type CollectionPage, type CollectionResponse, type ContentViewDefinition, type CreateManyError, type CreateManyResult, type DefaultStandards, type DeleteManyError, type DeleteManyResult, DuplicateError, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, type FetchResult, type FilterCombinator, type FilterOperator, type FilterRule, type FilterState, ForbiddenError, type InstalledBundleSummary, type MultipartRequestOptions, NotFoundError, type ObjectBuilderLike, type ObjectDefinition, type ObjectsOf, type ObjectsOfBundles, type OperationCaller, type RecordAccessRole, type RecordAudience, type RecordCreateOptions, type RecordInput, type RecordMetadata, type RecordUpdate, type RecordUpdateOptions, type RecordsAggregateOptions, type RecordsExportOptions, type RecordsQuery, type Register, SchemaError, SchemaErrorCode, type SchemaSourceCurrencyRetype, type SchemaSourcePhoneRetype, type SchemaSourceRename, type SchemaSourceResolution, type SchemaSourceRetype, type SortDirection, type SortRule, type Standards, StandardsAuthError, type StandardsConfig, StandardsConfigurationError, type StandardsOf, StandardsRequestError, type StandardsTransport, type SyncBundleOptions, type SyncBundleResult, type SyncTransport, type Transport, type TransportConfig, type UntypedBuilder, type UntypedRecordsQuery, type UpdateManyEntry, type UpdateManyError, type UpdateManyResult, type UsageBucket, type UsageModality, type UsageReport, type UsageScope, ValidationError, type ViewContentDefinition, type ViewDeclaration, type ViewerAccess, type WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, createRecordsQuery, createStandards, createTransport, currency, currentActor, date, detailView, document, encodePathSegment, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, syncBundle, text, today, user };
package/dist/index.d.ts CHANGED
@@ -1,18 +1,35 @@
1
1
 
2
- import { A as PrivateUploadedFile, B as DocumentsTransport, C as UpdateManyEntry, D as CamelCase, E as createRecordsQuery, F as UploadedFile, G as SyncTransport, H as FileInput, I as createFilesApi, K as syncBundle, L as AttachToRecordInput, M as UploadFileInput, N as UploadPrivateFileInput, O as FilesApi, P as UploadPublicFileInput, R as AttachToRecordResult, S as UntypedRecordsQuery, T as UpdateManyResult, U as UploadTimeoutOption, V as createDocumentsApi, W as SyncBundleOptions, _ as RecordUpdate, a as StandardsConfig, b as RecordsQuery, c as UsageReportInput, d as CreateManyError, f as CreateManyResult, g as RecordInput, h as FetchResult, i as Standards, j as PublicUploadedFile, k as FilesTransport, l as UsageTransport, m as DeleteManyResult, n as ObjectsOf, o as createStandards, p as DeleteManyError, r as ObjectsOfBundles, s as UsageApi, t as AnyBundle, u as createUsageApi, v as RecordsAggregateOptions, w as UpdateManyError, x as UntypedBuilder, y as RecordsExportOptions, z as DocumentsApi } from "./create-standards-BWOo2EZw.js";
3
- import { _ as StandardsRequestError, g as StandardsConfigurationError, h as StandardsAuthError, m as BundleValidationError, o as Transport, p as BundleConflictError, r as MultipartRequestOptions, s as TransportConfig, u as createTransport } from "./http-transport-BxJhcXjy.js";
4
- import { ActorType, Attribute, BUNDLE_NAME_PATTERN, BuiltBundle, BundleBuilder, BundlePiece, CollectionPage, CollectionResponse, ContentViewDefinition, DuplicateError, ExtractRecord, ExtractRecordInput, ExtractRecordInputStrict, ExtractRecordStrict, ExtractRecordUpdate, ExtractRecordUpdateStrict, FilterCombinator, FilterOperator, FilterRule, FilterState, ForbiddenError, InstalledBundleSummary, NotFoundError, ObjectBuilderLike, ObjectDefinition, ObjectDefinition as ObjectDefinition$1, RecordAccessRole, RecordAudience, RecordMetadata, SchemaError, SchemaErrorCode, SchemaSourceCurrencyRetype, SchemaSourcePhoneRetype, SchemaSourceRename, SchemaSourceResolution, SchemaSourceRetype, SortDirection, SortRule, SyncBundleResult, UsageBucket, UsageModality, UsageReport, UsageScope, ValidationError, ViewContentDefinition, ViewDeclaration, ViewerAccess, WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, currency, currentActor, date, detailView, document, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, text, today, user } from "@standards/schema";
5
- import { encodePathSegment } from "@standards/schema/api";
2
+ import { A as SyncBundleOptions, C as UntypedBuilder, D as UpdateManyResult, E as UpdateManyError, M as syncBundle, O as createRecordsQuery, S as RecordsQuery, T as UpdateManyEntry, _ as RecordInput, a as ObjectsOfBundles, b as RecordsAggregateOptions, c as StandardsOf, d as CreateManyError, f as CreateManyResult, g as RecordCreateOptions, h as FetchResult, i as ObjectsOf, j as SyncTransport, k as CamelCase, l as StandardsTransport, m as DeleteManyResult, n as AnyBundle, o as Standards, p as DeleteManyError, r as BundlesSync, s as StandardsConfig, t as ActingStandards, u as createStandards, v as RecordUpdate, w as UntypedRecordsQuery, x as RecordsExportOptions, y as RecordUpdateOptions } from "./create-standards-De7-xdtZ.js";
3
+ import { F as StandardsRequestError, M as BundleValidationError, N as StandardsAuthError, O as createTransport, P as StandardsConfigurationError, T as TransportConfig, b as MultipartRequestOptions, j as BundleConflictError, w as Transport } from "./app-_CiXRLoD.js";
4
+ import { ActorType, Attribute, BUNDLE_NAME_PATTERN, BuiltBundle, BundleBuilder, BundlePiece, CollectionPage, CollectionResponse, ContentViewDefinition, DuplicateError, ExtractRecord, ExtractRecordInput, ExtractRecordInputStrict, ExtractRecordStrict, ExtractRecordUpdate, ExtractRecordUpdateStrict, FilterCombinator, FilterOperator, FilterRule, FilterState, ForbiddenError, InstalledBundleSummary, NotFoundError, ObjectBuilderLike, ObjectDefinition, RecordAccessRole, RecordAudience, RecordMetadata, SchemaError, SchemaErrorCode, SchemaSourceCurrencyRetype, SchemaSourcePhoneRetype, SchemaSourceRename, SchemaSourceResolution, SchemaSourceRetype, SortDirection, SortRule, SyncBundleResult, UsageBucket, UsageModality, UsageReport, UsageScope, ValidationError, ViewContentDefinition, ViewDeclaration, ViewerAccess, WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, currency, currentActor, date, detailView, document, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, text, today, user } from "@standards/schema";
5
+ import { ActorId, OperationCaller, encodePathSegment } from "@standards/schema/api";
6
6
  /**
7
- * JSON delivers dates as ISO strings; the client knows the definition, so it
8
- * revives system timestamps and every `date` attribute so `ExtractRecord` tells
9
- * the truth on the wire. Nothing else is transformed.
7
+ * Declare your bundle once, and the default `standards` instance is typed by
8
+ * it:
9
+ *
10
+ * ```ts
11
+ * declare module "@standards/client" {
12
+ * interface Register { bundle: typeof crm }
13
+ * }
14
+ * ```
10
15
  */
11
- export declare function reviveRecord<T extends Record<string, unknown>>(definition: ObjectDefinition$1 | null, raw: T): T;
16
+ interface Register {}
17
+ type RegisteredObjects = Register extends {
18
+ bundle: infer B extends AnyBundle;
19
+ } ? B["objectBuilders"] : readonly [];
20
+ /** The default instance's type: the registered bundle's objects, and `as`. */
21
+ type DefaultStandards = ActingStandards<StandardsOf<RegisteredObjects>>;
22
+ /**
23
+ * The ready instance: `import { standards } from "@standards/client"` and
24
+ * call it. Its transport is resolved on first use (see {@link resolved}); its
25
+ * types come from {@link Register}. `createStandards` stays for several
26
+ * instances or another workspace.
27
+ */
28
+ export declare const standards: DefaultStandards;
12
29
  /**
13
30
  * Every caller-supplied path segment is percent-encoded: `objectName` and `id`
14
31
  * come from the application, and an id such as `../../bundles/x` must
15
32
  * never leave `/records/<object>/`.
16
33
  */
17
34
  export declare function recordsPath(objectName: string, ...segments: string[]): string;
18
- export { type ActorType, type AnyBundle, type AttachToRecordInput, type AttachToRecordResult, type Attribute, BUNDLE_NAME_PATTERN, type BuiltBundle, type BundleBuilder, BundleConflictError, type BundlePiece, BundleValidationError, type CamelCase, type CollectionPage, type CollectionResponse, type ContentViewDefinition, type CreateManyError, type CreateManyResult, type DeleteManyError, type DeleteManyResult, type DocumentsApi, type DocumentsTransport, DuplicateError, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, type FetchResult, type FileInput, type FilesApi, type FilesTransport, type FilterCombinator, type FilterOperator, type FilterRule, type FilterState, ForbiddenError, type InstalledBundleSummary, type MultipartRequestOptions, NotFoundError, type ObjectBuilderLike, type ObjectDefinition, type ObjectsOf, type ObjectsOfBundles, type PrivateUploadedFile, type PublicUploadedFile, type RecordAccessRole, type RecordAudience, type RecordInput, type RecordMetadata, type RecordUpdate, type RecordsAggregateOptions, type RecordsExportOptions, type RecordsQuery, SchemaError, SchemaErrorCode, type SchemaSourceCurrencyRetype, type SchemaSourcePhoneRetype, type SchemaSourceRename, type SchemaSourceResolution, type SchemaSourceRetype, type SortDirection, type SortRule, type Standards, StandardsAuthError, type StandardsConfig, StandardsConfigurationError, StandardsRequestError, type SyncBundleOptions, type SyncBundleResult, type SyncTransport, type Transport, type TransportConfig, type UntypedBuilder, type UntypedRecordsQuery, type UpdateManyEntry, type UpdateManyError, type UpdateManyResult, type UploadFileInput, type UploadPrivateFileInput, type UploadPublicFileInput, type UploadTimeoutOption, type UploadedFile, type UsageApi, type UsageBucket, type UsageModality, type UsageReport, type UsageReportInput, type UsageScope, type UsageTransport, ValidationError, type ViewContentDefinition, type ViewDeclaration, type ViewerAccess, type WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, createDocumentsApi, createFilesApi, createRecordsQuery, createStandards, createTransport, createUsageApi, currency, currentActor, date, detailView, document, encodePathSegment, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, syncBundle, text, today, user };
35
+ export { type ActingStandards, type ActorId, type ActorType, type AnyBundle, type Attribute, BUNDLE_NAME_PATTERN, type BuiltBundle, type BundleBuilder, BundleConflictError, type BundlePiece, BundleValidationError, type BundlesSync, type CamelCase, type CollectionPage, type CollectionResponse, type ContentViewDefinition, type CreateManyError, type CreateManyResult, type DefaultStandards, type DeleteManyError, type DeleteManyResult, DuplicateError, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, type FetchResult, type FilterCombinator, type FilterOperator, type FilterRule, type FilterState, ForbiddenError, type InstalledBundleSummary, type MultipartRequestOptions, NotFoundError, type ObjectBuilderLike, type ObjectDefinition, type ObjectsOf, type ObjectsOfBundles, type OperationCaller, type RecordAccessRole, type RecordAudience, type RecordCreateOptions, type RecordInput, type RecordMetadata, type RecordUpdate, type RecordUpdateOptions, type RecordsAggregateOptions, type RecordsExportOptions, type RecordsQuery, type Register, SchemaError, SchemaErrorCode, type SchemaSourceCurrencyRetype, type SchemaSourcePhoneRetype, type SchemaSourceRename, type SchemaSourceResolution, type SchemaSourceRetype, type SortDirection, type SortRule, type Standards, StandardsAuthError, type StandardsConfig, StandardsConfigurationError, type StandardsOf, StandardsRequestError, type StandardsTransport, type SyncBundleOptions, type SyncBundleResult, type SyncTransport, type Transport, type TransportConfig, type UntypedBuilder, type UntypedRecordsQuery, type UpdateManyEntry, type UpdateManyError, type UpdateManyResult, type UsageBucket, type UsageModality, type UsageReport, type UsageScope, ValidationError, type ViewContentDefinition, type ViewDeclaration, type ViewerAccess, type WalletState, assertBundleName, bundle, canonicalStringify, checkbox, content, createRecordsQuery, createStandards, createTransport, currency, currentActor, date, detailView, document, encodePathSegment, formula, group, listView, location, multiselect, now, number, object, phone, query, relation, richtext, rollup, select, status, syncBundle, text, today, user };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./create-standards-Bl-VDgXY.js"),t=require("./http-transport-Dr0ZiTG1.js");let n=require("@standards/schema/api"),r=require("@standards/schema");Object.defineProperty(exports,"BUNDLE_NAME_PATTERN",{enumerable:!0,get:function(){return r.BUNDLE_NAME_PATTERN}}),exports.BundleConflictError=t.p,exports.BundleValidationError=t.m,Object.defineProperty(exports,"DuplicateError",{enumerable:!0,get:function(){return r.DuplicateError}}),Object.defineProperty(exports,"ForbiddenError",{enumerable:!0,get:function(){return r.ForbiddenError}}),Object.defineProperty(exports,"NotFoundError",{enumerable:!0,get:function(){return r.NotFoundError}}),Object.defineProperty(exports,"SchemaError",{enumerable:!0,get:function(){return r.SchemaError}}),Object.defineProperty(exports,"SchemaErrorCode",{enumerable:!0,get:function(){return r.SchemaErrorCode}}),exports.StandardsAuthError=t.h,exports.StandardsConfigurationError=t.g,exports.StandardsRequestError=t._,Object.defineProperty(exports,"ValidationError",{enumerable:!0,get:function(){return r.ValidationError}}),Object.defineProperty(exports,"assertBundleName",{enumerable:!0,get:function(){return r.assertBundleName}}),Object.defineProperty(exports,"bundle",{enumerable:!0,get:function(){return r.bundle}}),Object.defineProperty(exports,"canonicalStringify",{enumerable:!0,get:function(){return r.canonicalStringify}}),Object.defineProperty(exports,"checkbox",{enumerable:!0,get:function(){return r.checkbox}}),Object.defineProperty(exports,"content",{enumerable:!0,get:function(){return r.content}}),exports.createDocumentsApi=e.l,exports.createFilesApi=e.c,exports.createRecordsQuery=e.i,exports.createStandards=e.n,exports.createTransport=t.n,exports.createUsageApi=e.r,Object.defineProperty(exports,"currency",{enumerable:!0,get:function(){return r.currency}}),Object.defineProperty(exports,"currentActor",{enumerable:!0,get:function(){return r.currentActor}}),Object.defineProperty(exports,"date",{enumerable:!0,get:function(){return r.date}}),Object.defineProperty(exports,"detailView",{enumerable:!0,get:function(){return r.detailView}}),Object.defineProperty(exports,"document",{enumerable:!0,get:function(){return r.document}}),Object.defineProperty(exports,"encodePathSegment",{enumerable:!0,get:function(){return n.encodePathSegment}}),Object.defineProperty(exports,"formula",{enumerable:!0,get:function(){return r.formula}}),Object.defineProperty(exports,"group",{enumerable:!0,get:function(){return r.group}}),Object.defineProperty(exports,"listView",{enumerable:!0,get:function(){return r.listView}}),Object.defineProperty(exports,"location",{enumerable:!0,get:function(){return r.location}}),Object.defineProperty(exports,"multiselect",{enumerable:!0,get:function(){return r.multiselect}}),Object.defineProperty(exports,"now",{enumerable:!0,get:function(){return r.now}}),Object.defineProperty(exports,"number",{enumerable:!0,get:function(){return r.number}}),Object.defineProperty(exports,"object",{enumerable:!0,get:function(){return r.object}}),Object.defineProperty(exports,"phone",{enumerable:!0,get:function(){return r.phone}}),Object.defineProperty(exports,"query",{enumerable:!0,get:function(){return r.query}}),exports.recordsPath=t.a,Object.defineProperty(exports,"relation",{enumerable:!0,get:function(){return r.relation}}),exports.reviveRecord=e.o,Object.defineProperty(exports,"richtext",{enumerable:!0,get:function(){return r.richtext}}),Object.defineProperty(exports,"rollup",{enumerable:!0,get:function(){return r.rollup}}),Object.defineProperty(exports,"select",{enumerable:!0,get:function(){return r.select}}),Object.defineProperty(exports,"status",{enumerable:!0,get:function(){return r.status}}),exports.syncBundle=e.u,Object.defineProperty(exports,"text",{enumerable:!0,get:function(){return r.text}}),Object.defineProperty(exports,"today",{enumerable:!0,get:function(){return r.today}}),Object.defineProperty(exports,"user",{enumerable:!0,get:function(){return r.user}});
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./create-standards-2D3Tmvj1.js"),t=require("./app-BgWz3r5k.js");let n=require("@standards/schema/api"),r=require("@standards/schema");const i=/* @__PURE__ */ new WeakMap;let a;function resolved(){let r=(0,n.registeredOperationHost)();if(r!==void 0){let n=i.get(r);return n===void 0&&(n=e.t(t.n(r.host),r.objects),i.set(r,n)),n}if(a===void 0){let n;try{n=e.r({})}catch(e){throw e instanceof t.m?new t.m(`The default standards instance found no Standards host in this process (a server embedding Standards registers one at boot), so it calls the API over HTTP, and ${e.message}`):e}a=e.t(t.i(n),[])}return a}function asOverHttp(e){throw new t.m(`standards.as() acts in process only, in a server that embeds Standards: over HTTP every call acts as the API key's actor. Use a key of the actor you want instead.`)}const o=new Proxy({},{get(e,t){if(typeof t==`symbol`||t===`then`)return;let n=resolved();return t===`as`&&!(`as`in n)?asOverHttp:Reflect.get(n,t)},has:(e,t)=>Reflect.has(resolved(),t),ownKeys:()=>Reflect.ownKeys(resolved()),getOwnPropertyDescriptor(e,t){let n=Reflect.getOwnPropertyDescriptor(resolved(),t);return n===void 0?void 0:{...n,configurable:!0}}});Object.defineProperty(exports,"BUNDLE_NAME_PATTERN",{enumerable:!0,get:function(){return r.BUNDLE_NAME_PATTERN}}),exports.BundleConflictError=t.d,exports.BundleValidationError=t.f,Object.defineProperty(exports,"DuplicateError",{enumerable:!0,get:function(){return r.DuplicateError}}),Object.defineProperty(exports,"ForbiddenError",{enumerable:!0,get:function(){return r.ForbiddenError}}),Object.defineProperty(exports,"NotFoundError",{enumerable:!0,get:function(){return r.NotFoundError}}),Object.defineProperty(exports,"SchemaError",{enumerable:!0,get:function(){return r.SchemaError}}),Object.defineProperty(exports,"SchemaErrorCode",{enumerable:!0,get:function(){return r.SchemaErrorCode}}),exports.StandardsAuthError=t.p,exports.StandardsConfigurationError=t.m,exports.StandardsRequestError=t.h,Object.defineProperty(exports,"ValidationError",{enumerable:!0,get:function(){return r.ValidationError}}),Object.defineProperty(exports,"assertBundleName",{enumerable:!0,get:function(){return r.assertBundleName}}),Object.defineProperty(exports,"bundle",{enumerable:!0,get:function(){return r.bundle}}),Object.defineProperty(exports,"canonicalStringify",{enumerable:!0,get:function(){return r.canonicalStringify}}),Object.defineProperty(exports,"checkbox",{enumerable:!0,get:function(){return r.checkbox}}),Object.defineProperty(exports,"content",{enumerable:!0,get:function(){return r.content}}),exports.createRecordsQuery=e.i,exports.createStandards=e.n,exports.createTransport=t.i,Object.defineProperty(exports,"currency",{enumerable:!0,get:function(){return r.currency}}),Object.defineProperty(exports,"currentActor",{enumerable:!0,get:function(){return r.currentActor}}),Object.defineProperty(exports,"date",{enumerable:!0,get:function(){return r.date}}),Object.defineProperty(exports,"detailView",{enumerable:!0,get:function(){return r.detailView}}),Object.defineProperty(exports,"document",{enumerable:!0,get:function(){return r.document}}),Object.defineProperty(exports,"encodePathSegment",{enumerable:!0,get:function(){return n.encodePathSegment}}),Object.defineProperty(exports,"formula",{enumerable:!0,get:function(){return r.formula}}),Object.defineProperty(exports,"group",{enumerable:!0,get:function(){return r.group}}),Object.defineProperty(exports,"listView",{enumerable:!0,get:function(){return r.listView}}),Object.defineProperty(exports,"location",{enumerable:!0,get:function(){return r.location}}),Object.defineProperty(exports,"multiselect",{enumerable:!0,get:function(){return r.multiselect}}),Object.defineProperty(exports,"now",{enumerable:!0,get:function(){return r.now}}),Object.defineProperty(exports,"number",{enumerable:!0,get:function(){return r.number}}),Object.defineProperty(exports,"object",{enumerable:!0,get:function(){return r.object}}),Object.defineProperty(exports,"phone",{enumerable:!0,get:function(){return r.phone}}),Object.defineProperty(exports,"query",{enumerable:!0,get:function(){return r.query}}),exports.recordsPath=t.s,Object.defineProperty(exports,"relation",{enumerable:!0,get:function(){return r.relation}}),Object.defineProperty(exports,"richtext",{enumerable:!0,get:function(){return r.richtext}}),Object.defineProperty(exports,"rollup",{enumerable:!0,get:function(){return r.rollup}}),Object.defineProperty(exports,"select",{enumerable:!0,get:function(){return r.select}}),exports.standards=o,Object.defineProperty(exports,"status",{enumerable:!0,get:function(){return r.status}}),exports.syncBundle=e.s,Object.defineProperty(exports,"text",{enumerable:!0,get:function(){return r.text}}),Object.defineProperty(exports,"today",{enumerable:!0,get:function(){return r.today}}),Object.defineProperty(exports,"user",{enumerable:!0,get:function(){return r.user}});
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- import{c as e,i as t,l as n,n as r,o as i,r as a,u as o}from"./create-standards-Dn5ZKfjN.mjs";import{_ as s,a as c,g as l,h as u,m as d,n as f,p}from"./http-transport-GAQftrWY.mjs";import{BUNDLE_NAME_PATTERN as m,DuplicateError as h,ForbiddenError as g,NotFoundError as _,SchemaError as v,SchemaErrorCode as y,ValidationError as b,assertBundleName as x,bundle as S,canonicalStringify as C,checkbox as w,content as T,currency as E,currentActor as D,date as O,detailView as k,document as A,formula as j,group as M,listView as N,location as P,multiselect as F,now as I,number as L,object as R,phone as z,query as B,relation as V,richtext as H,rollup as U,select as W,status as G,text as K,today as q,user as J}from"@standards/schema";import{encodePathSegment as Y}from"@standards/schema/api";export{m as BUNDLE_NAME_PATTERN,p as BundleConflictError,d as BundleValidationError,h as DuplicateError,g as ForbiddenError,_ as NotFoundError,v as SchemaError,y as SchemaErrorCode,u as StandardsAuthError,l as StandardsConfigurationError,s as StandardsRequestError,b as ValidationError,x as assertBundleName,S as bundle,C as canonicalStringify,w as checkbox,T as content,n as createDocumentsApi,e as createFilesApi,t as createRecordsQuery,r as createStandards,f as createTransport,a as createUsageApi,E as currency,D as currentActor,O as date,k as detailView,A as document,Y as encodePathSegment,j as formula,M as group,N as listView,P as location,F as multiselect,I as now,L as number,R as object,z as phone,B as query,c as recordsPath,V as relation,i as reviveRecord,H as richtext,U as rollup,W as select,G as status,o as syncBundle,K as text,q as today,J as user};
2
+ import{i as e,n as t,r as n,s as r,t as i}from"./create-standards-CZ_ZYNz8.mjs";import{d as a,f as o,h as s,i as c,m as l,n as u,p as d,s as f}from"./app-TJt8rk9y.mjs";import{BUNDLE_NAME_PATTERN as p,DuplicateError as m,ForbiddenError as h,NotFoundError as g,SchemaError as _,SchemaErrorCode as v,ValidationError as y,assertBundleName as b,bundle as x,canonicalStringify as S,checkbox as C,content as w,currency as T,currentActor as E,date as D,detailView as O,document as k,formula as A,group as j,listView as M,location as N,multiselect as P,now as F,number as I,object as L,phone as R,query as z,relation as B,richtext as V,rollup as H,select as U,status as W,text as G,today as K,user as q}from"@standards/schema";import{encodePathSegment as J,registeredOperationHost as Y}from"@standards/schema/api";const X=/* @__PURE__ */ new WeakMap;let Z;function resolved(){let e=Y();if(e!==void 0){let t=X.get(e);return t===void 0&&(t=i(u(e.host),e.objects),X.set(e,t)),t}if(Z===void 0){let e;try{e=n({})}catch(e){throw e instanceof l?new l(`The default standards instance found no Standards host in this process (a server embedding Standards registers one at boot), so it calls the API over HTTP, and ${e.message}`):e}Z=i(c(e),[])}return Z}function asOverHttp(e){throw new l(`standards.as() acts in process only, in a server that embeds Standards: over HTTP every call acts as the API key's actor. Use a key of the actor you want instead.`)}const Q=new Proxy({},{get(e,t){if(typeof t==`symbol`||t===`then`)return;let n=resolved();return t===`as`&&!(`as`in n)?asOverHttp:Reflect.get(n,t)},has:(e,t)=>Reflect.has(resolved(),t),ownKeys:()=>Reflect.ownKeys(resolved()),getOwnPropertyDescriptor(e,t){let n=Reflect.getOwnPropertyDescriptor(resolved(),t);return n===void 0?void 0:{...n,configurable:!0}}});export{p as BUNDLE_NAME_PATTERN,a as BundleConflictError,o as BundleValidationError,m as DuplicateError,h as ForbiddenError,g as NotFoundError,_ as SchemaError,v as SchemaErrorCode,d as StandardsAuthError,l as StandardsConfigurationError,s as StandardsRequestError,y as ValidationError,b as assertBundleName,x as bundle,S as canonicalStringify,C as checkbox,w as content,e as createRecordsQuery,t as createStandards,c as createTransport,T as currency,E as currentActor,D as date,O as detailView,k as document,J as encodePathSegment,A as formula,j as group,M as listView,N as location,P as multiselect,F as now,I as number,L as object,R as phone,z as query,f as recordsPath,B as relation,V as richtext,H as rollup,U as select,Q as standards,W as status,r as syncBundle,G as text,K as today,q as user};
@@ -1,6 +1,6 @@
1
1
 
2
- import { i as Standards, n as ObjectsOf, r as ObjectsOfBundles, t as AnyBundle } from "./create-standards-HiWpTAlP.mjs";
3
- import "./http-transport-BxJhcXjy.mjs";
2
+ import { a as ObjectsOfBundles, c as StandardsOf, n as AnyBundle } from "./create-standards-lDN6ru8u.mjs";
3
+ import "./app-_CiXRLoD.mjs";
4
4
  import { ExtractRecord, ExtractRecordInputStrict, ObjectBuilderLike } from "@standards/schema";
5
5
  /**
6
6
  * A filter rule the in-memory workspace does not serve. The server answers
@@ -42,7 +42,7 @@ export type TestSeed<TBuilder> = Omit<ExtractRecordInputStrict<TBuilder>, Pinned
42
42
  };
43
43
  export interface TestStandards<TObjects extends readonly ObjectBuilderLike[]> {
44
44
  /** The real client over the in-memory workspace: pass it wherever the app takes `createStandards`'s. */
45
- db: Standards & ObjectsOf<TObjects>;
45
+ db: StandardsOf<TObjects>;
46
46
  /**
47
47
  * Store records directly, without a request; ids and timestamps are filled
48
48
  * in unless given. Keyed by the object's name, as `from()` is.
@@ -60,7 +60,9 @@ export interface TestStandards<TObjects extends readonly ObjectBuilderLike[]> {
60
60
  * app ships — over a transport that answers like the records API: pages of 20
61
61
  * by default and 1000 at most, newest first, the server's filter operators and
62
62
  * sort order. An operator it does not serve throws
63
- * `UnsupportedFilterOperatorError`; any other route answers `501`.
63
+ * `UnsupportedFilterOperatorError`. `update` with `metadata` is served (its
64
+ * single `record.set` step of `POST /operations`), the metadata not kept; any
65
+ * other route answers `501`.
64
66
  *
65
67
  * @example
66
68
  * const { db, seed } = createTestStandards({ bundles: [helpdesk] });
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- import { i as Standards, n as ObjectsOf, r as ObjectsOfBundles, t as AnyBundle } from "./create-standards-BWOo2EZw.js";
3
- import "./http-transport-BxJhcXjy.js";
2
+ import { a as ObjectsOfBundles, c as StandardsOf, n as AnyBundle } from "./create-standards-De7-xdtZ.js";
3
+ import "./app-_CiXRLoD.js";
4
4
  import { ExtractRecord, ExtractRecordInputStrict, ObjectBuilderLike } from "@standards/schema";
5
5
  /**
6
6
  * A filter rule the in-memory workspace does not serve. The server answers
@@ -42,7 +42,7 @@ export type TestSeed<TBuilder> = Omit<ExtractRecordInputStrict<TBuilder>, Pinned
42
42
  };
43
43
  export interface TestStandards<TObjects extends readonly ObjectBuilderLike[]> {
44
44
  /** The real client over the in-memory workspace: pass it wherever the app takes `createStandards`'s. */
45
- db: Standards & ObjectsOf<TObjects>;
45
+ db: StandardsOf<TObjects>;
46
46
  /**
47
47
  * Store records directly, without a request; ids and timestamps are filled
48
48
  * in unless given. Keyed by the object's name, as `from()` is.
@@ -60,7 +60,9 @@ export interface TestStandards<TObjects extends readonly ObjectBuilderLike[]> {
60
60
  * app ships — over a transport that answers like the records API: pages of 20
61
61
  * by default and 1000 at most, newest first, the server's filter operators and
62
62
  * sort order. An operator it does not serve throws
63
- * `UnsupportedFilterOperatorError`; any other route answers `501`.
63
+ * `UnsupportedFilterOperatorError`. `update` with `metadata` is served (its
64
+ * single `record.set` step of `POST /operations`), the metadata not kept; any
65
+ * other route answers `501`.
64
66
  *
65
67
  * @example
66
68
  * const { db, seed } = createTestStandards({ bundles: [helpdesk] });