@proofkit/fmdapi 5.0.0-beta.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/LICENSE.md +21 -0
- package/README.md +110 -0
- package/dist/esm/adapters/core.d.ts +55 -0
- package/dist/esm/adapters/fetch-base-types.d.ts +7 -0
- package/dist/esm/adapters/fetch-base.d.ts +60 -0
- package/dist/esm/adapters/fetch-base.js +256 -0
- package/dist/esm/adapters/fetch-base.js.map +1 -0
- package/dist/esm/adapters/fetch.d.ts +27 -0
- package/dist/esm/adapters/fetch.js +79 -0
- package/dist/esm/adapters/fetch.js.map +1 -0
- package/dist/esm/adapters/otto.d.ts +26 -0
- package/dist/esm/adapters/otto.js +29 -0
- package/dist/esm/adapters/otto.js.map +1 -0
- package/dist/esm/client-types.d.ts +226 -0
- package/dist/esm/client-types.js +41 -0
- package/dist/esm/client-types.js.map +1 -0
- package/dist/esm/client.d.ts +133 -0
- package/dist/esm/client.js +295 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/tokenStore/file.d.ts +3 -0
- package/dist/esm/tokenStore/index.d.ts +3 -0
- package/dist/esm/tokenStore/memory.d.ts +3 -0
- package/dist/esm/tokenStore/memory.js +21 -0
- package/dist/esm/tokenStore/memory.js.map +1 -0
- package/dist/esm/tokenStore/types.d.ts +8 -0
- package/dist/esm/tokenStore/upstash.d.ts +6 -0
- package/dist/esm/utils.d.ts +8 -0
- package/dist/esm/utils.js +16 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +99 -0
- package/src/adapters/core.ts +62 -0
- package/src/adapters/fetch-base-types.ts +5 -0
- package/src/adapters/fetch-base.ts +339 -0
- package/src/adapters/fetch.ts +95 -0
- package/src/adapters/otto.ts +59 -0
- package/src/client-types.ts +296 -0
- package/src/client.ts +534 -0
- package/src/index.ts +11 -0
- package/src/tokenStore/file.ts +33 -0
- package/src/tokenStore/index.ts +3 -0
- package/src/tokenStore/memory.ts +20 -0
- package/src/tokenStore/types.ts +7 -0
- package/src/tokenStore/upstash.ts +31 -0
- package/src/utils.ts +29 -0
- package/stubs/fmschema.config.stub.js +17 -0
- package/stubs/fmschema.config.stub.mjs +17 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseFetchAdapter } from './fetch-base.js';
|
|
2
|
+
import { BaseFetchAdapterOptions } from './fetch-base-types.js';
|
|
3
|
+
export type Otto3APIKey = `KEY_${string}`;
|
|
4
|
+
export type OttoFMSAPIKey = `dk_${string}`;
|
|
5
|
+
export type OttoAPIKey = Otto3APIKey | OttoFMSAPIKey;
|
|
6
|
+
export declare function isOtto3APIKey(key: string): key is Otto3APIKey;
|
|
7
|
+
export declare function isOttoFMSAPIKey(key: string): key is OttoFMSAPIKey;
|
|
8
|
+
export declare function isOttoAPIKey(key: string): key is OttoAPIKey;
|
|
9
|
+
export declare function isOttoAuth(auth: unknown): auth is OttoAuth;
|
|
10
|
+
type OttoAuth = {
|
|
11
|
+
apiKey: Otto3APIKey;
|
|
12
|
+
ottoPort?: number;
|
|
13
|
+
} | {
|
|
14
|
+
apiKey: OttoFMSAPIKey;
|
|
15
|
+
ottoPort?: never;
|
|
16
|
+
};
|
|
17
|
+
export type OttoAdapterOptions = BaseFetchAdapterOptions & {
|
|
18
|
+
auth: OttoAuth;
|
|
19
|
+
};
|
|
20
|
+
export declare class OttoAdapter extends BaseFetchAdapter {
|
|
21
|
+
private apiKey;
|
|
22
|
+
private port;
|
|
23
|
+
constructor(options: OttoAdapterOptions);
|
|
24
|
+
protected getToken: () => Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { BaseFetchAdapter } from "./fetch-base.js";
|
|
5
|
+
class OttoAdapter extends BaseFetchAdapter {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({ ...options, refreshToken: false });
|
|
8
|
+
__publicField(this, "apiKey");
|
|
9
|
+
__publicField(this, "port");
|
|
10
|
+
__publicField(this, "getToken", async () => {
|
|
11
|
+
return this.apiKey;
|
|
12
|
+
});
|
|
13
|
+
this.apiKey = options.auth.apiKey;
|
|
14
|
+
this.port = options.auth.ottoPort;
|
|
15
|
+
if (this.apiKey.startsWith("KEY_")) {
|
|
16
|
+
this.baseUrl.port = (this.port ?? 3030).toString();
|
|
17
|
+
} else if (this.apiKey.startsWith("dk_")) {
|
|
18
|
+
this.baseUrl.pathname = `otto/${this.baseUrl.pathname.replace(/^\/+|\/+$/g, "")}`;
|
|
19
|
+
} else {
|
|
20
|
+
throw new Error(
|
|
21
|
+
"Invalid Otto API key format. Must start with 'KEY_' (Otto v3) or 'dk_' (OttoFMS)"
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
OttoAdapter
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=otto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otto.js","sources":["../../../src/adapters/otto.ts"],"sourcesContent":["import { BaseFetchAdapter } from \"./fetch-base.js\";\nimport type { BaseFetchAdapterOptions } from \"./fetch-base-types.js\";\n\nexport type Otto3APIKey = `KEY_${string}`;\nexport type OttoFMSAPIKey = `dk_${string}`;\nexport type OttoAPIKey = Otto3APIKey | OttoFMSAPIKey;\n\nexport function isOtto3APIKey(key: string): key is Otto3APIKey {\n return key.startsWith(\"KEY_\");\n}\nexport function isOttoFMSAPIKey(key: string): key is OttoFMSAPIKey {\n return key.startsWith(\"dk_\");\n}\nexport function isOttoAPIKey(key: string): key is OttoAPIKey {\n return isOtto3APIKey(key) || isOttoFMSAPIKey(key);\n}\n\nexport function isOttoAuth(auth: unknown): auth is OttoAuth {\n if (typeof auth !== \"object\" || auth === null) return false;\n return \"apiKey\" in auth;\n}\n\ntype OttoAuth =\n | {\n apiKey: Otto3APIKey;\n ottoPort?: number;\n }\n | { apiKey: OttoFMSAPIKey; ottoPort?: never };\n\nexport type OttoAdapterOptions = BaseFetchAdapterOptions & {\n auth: OttoAuth;\n};\n\nexport class OttoAdapter extends BaseFetchAdapter {\n private apiKey: OttoAPIKey | Otto3APIKey;\n private port: number | undefined;\n\n constructor(options: OttoAdapterOptions) {\n super({ ...options, refreshToken: false });\n this.apiKey = options.auth.apiKey;\n this.port = options.auth.ottoPort;\n\n if (this.apiKey.startsWith(\"KEY_\")) {\n // otto v3 uses port 3030\n this.baseUrl.port = (this.port ?? 3030).toString();\n } else if (this.apiKey.startsWith(\"dk_\")) {\n // otto v4 uses default port, but with /otto prefix\n this.baseUrl.pathname = `otto/${this.baseUrl.pathname.replace(/^\\/+|\\/+$/g, \"\")}`;\n } else {\n throw new Error(\n \"Invalid Otto API key format. Must start with 'KEY_' (Otto v3) or 'dk_' (OttoFMS)\",\n );\n }\n }\n\n protected override getToken = async (): Promise<string> => {\n return this.apiKey;\n };\n}\n"],"names":[],"mappings":";;;;AAiCO,MAAM,oBAAoB,iBAAiB;AAAA,EAIhD,YAAY,SAA6B;AACvC,UAAM,EAAE,GAAG,SAAS,cAAc,OAAO;AAJnC;AACA;AAoBW,oCAAW,YAA6B;AACzD,aAAO,KAAK;AAAA,IACd;AAlBO,SAAA,SAAS,QAAQ,KAAK;AACtB,SAAA,OAAO,QAAQ,KAAK;AAEzB,QAAI,KAAK,OAAO,WAAW,MAAM,GAAG;AAElC,WAAK,QAAQ,QAAQ,KAAK,QAAQ,MAAM,SAAS;AAAA,IACxC,WAAA,KAAK,OAAO,WAAW,KAAK,GAAG;AAEnC,WAAA,QAAQ,WAAW,QAAQ,KAAK,QAAQ,SAAS,QAAQ,cAAc,EAAE,CAAC;AAAA,IAAA,OAC1E;AACL,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IAAA;AAAA,EACF;AAMJ;"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ZFieldValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull, z.ZodUnknown]>;
|
|
3
|
+
export type FieldValue = z.infer<typeof ZFieldValue>;
|
|
4
|
+
export declare const ZFieldData: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull, z.ZodUnknown]>>;
|
|
5
|
+
export type FieldData = Record<string, unknown>;
|
|
6
|
+
export type GenericPortalData = {
|
|
7
|
+
[key: string]: {
|
|
8
|
+
[x: string]: string | number | null | unknown;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type PortalsWithIds<U extends GenericPortalData = GenericPortalData> = {
|
|
12
|
+
[key in keyof U]: Array<U[key] & {
|
|
13
|
+
recordId: string;
|
|
14
|
+
modId: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
export type UpdatePortalsWithIds<U extends GenericPortalData = GenericPortalData> = {
|
|
18
|
+
[key in keyof U]: Array<U[key] & {
|
|
19
|
+
recordId: string;
|
|
20
|
+
modId?: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
export type FMRecord<T extends FieldData = FieldData, U extends GenericPortalData = GenericPortalData> = {
|
|
24
|
+
fieldData: T;
|
|
25
|
+
recordId: string;
|
|
26
|
+
modId: string;
|
|
27
|
+
portalData: PortalsWithIds<U>;
|
|
28
|
+
};
|
|
29
|
+
export type ScriptParams = {
|
|
30
|
+
script?: string;
|
|
31
|
+
"script.param"?: string;
|
|
32
|
+
"script.prerequest"?: string;
|
|
33
|
+
"script.prerequest.param"?: string;
|
|
34
|
+
"script.presort"?: string;
|
|
35
|
+
"script.presort.param"?: string;
|
|
36
|
+
timeout?: number;
|
|
37
|
+
};
|
|
38
|
+
declare const ZScriptResponse: z.ZodObject<{
|
|
39
|
+
scriptResult: z.ZodOptional<z.ZodString>;
|
|
40
|
+
scriptError: z.ZodOptional<z.ZodString>;
|
|
41
|
+
"scriptResult.prerequest": z.ZodOptional<z.ZodString>;
|
|
42
|
+
"scriptError.prerequest": z.ZodOptional<z.ZodString>;
|
|
43
|
+
"scriptResult.presort": z.ZodOptional<z.ZodString>;
|
|
44
|
+
"scriptError.presort": z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, {}, {}>;
|
|
46
|
+
export type ScriptResponse = z.infer<typeof ZScriptResponse>;
|
|
47
|
+
export declare const ZDataInfo: z.ZodObject<{
|
|
48
|
+
database: z.ZodString;
|
|
49
|
+
layout: z.ZodString;
|
|
50
|
+
table: z.ZodString;
|
|
51
|
+
totalRecordCount: z.ZodNumber;
|
|
52
|
+
foundCount: z.ZodNumber;
|
|
53
|
+
returnedCount: z.ZodNumber;
|
|
54
|
+
}, {}, {}>;
|
|
55
|
+
export type DataInfo = z.infer<typeof ZDataInfo>;
|
|
56
|
+
export type CreateParams<U extends GenericPortalData = GenericPortalData> = ScriptParams & {
|
|
57
|
+
portalData?: UpdatePortalsWithIds<U>;
|
|
58
|
+
};
|
|
59
|
+
export type CreateResponse = ScriptResponse & {
|
|
60
|
+
recordId: string;
|
|
61
|
+
modId: string;
|
|
62
|
+
};
|
|
63
|
+
export type UpdateParams<U extends GenericPortalData = GenericPortalData> = CreateParams<U> & {
|
|
64
|
+
modId?: number;
|
|
65
|
+
};
|
|
66
|
+
export type UpdateResponse = ScriptResponse & {
|
|
67
|
+
modId: string;
|
|
68
|
+
};
|
|
69
|
+
export type DeleteParams = ScriptParams;
|
|
70
|
+
export type DeleteResponse = ScriptResponse;
|
|
71
|
+
export type RangeParams = {
|
|
72
|
+
offset?: number;
|
|
73
|
+
limit?: number;
|
|
74
|
+
};
|
|
75
|
+
export type RangeParamsRaw = {
|
|
76
|
+
_offset?: number;
|
|
77
|
+
_limit?: number;
|
|
78
|
+
};
|
|
79
|
+
export type PortalRanges<U extends GenericPortalData = GenericPortalData> = Partial<{
|
|
80
|
+
[key in keyof U]: RangeParams;
|
|
81
|
+
}>;
|
|
82
|
+
export type PortalRangesParams<U extends GenericPortalData = GenericPortalData> = {
|
|
83
|
+
portalRanges?: PortalRanges<U>;
|
|
84
|
+
};
|
|
85
|
+
export type GetParams<U extends GenericPortalData = GenericPortalData> = ScriptParams & PortalRangesParams<U> & {
|
|
86
|
+
"layout.response"?: string;
|
|
87
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
88
|
+
};
|
|
89
|
+
export type Sort<T extends FieldData = FieldData> = {
|
|
90
|
+
fieldName: keyof T;
|
|
91
|
+
sortOrder?: "ascend" | "descend" | (string & {});
|
|
92
|
+
};
|
|
93
|
+
export type ListParams<T extends FieldData = FieldData, U extends GenericPortalData = GenericPortalData> = GetParams<U> & RangeParams & {
|
|
94
|
+
sort?: Sort<T> | Array<Sort<T>>;
|
|
95
|
+
};
|
|
96
|
+
export type ListParamsRaw<T extends FieldData = FieldData, U extends GenericPortalData = GenericPortalData> = GetParams<U> & RangeParamsRaw & {
|
|
97
|
+
_sort?: Array<Sort<T>>;
|
|
98
|
+
};
|
|
99
|
+
export type GetResponse<T extends FieldData = FieldData, U extends GenericPortalData = GenericPortalData> = ScriptResponse & {
|
|
100
|
+
data: Array<FMRecord<T, U>>;
|
|
101
|
+
dataInfo: DataInfo;
|
|
102
|
+
};
|
|
103
|
+
export type GetResponseOne<T extends FieldData = FieldData, U extends GenericPortalData = GenericPortalData> = ScriptResponse & {
|
|
104
|
+
data: FMRecord<T, U>;
|
|
105
|
+
dataInfo: DataInfo;
|
|
106
|
+
};
|
|
107
|
+
type SecondLevelKeys<T> = {
|
|
108
|
+
[K in keyof T]: keyof T[K];
|
|
109
|
+
}[keyof T];
|
|
110
|
+
export type Query<T extends FieldData = FieldData, U extends GenericPortalData = GenericPortalData> = Partial<{
|
|
111
|
+
[key in keyof T]: T[key] extends number ? number | string : string;
|
|
112
|
+
}> & Partial<{
|
|
113
|
+
[key in SecondLevelKeys<U>]?: string;
|
|
114
|
+
}> & {
|
|
115
|
+
omit?: "true";
|
|
116
|
+
};
|
|
117
|
+
export type LayoutMetadataResponse = {
|
|
118
|
+
fieldMetaData: FieldMetaData[];
|
|
119
|
+
portalMetaData: {
|
|
120
|
+
[key: string]: FieldMetaData[];
|
|
121
|
+
};
|
|
122
|
+
valueLists?: ValueList[];
|
|
123
|
+
};
|
|
124
|
+
export type ProductInfoMetadataResponse = {
|
|
125
|
+
name: string;
|
|
126
|
+
dateFormat: string;
|
|
127
|
+
timeFormat: string;
|
|
128
|
+
timeStampFormat: string;
|
|
129
|
+
};
|
|
130
|
+
export type DatabaseMetadataResponse = {
|
|
131
|
+
databases: Array<{
|
|
132
|
+
name: string;
|
|
133
|
+
}>;
|
|
134
|
+
};
|
|
135
|
+
export type FieldMetaData = {
|
|
136
|
+
name: string;
|
|
137
|
+
type: "normal" | "calculation" | "summary";
|
|
138
|
+
displayType: "editText" | "popupList" | "popupMenu" | "checkBox" | "calendar" | "radioButtons" | "secureText";
|
|
139
|
+
result: "text" | "number" | "date" | "time" | "timeStamp" | "container";
|
|
140
|
+
global: boolean;
|
|
141
|
+
autoEnter: boolean;
|
|
142
|
+
fourDigitYear: boolean;
|
|
143
|
+
maxRepeat: number;
|
|
144
|
+
maxCharacters: number;
|
|
145
|
+
notEmpty: boolean;
|
|
146
|
+
numeric: boolean;
|
|
147
|
+
repetitions: number;
|
|
148
|
+
timeOfDay: boolean;
|
|
149
|
+
valueList?: string;
|
|
150
|
+
};
|
|
151
|
+
type ValueList = {
|
|
152
|
+
name: string;
|
|
153
|
+
type: "customList" | "byField";
|
|
154
|
+
values: Array<{
|
|
155
|
+
value: string;
|
|
156
|
+
displayValue: string;
|
|
157
|
+
}>;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Represents the data returned by a call to the Data API `layouts` endpoint.
|
|
161
|
+
*/
|
|
162
|
+
export type AllLayoutsMetadataResponse = {
|
|
163
|
+
/**
|
|
164
|
+
* A list of `Layout` or `LayoutsFolder` objects.
|
|
165
|
+
*/
|
|
166
|
+
layouts: LayoutOrFolder[];
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Represents a FileMaker layout.
|
|
170
|
+
*/
|
|
171
|
+
export type Layout = {
|
|
172
|
+
/**
|
|
173
|
+
* The name of the layout
|
|
174
|
+
*/
|
|
175
|
+
name: string;
|
|
176
|
+
/**
|
|
177
|
+
* If the node is a layout, `table` may contain the name of the table
|
|
178
|
+
* the layout is associated with.
|
|
179
|
+
*/
|
|
180
|
+
table: string;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Represents a folder of `Layout` or `LayoutsFolder` objects.
|
|
184
|
+
*/
|
|
185
|
+
export type LayoutsFolder = {
|
|
186
|
+
/**
|
|
187
|
+
* The name of the folder
|
|
188
|
+
*/
|
|
189
|
+
name: string;
|
|
190
|
+
isFolder: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* A list of the Layout or LayoutsFolder objects in the folder.
|
|
193
|
+
*/
|
|
194
|
+
folderLayoutNames?: LayoutOrFolder[];
|
|
195
|
+
};
|
|
196
|
+
export type LayoutOrFolder = Layout | LayoutsFolder;
|
|
197
|
+
/**
|
|
198
|
+
* Represents the data returned by a call to the Data API `scripts` endpoint.
|
|
199
|
+
*/
|
|
200
|
+
export type ScriptsMetadataResponse = {
|
|
201
|
+
/**
|
|
202
|
+
* A list of `Layout` or `LayoutsFolder` objects.
|
|
203
|
+
*/
|
|
204
|
+
scripts: ScriptOrFolder[];
|
|
205
|
+
};
|
|
206
|
+
type Script = {
|
|
207
|
+
name: string;
|
|
208
|
+
isFolder: false;
|
|
209
|
+
};
|
|
210
|
+
type ScriptFolder = {
|
|
211
|
+
name: string;
|
|
212
|
+
isFolder: true;
|
|
213
|
+
folderScriptNames: ScriptOrFolder[];
|
|
214
|
+
};
|
|
215
|
+
export type ScriptOrFolder = Script | ScriptFolder;
|
|
216
|
+
export type RawFMResponse<T = unknown> = {
|
|
217
|
+
response?: T;
|
|
218
|
+
messages?: [{
|
|
219
|
+
code: string;
|
|
220
|
+
}];
|
|
221
|
+
};
|
|
222
|
+
export declare class FileMakerError extends Error {
|
|
223
|
+
readonly code: string;
|
|
224
|
+
constructor(code: string, message: string);
|
|
225
|
+
}
|
|
226
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const ZFieldValue = z.union([
|
|
6
|
+
z.string(),
|
|
7
|
+
z.number(),
|
|
8
|
+
z.null(),
|
|
9
|
+
z.unknown()
|
|
10
|
+
]);
|
|
11
|
+
const ZFieldData = z.record(z.string(), ZFieldValue);
|
|
12
|
+
z.object({
|
|
13
|
+
scriptResult: z.string().optional(),
|
|
14
|
+
scriptError: z.string().optional(),
|
|
15
|
+
"scriptResult.prerequest": z.string().optional(),
|
|
16
|
+
"scriptError.prerequest": z.string().optional(),
|
|
17
|
+
"scriptResult.presort": z.string().optional(),
|
|
18
|
+
"scriptError.presort": z.string().optional()
|
|
19
|
+
});
|
|
20
|
+
const ZDataInfo = z.object({
|
|
21
|
+
database: z.string(),
|
|
22
|
+
layout: z.string(),
|
|
23
|
+
table: z.string(),
|
|
24
|
+
totalRecordCount: z.number(),
|
|
25
|
+
foundCount: z.number(),
|
|
26
|
+
returnedCount: z.number()
|
|
27
|
+
});
|
|
28
|
+
class FileMakerError extends Error {
|
|
29
|
+
constructor(code, message) {
|
|
30
|
+
super(message);
|
|
31
|
+
__publicField(this, "code");
|
|
32
|
+
this.code = code;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
FileMakerError,
|
|
37
|
+
ZDataInfo,
|
|
38
|
+
ZFieldData,
|
|
39
|
+
ZFieldValue
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=client-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-types.js","sources":["../../src/client-types.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ZFieldValue = z.union([\n z.string(),\n z.number(),\n z.null(),\n z.unknown(),\n]);\nexport type FieldValue = z.infer<typeof ZFieldValue>;\n\nexport const ZFieldData = z.record(z.string(), ZFieldValue);\nexport type FieldData = Record<string, unknown>;\n\nexport type GenericPortalData = {\n [key: string]: {\n [x: string]: string | number | null | unknown;\n };\n};\n\nexport type PortalsWithIds<U extends GenericPortalData = GenericPortalData> = {\n [key in keyof U]: Array<\n U[key] & {\n recordId: string;\n modId: string;\n }\n >;\n};\nexport type UpdatePortalsWithIds<\n U extends GenericPortalData = GenericPortalData,\n> = {\n [key in keyof U]: Array<\n U[key] & {\n recordId: string;\n modId?: string;\n }\n >;\n};\n\nexport type FMRecord<\n T extends FieldData = FieldData,\n U extends GenericPortalData = GenericPortalData,\n> = {\n fieldData: T;\n recordId: string;\n modId: string;\n portalData: PortalsWithIds<U>;\n};\n\nexport type ScriptParams = {\n script?: string;\n \"script.param\"?: string;\n \"script.prerequest\"?: string;\n \"script.prerequest.param\"?: string;\n \"script.presort\"?: string;\n \"script.presort.param\"?: string;\n timeout?: number;\n};\n\nconst ZScriptResponse = z.object({\n scriptResult: z.string().optional(),\n scriptError: z.string().optional(),\n \"scriptResult.prerequest\": z.string().optional(),\n \"scriptError.prerequest\": z.string().optional(),\n \"scriptResult.presort\": z.string().optional(),\n \"scriptError.presort\": z.string().optional(),\n});\nexport type ScriptResponse = z.infer<typeof ZScriptResponse>;\n\nexport const ZDataInfo = z.object({\n database: z.string(),\n layout: z.string(),\n table: z.string(),\n totalRecordCount: z.number(),\n foundCount: z.number(),\n returnedCount: z.number(),\n});\nexport type DataInfo = z.infer<typeof ZDataInfo>;\n\nexport type CreateParams<U extends GenericPortalData = GenericPortalData> =\n ScriptParams & { portalData?: UpdatePortalsWithIds<U> };\n\nexport type CreateResponse = ScriptResponse & {\n recordId: string;\n modId: string;\n};\n\nexport type UpdateParams<U extends GenericPortalData = GenericPortalData> =\n CreateParams<U> & {\n modId?: number;\n };\n\nexport type UpdateResponse = ScriptResponse & {\n modId: string;\n};\n\nexport type DeleteParams = ScriptParams;\n\nexport type DeleteResponse = ScriptResponse;\n\nexport type RangeParams = {\n offset?: number;\n limit?: number;\n};\nexport type RangeParamsRaw = {\n _offset?: number;\n _limit?: number;\n};\n\nexport type PortalRanges<U extends GenericPortalData = GenericPortalData> =\n Partial<{ [key in keyof U]: RangeParams }>;\n\nexport type PortalRangesParams<\n U extends GenericPortalData = GenericPortalData,\n> = {\n portalRanges?: PortalRanges<U>;\n};\n\nexport type GetParams<U extends GenericPortalData = GenericPortalData> =\n ScriptParams &\n PortalRangesParams<U> & {\n \"layout.response\"?: string;\n dateformats?: \"US\" | \"file_locale\" | \"ISO8601\";\n };\n\nexport type Sort<T extends FieldData = FieldData> = {\n fieldName: keyof T;\n sortOrder?: \"ascend\" | \"descend\" | (string & {});\n};\n\nexport type ListParams<\n T extends FieldData = FieldData,\n U extends GenericPortalData = GenericPortalData,\n> = GetParams<U> &\n RangeParams & {\n sort?: Sort<T> | Array<Sort<T>>;\n };\n\nexport type ListParamsRaw<\n T extends FieldData = FieldData,\n U extends GenericPortalData = GenericPortalData,\n> = GetParams<U> &\n RangeParamsRaw & {\n _sort?: Array<Sort<T>>;\n };\n\nexport type GetResponse<\n T extends FieldData = FieldData,\n U extends GenericPortalData = GenericPortalData,\n> = ScriptResponse & {\n data: Array<FMRecord<T, U>>;\n dataInfo: DataInfo;\n};\nexport type GetResponseOne<\n T extends FieldData = FieldData,\n U extends GenericPortalData = GenericPortalData,\n> = ScriptResponse & {\n data: FMRecord<T, U>;\n dataInfo: DataInfo;\n};\n\ntype SecondLevelKeys<T> = {\n [K in keyof T]: keyof T[K];\n}[keyof T];\nexport type Query<\n T extends FieldData = FieldData,\n U extends GenericPortalData = GenericPortalData,\n> = Partial<{\n [key in keyof T]: T[key] extends number ? number | string : string;\n}> &\n Partial<{ [key in SecondLevelKeys<U>]?: string }> & {\n omit?: \"true\";\n };\n\nexport type LayoutMetadataResponse = {\n fieldMetaData: FieldMetaData[];\n portalMetaData: { [key: string]: FieldMetaData[] };\n valueLists?: ValueList[];\n};\nexport type ProductInfoMetadataResponse = {\n name: string;\n dateFormat: string;\n timeFormat: string;\n timeStampFormat: string;\n};\nexport type DatabaseMetadataResponse = {\n databases: Array<{\n name: string;\n }>;\n};\n\nexport type FieldMetaData = {\n name: string;\n type: \"normal\" | \"calculation\" | \"summary\";\n displayType:\n | \"editText\"\n | \"popupList\"\n | \"popupMenu\"\n | \"checkBox\"\n | \"calendar\"\n | \"radioButtons\"\n | \"secureText\";\n result: \"text\" | \"number\" | \"date\" | \"time\" | \"timeStamp\" | \"container\";\n global: boolean;\n autoEnter: boolean;\n fourDigitYear: boolean;\n maxRepeat: number;\n maxCharacters: number;\n notEmpty: boolean;\n numeric: boolean;\n repetitions: number;\n timeOfDay: boolean;\n valueList?: string;\n};\n\ntype ValueList = {\n name: string;\n // TODO need to test type of value list from other file\n type: \"customList\" | \"byField\";\n values: Array<{ value: string; displayValue: string }>;\n};\n\n/**\n * Represents the data returned by a call to the Data API `layouts` endpoint.\n */\nexport type AllLayoutsMetadataResponse = {\n /**\n * A list of `Layout` or `LayoutsFolder` objects.\n */\n layouts: LayoutOrFolder[];\n};\n\n/**\n * Represents a FileMaker layout.\n */\nexport type Layout = {\n /**\n * The name of the layout\n */\n name: string;\n /**\n * If the node is a layout, `table` may contain the name of the table\n * the layout is associated with.\n */\n table: string;\n};\n\n/**\n * Represents a folder of `Layout` or `LayoutsFolder` objects.\n */\nexport type LayoutsFolder = {\n /**\n * The name of the folder\n */\n name: string;\n isFolder: boolean;\n /**\n * A list of the Layout or LayoutsFolder objects in the folder.\n */\n folderLayoutNames?: LayoutOrFolder[];\n};\n\nexport type LayoutOrFolder = Layout | LayoutsFolder;\n\n/**\n * Represents the data returned by a call to the Data API `scripts` endpoint.\n */\nexport type ScriptsMetadataResponse = {\n /**\n * A list of `Layout` or `LayoutsFolder` objects.\n */\n scripts: ScriptOrFolder[];\n};\ntype Script = {\n name: string;\n isFolder: false;\n};\ntype ScriptFolder = {\n name: string;\n isFolder: true;\n folderScriptNames: ScriptOrFolder[];\n};\nexport type ScriptOrFolder = Script | ScriptFolder;\n\nexport type RawFMResponse<T = unknown> = {\n response?: T;\n messages?: [{ code: string }];\n};\n\nexport class FileMakerError extends Error {\n public readonly code: string;\n\n public constructor(code: string, message: string) {\n super(message);\n this.code = code;\n }\n}\n"],"names":[],"mappings":";;;;AAEa,MAAA,cAAc,EAAE,MAAM;AAAA,EACjC,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,EACT,EAAE,KAAK;AAAA,EACP,EAAE,QAAQ;AACZ,CAAC;AAGM,MAAM,aAAa,EAAE,OAAO,EAAE,UAAU,WAAW;AAgDlC,EAAE,OAAO;AAAA,EAC/B,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA,EAClC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,2BAA2B,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/C,0BAA0B,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9C,wBAAwB,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5C,uBAAuB,EAAE,OAAO,EAAE,SAAS;AAC7C,CAAC;AAGY,MAAA,YAAY,EAAE,OAAO;AAAA,EAChC,UAAU,EAAE,OAAO;AAAA,EACnB,QAAQ,EAAE,OAAO;AAAA,EACjB,OAAO,EAAE,OAAO;AAAA,EAChB,kBAAkB,EAAE,OAAO;AAAA,EAC3B,YAAY,EAAE,OAAO;AAAA,EACrB,eAAe,EAAE,OAAO;AAC1B,CAAC;AAqNM,MAAM,uBAAuB,MAAM;AAAA,EAGjC,YAAY,MAAc,SAAiB;AAChD,UAAM,OAAO;AAHC;AAId,SAAK,OAAO;AAAA,EAAA;AAEhB;"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Adapter } from './adapters/core.js';
|
|
2
|
+
import { CreateResponse, DeleteResponse, FMRecord, FieldData, GenericPortalData, GetResponse, GetResponseOne, ListParams, Query, UpdateResponse } from './client-types.js';
|
|
3
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
+
export type ClientObjectProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The layout to use by default for all requests. Can be overrridden on each request.
|
|
7
|
+
*/
|
|
8
|
+
layout: string;
|
|
9
|
+
schema?: {
|
|
10
|
+
/**
|
|
11
|
+
* The schema for the field data.
|
|
12
|
+
*/
|
|
13
|
+
fieldData: StandardSchemaV1<FieldData>;
|
|
14
|
+
/**
|
|
15
|
+
* The schema for the portal data.
|
|
16
|
+
*/
|
|
17
|
+
portalData?: StandardSchemaV1<GenericPortalData>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type FetchOptions = {
|
|
21
|
+
fetch?: RequestInit;
|
|
22
|
+
};
|
|
23
|
+
declare function DataApi<Fd extends FieldData = FieldData, Pd extends GenericPortalData = GenericPortalData, Opts extends ClientObjectProps = ClientObjectProps, Adp extends Adapter = Adapter>(options: Opts & {
|
|
24
|
+
adapter: Adp;
|
|
25
|
+
}): Omit<Adp, "create" | "delete" | "find" | "get" | "list" | "update" | "layoutMetadata" | "containerUpload"> & {
|
|
26
|
+
layout: Opts["layout"];
|
|
27
|
+
list: {
|
|
28
|
+
(): Promise<GetResponse<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>>;
|
|
29
|
+
(args: ListParams<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & FetchOptions): Promise<GetResponse<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>>;
|
|
30
|
+
};
|
|
31
|
+
listAll: {
|
|
32
|
+
<T extends FieldData = Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, U extends Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd = Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>(): Promise<FMRecord<T, U>[]>;
|
|
33
|
+
<T extends FieldData = Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, U extends Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd = Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>(args: ListParams<T, U> & FetchOptions): Promise<FMRecord<T, U>[]>;
|
|
34
|
+
};
|
|
35
|
+
create: <T extends Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd = Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, U extends Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd = Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>(args: (import('./client-types.js').ScriptParams & {
|
|
36
|
+
portalData?: import('./client-types.js').UpdatePortalsWithIds<U> | undefined;
|
|
37
|
+
} & {
|
|
38
|
+
fieldData: Partial<T>;
|
|
39
|
+
}) & FetchOptions) => Promise<CreateResponse>;
|
|
40
|
+
get: (args: (import('./client-types.js').ScriptParams & import('./client-types.js').PortalRangesParams<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & {
|
|
41
|
+
"layout.response"?: string;
|
|
42
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
43
|
+
} & {
|
|
44
|
+
recordId: number | string;
|
|
45
|
+
}) & FetchOptions) => Promise<GetResponse<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>>;
|
|
46
|
+
update: (args: (import('./client-types.js').ScriptParams & {
|
|
47
|
+
portalData?: import('./client-types.js').UpdatePortalsWithIds<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> | undefined;
|
|
48
|
+
} & {
|
|
49
|
+
modId?: number;
|
|
50
|
+
} & {
|
|
51
|
+
fieldData: Partial<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>;
|
|
52
|
+
recordId: number | string;
|
|
53
|
+
}) & FetchOptions) => Promise<UpdateResponse>;
|
|
54
|
+
delete: (args: (import('./client-types.js').ScriptParams & {
|
|
55
|
+
recordId: number | string;
|
|
56
|
+
}) & FetchOptions) => Promise<DeleteResponse>;
|
|
57
|
+
find: (args: (import('./client-types.js').ScriptParams & import('./client-types.js').PortalRangesParams<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & {
|
|
58
|
+
"layout.response"?: string;
|
|
59
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
60
|
+
} & import('./client-types.js').RangeParams & {
|
|
61
|
+
sort?: import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[] | undefined;
|
|
62
|
+
} & {
|
|
63
|
+
query: Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[];
|
|
64
|
+
timeout?: number;
|
|
65
|
+
}) & {
|
|
66
|
+
/**
|
|
67
|
+
* If true, a find that returns no results will retun an empty array instead of throwing an error.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
ignoreEmptyResult?: boolean;
|
|
71
|
+
} & FetchOptions) => Promise<GetResponse<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>>;
|
|
72
|
+
findOne: (args: (import('./client-types.js').ScriptParams & import('./client-types.js').PortalRangesParams<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & {
|
|
73
|
+
"layout.response"?: string;
|
|
74
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
75
|
+
} & import('./client-types.js').RangeParams & {
|
|
76
|
+
sort?: import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[] | undefined;
|
|
77
|
+
} & {
|
|
78
|
+
query: Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[];
|
|
79
|
+
timeout?: number;
|
|
80
|
+
}) & FetchOptions) => Promise<GetResponseOne<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>>;
|
|
81
|
+
findFirst: (args: (import('./client-types.js').ScriptParams & import('./client-types.js').PortalRangesParams<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & {
|
|
82
|
+
"layout.response"?: string;
|
|
83
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
84
|
+
} & import('./client-types.js').RangeParams & {
|
|
85
|
+
sort?: import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[] | undefined;
|
|
86
|
+
} & {
|
|
87
|
+
query: Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[];
|
|
88
|
+
timeout?: number;
|
|
89
|
+
}) & {
|
|
90
|
+
/**
|
|
91
|
+
* If true, a find that returns no results will retun an empty array instead of throwing an error.
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
ignoreEmptyResult?: boolean;
|
|
95
|
+
} & FetchOptions) => Promise<GetResponseOne<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>>;
|
|
96
|
+
maybeFindFirst: (args: (import('./client-types.js').ScriptParams & import('./client-types.js').PortalRangesParams<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & {
|
|
97
|
+
"layout.response"?: string;
|
|
98
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
99
|
+
} & import('./client-types.js').RangeParams & {
|
|
100
|
+
sort?: import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[] | undefined;
|
|
101
|
+
} & {
|
|
102
|
+
query: Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[];
|
|
103
|
+
timeout?: number;
|
|
104
|
+
}) & {
|
|
105
|
+
/**
|
|
106
|
+
* If true, a find that returns no results will retun an empty array instead of throwing an error.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
ignoreEmptyResult?: boolean;
|
|
110
|
+
} & FetchOptions) => Promise<GetResponseOne<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> | null>;
|
|
111
|
+
findAll: (args: (import('./client-types.js').ScriptParams & import('./client-types.js').PortalRangesParams<Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd> & {
|
|
112
|
+
"layout.response"?: string;
|
|
113
|
+
dateformats?: "US" | "file_locale" | "ISO8601";
|
|
114
|
+
} & import('./client-types.js').RangeParams & {
|
|
115
|
+
sort?: import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | import('./client-types.js').Sort<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[] | undefined;
|
|
116
|
+
} & {
|
|
117
|
+
query: Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd> | Query<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>[];
|
|
118
|
+
timeout?: number;
|
|
119
|
+
}) & FetchOptions) => Promise<FMRecord<Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd, Opts["schema"] extends object ? Opts["schema"]["portalData"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["portalData"]> : Pd : Pd>[]>;
|
|
120
|
+
layoutMetadata: (args?: {
|
|
121
|
+
timeout?: number;
|
|
122
|
+
} & FetchOptions) => Promise<import('./client-types.js').LayoutMetadataResponse>;
|
|
123
|
+
containerUpload: <T extends Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd = Opts["schema"] extends object ? StandardSchemaV1.InferOutput<Opts["schema"]["fieldData"]> : Fd>(args: {
|
|
124
|
+
containerFieldName: keyof T;
|
|
125
|
+
containerFieldRepetition?: string | number;
|
|
126
|
+
file: Blob;
|
|
127
|
+
recordId: number | string;
|
|
128
|
+
modId?: number;
|
|
129
|
+
timeout?: number;
|
|
130
|
+
} & FetchOptions) => Promise<void>;
|
|
131
|
+
};
|
|
132
|
+
export default DataApi;
|
|
133
|
+
export { DataApi };
|