@nordcraft/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/api/LegacyToddleApi.d.ts +34 -0
- package/dist/api/LegacyToddleApi.js +178 -0
- package/dist/api/LegacyToddleApi.js.map +1 -0
- package/dist/api/ToddleApiV2.d.ts +77 -0
- package/dist/api/ToddleApiV2.js +271 -0
- package/dist/api/ToddleApiV2.js.map +1 -0
- package/dist/api/api.d.ts +49 -0
- package/dist/api/api.js +276 -0
- package/dist/api/api.js.map +1 -0
- package/dist/api/apiTypes.d.ts +125 -0
- package/dist/api/apiTypes.js +11 -0
- package/dist/api/apiTypes.js.map +1 -0
- package/dist/api/headers.d.ts +10 -0
- package/dist/api/headers.js +36 -0
- package/dist/api/headers.js.map +1 -0
- package/dist/api/template.d.ts +5 -0
- package/dist/api/template.js +7 -0
- package/dist/api/template.js.map +1 -0
- package/dist/component/ToddleComponent.d.ts +45 -0
- package/dist/component/ToddleComponent.js +373 -0
- package/dist/component/ToddleComponent.js.map +1 -0
- package/dist/component/actionUtils.d.ts +2 -0
- package/dist/component/actionUtils.js +56 -0
- package/dist/component/actionUtils.js.map +1 -0
- package/dist/component/component.types.d.ts +313 -0
- package/dist/component/component.types.js +9 -0
- package/dist/component/component.types.js.map +1 -0
- package/dist/component/isPageComponent.d.ts +2 -0
- package/dist/component/isPageComponent.js +3 -0
- package/dist/component/isPageComponent.js.map +1 -0
- package/dist/formula/ToddleFormula.d.ts +15 -0
- package/dist/formula/ToddleFormula.js +20 -0
- package/dist/formula/ToddleFormula.js.map +1 -0
- package/dist/formula/formula.d.ts +103 -0
- package/dist/formula/formula.js +186 -0
- package/dist/formula/formula.js.map +1 -0
- package/dist/formula/formulaTypes.d.ts +30 -0
- package/dist/formula/formulaTypes.js +2 -0
- package/dist/formula/formulaTypes.js.map +1 -0
- package/dist/formula/formulaUtils.d.ts +18 -0
- package/dist/formula/formulaUtils.js +240 -0
- package/dist/formula/formulaUtils.js.map +1 -0
- package/dist/styling/className.d.ts +2 -0
- package/dist/styling/className.js +52 -0
- package/dist/styling/className.js.map +1 -0
- package/dist/styling/style.css.d.ts +5 -0
- package/dist/styling/style.css.js +242 -0
- package/dist/styling/style.css.js.map +1 -0
- package/dist/styling/theme.const.d.ts +3 -0
- package/dist/styling/theme.const.js +381 -0
- package/dist/styling/theme.const.js.map +1 -0
- package/dist/styling/theme.d.ts +72 -0
- package/dist/styling/theme.js +200 -0
- package/dist/styling/theme.js.map +1 -0
- package/dist/styling/variantSelector.d.ts +123 -0
- package/dist/styling/variantSelector.js +25 -0
- package/dist/styling/variantSelector.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/collections.d.ts +21 -0
- package/dist/utils/collections.js +75 -0
- package/dist/utils/collections.js.map +1 -0
- package/dist/utils/customElements.d.ts +6 -0
- package/dist/utils/customElements.js +15 -0
- package/dist/utils/customElements.js.map +1 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +17 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/json.d.ts +5 -0
- package/dist/utils/json.js +16 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/sha1.d.ts +2 -0
- package/dist/utils/sha1.js +13 -0
- package/dist/utils/sha1.js.map +1 -0
- package/dist/utils/url.d.ts +5 -0
- package/dist/utils/url.js +27 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/util.d.ts +3 -0
- package/dist/utils/util.js +4 -0
- package/dist/utils/util.js.map +1 -0
- package/package.json +18 -0
- package/src/api/LegacyToddleApi.ts +205 -0
- package/src/api/ToddleApiV2.ts +331 -0
- package/src/api/api.test.ts +319 -0
- package/src/api/api.ts +414 -0
- package/src/api/apiTypes.ts +145 -0
- package/src/api/headers.ts +41 -0
- package/src/api/template.ts +10 -0
- package/src/component/ToddleComponent.actionReferences.test.ts +75 -0
- package/src/component/ToddleComponent.formulasInComponent.test.ts +234 -0
- package/src/component/ToddleComponent.ts +470 -0
- package/src/component/actionUtils.ts +61 -0
- package/src/component/component.types.ts +362 -0
- package/src/component/isPageComponent.ts +6 -0
- package/src/formula/ToddleFormula.ts +30 -0
- package/src/formula/formula.ts +355 -0
- package/src/formula/formulaTypes.ts +45 -0
- package/src/formula/formulaUtils.ts +287 -0
- package/src/styling/className.test.ts +19 -0
- package/src/styling/className.ts +73 -0
- package/src/styling/style.css.ts +309 -0
- package/src/styling/theme.const.ts +390 -0
- package/src/styling/theme.ts +339 -0
- package/src/styling/variantSelector.ts +168 -0
- package/src/types.ts +158 -0
- package/src/utils/collections.test.ts +57 -0
- package/src/utils/collections.ts +122 -0
- package/src/utils/customElements.test.ts +40 -0
- package/src/utils/customElements.ts +16 -0
- package/src/utils/hash.test.ts +32 -0
- package/src/utils/hash.ts +18 -0
- package/src/utils/json.ts +18 -0
- package/src/utils/sha1.test.ts +50 -0
- package/src/utils/sha1.ts +17 -0
- package/src/utils/url.test.ts +17 -0
- package/src/utils/url.ts +33 -0
- package/src/utils/util.ts +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Formula } from '../formula/formula';
|
|
2
|
+
import type { GlobalFormulas } from '../formula/formulaTypes';
|
|
3
|
+
import { type LegacyComponentAPI } from './apiTypes';
|
|
4
|
+
export declare class LegacyToddleApi<Handler> {
|
|
5
|
+
private api;
|
|
6
|
+
private key;
|
|
7
|
+
private globalFormulas;
|
|
8
|
+
private _apiReferences?;
|
|
9
|
+
constructor(api: LegacyComponentAPI, key: string, globalFormulas: GlobalFormulas<Handler>);
|
|
10
|
+
get apiReferences(): Set<string>;
|
|
11
|
+
get name(): string;
|
|
12
|
+
get type(): "REST";
|
|
13
|
+
get autoFetch(): Formula | null | undefined;
|
|
14
|
+
get url(): Formula | undefined;
|
|
15
|
+
get path(): {
|
|
16
|
+
formula: Formula;
|
|
17
|
+
}[] | undefined;
|
|
18
|
+
get proxy(): boolean | undefined;
|
|
19
|
+
get queryParams(): Record<string, {
|
|
20
|
+
name: string;
|
|
21
|
+
formula: Formula;
|
|
22
|
+
}> | undefined;
|
|
23
|
+
get headers(): Formula | Record<string, Formula> | undefined;
|
|
24
|
+
get method(): "GET" | "POST" | "DELETE" | "PUT" | undefined;
|
|
25
|
+
get body(): Formula | undefined;
|
|
26
|
+
get auth(): {
|
|
27
|
+
type: "Bearer id_token" | "Bearer access_token";
|
|
28
|
+
} | undefined;
|
|
29
|
+
get throttle(): number | null | undefined;
|
|
30
|
+
get debounce(): number | null | undefined;
|
|
31
|
+
get onCompleted(): import("../component/component.types").EventModel | null;
|
|
32
|
+
get onFailed(): import("../component/component.types").EventModel | null;
|
|
33
|
+
formulasInApi(): Generator<[(string | number)[], Formula]>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { isFormula } from '../formula/formula';
|
|
2
|
+
import { getFormulasInAction, getFormulasInFormula, } from '../formula/formulaUtils';
|
|
3
|
+
import { isDefined } from '../utils/util';
|
|
4
|
+
export class LegacyToddleApi {
|
|
5
|
+
api;
|
|
6
|
+
key;
|
|
7
|
+
globalFormulas;
|
|
8
|
+
_apiReferences;
|
|
9
|
+
constructor(api, key, globalFormulas) {
|
|
10
|
+
this.api = api;
|
|
11
|
+
this.key = key;
|
|
12
|
+
this.globalFormulas = globalFormulas;
|
|
13
|
+
}
|
|
14
|
+
get apiReferences() {
|
|
15
|
+
if (this._apiReferences) {
|
|
16
|
+
// Only compute apiReferences once
|
|
17
|
+
return this._apiReferences;
|
|
18
|
+
}
|
|
19
|
+
const apis = new Set();
|
|
20
|
+
const visitFormulaReference = (formula) => {
|
|
21
|
+
if (!isDefined(formula)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
switch (formula.type) {
|
|
25
|
+
case 'path':
|
|
26
|
+
if (formula.path[0] === 'Apis') {
|
|
27
|
+
apis.add(formula.path[1]);
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
case 'value':
|
|
31
|
+
break;
|
|
32
|
+
case 'record':
|
|
33
|
+
formula.entries.forEach((entry) => visitFormulaReference(entry.formula));
|
|
34
|
+
break;
|
|
35
|
+
case 'function':
|
|
36
|
+
case 'array':
|
|
37
|
+
case 'or':
|
|
38
|
+
case 'and':
|
|
39
|
+
case 'apply':
|
|
40
|
+
case 'object':
|
|
41
|
+
formula.arguments?.forEach((arg) => visitFormulaReference(arg.formula));
|
|
42
|
+
break;
|
|
43
|
+
case 'switch':
|
|
44
|
+
formula.cases.forEach((c) => {
|
|
45
|
+
visitFormulaReference(c.condition);
|
|
46
|
+
visitFormulaReference(c.formula);
|
|
47
|
+
});
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
visitFormulaReference(this.api.autoFetch);
|
|
52
|
+
visitFormulaReference(this.api.url);
|
|
53
|
+
Object.values(this.api.path ?? {}).forEach((p) => visitFormulaReference(p.formula));
|
|
54
|
+
Object.values(this.api.queryParams ?? {}).forEach((q) => visitFormulaReference(q.formula));
|
|
55
|
+
// this is supporting a few legacy cases where the whole header object was set as a formula. This is no longer possible
|
|
56
|
+
if (isFormula(this.api.headers)) {
|
|
57
|
+
visitFormulaReference(this.api.headers);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
Object.values(this.api.headers ?? {}).forEach((h) => {
|
|
61
|
+
visitFormulaReference(h);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
visitFormulaReference(this.api.body);
|
|
65
|
+
this._apiReferences = apis;
|
|
66
|
+
return apis;
|
|
67
|
+
}
|
|
68
|
+
get name() {
|
|
69
|
+
return this.api.name;
|
|
70
|
+
}
|
|
71
|
+
get type() {
|
|
72
|
+
return this.api.type;
|
|
73
|
+
}
|
|
74
|
+
get autoFetch() {
|
|
75
|
+
return this.api.autoFetch;
|
|
76
|
+
}
|
|
77
|
+
get url() {
|
|
78
|
+
return this.api.url;
|
|
79
|
+
}
|
|
80
|
+
get path() {
|
|
81
|
+
return this.api.path;
|
|
82
|
+
}
|
|
83
|
+
get proxy() {
|
|
84
|
+
return this.api.proxy;
|
|
85
|
+
}
|
|
86
|
+
get queryParams() {
|
|
87
|
+
return this.api.queryParams;
|
|
88
|
+
}
|
|
89
|
+
get headers() {
|
|
90
|
+
return this.api.headers;
|
|
91
|
+
}
|
|
92
|
+
get method() {
|
|
93
|
+
return this.api.method;
|
|
94
|
+
}
|
|
95
|
+
get body() {
|
|
96
|
+
return this.api.body;
|
|
97
|
+
}
|
|
98
|
+
get auth() {
|
|
99
|
+
return this.api.auth;
|
|
100
|
+
}
|
|
101
|
+
get throttle() {
|
|
102
|
+
return this.api.throttle;
|
|
103
|
+
}
|
|
104
|
+
get debounce() {
|
|
105
|
+
return this.api.debounce;
|
|
106
|
+
}
|
|
107
|
+
get onCompleted() {
|
|
108
|
+
return this.api.onCompleted;
|
|
109
|
+
}
|
|
110
|
+
get onFailed() {
|
|
111
|
+
return this.api.onFailed;
|
|
112
|
+
}
|
|
113
|
+
*formulasInApi() {
|
|
114
|
+
const api = this.api;
|
|
115
|
+
const apiKey = this.key;
|
|
116
|
+
yield* getFormulasInFormula({
|
|
117
|
+
formula: api.autoFetch,
|
|
118
|
+
globalFormulas: this.globalFormulas,
|
|
119
|
+
path: ['apis', apiKey, 'autoFetch'],
|
|
120
|
+
});
|
|
121
|
+
yield* getFormulasInFormula({
|
|
122
|
+
formula: api.url,
|
|
123
|
+
globalFormulas: this.globalFormulas,
|
|
124
|
+
path: ['apis', apiKey, 'url'],
|
|
125
|
+
});
|
|
126
|
+
for (const [pathKey, path] of Object.entries(api.path ?? {})) {
|
|
127
|
+
yield* getFormulasInFormula({
|
|
128
|
+
formula: path.formula,
|
|
129
|
+
globalFormulas: this.globalFormulas,
|
|
130
|
+
path: ['apis', apiKey, 'path', pathKey, 'formula'],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
for (const [queryParamKey, queryParam] of Object.entries(api.queryParams ?? {})) {
|
|
134
|
+
yield* getFormulasInFormula({
|
|
135
|
+
formula: queryParam.formula,
|
|
136
|
+
globalFormulas: this.globalFormulas,
|
|
137
|
+
path: ['apis', apiKey, 'queryParams', queryParamKey, 'formula'],
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// this is supporting a few legacy cases where the whole header object was set as a formula. This is no longer possible
|
|
141
|
+
if (isFormula(api.headers)) {
|
|
142
|
+
yield* getFormulasInFormula({
|
|
143
|
+
formula: api.headers,
|
|
144
|
+
globalFormulas: this.globalFormulas,
|
|
145
|
+
path: ['apis', apiKey, 'headers'],
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
for (const [headerKey, header] of Object.entries(api.headers ?? {})) {
|
|
150
|
+
yield* getFormulasInFormula({
|
|
151
|
+
formula: header,
|
|
152
|
+
globalFormulas: this.globalFormulas,
|
|
153
|
+
path: ['apis', apiKey, 'headers', headerKey],
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
yield* getFormulasInFormula({
|
|
158
|
+
formula: api.body,
|
|
159
|
+
globalFormulas: this.globalFormulas,
|
|
160
|
+
path: ['apis', apiKey, 'body'],
|
|
161
|
+
});
|
|
162
|
+
for (const [actionKey, action] of Object.entries(api.onCompleted?.actions ?? {})) {
|
|
163
|
+
yield* getFormulasInAction({
|
|
164
|
+
action,
|
|
165
|
+
globalFormulas: this.globalFormulas,
|
|
166
|
+
path: ['apis', apiKey, 'onCompleted', 'actions', actionKey],
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
for (const [actionKey, action] of Object.entries(api.onFailed?.actions ?? {})) {
|
|
170
|
+
yield* getFormulasInAction({
|
|
171
|
+
action,
|
|
172
|
+
globalFormulas: this.globalFormulas,
|
|
173
|
+
path: ['apis', apiKey, 'onFailed', 'actions', actionKey],
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=LegacyToddleApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegacyToddleApi.js","sourceRoot":"","sources":["../../src/api/LegacyToddleApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,oBAAoB,CAAA;AAE5D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,MAAM,OAAO,eAAe;IAClB,GAAG,CAAoB;IACvB,GAAG,CAAQ;IACX,cAAc,CAAyB;IACvC,cAAc,CAAc;IAEpC,YACE,GAAuB,EACvB,GAAW,EACX,cAAuC;QAEvC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;IACtC,CAAC;IAED,IAAI,aAAa;QACf,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,kCAAkC;YAClC,OAAO,IAAI,CAAC,cAAc,CAAA;QAC5B,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;QAC9B,MAAM,qBAAqB,GAAG,CAAC,OAAwB,EAAE,EAAE;YACzD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;gBACxB,OAAM;YACR,CAAC;YACD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACrB,KAAK,MAAM;oBACT,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;wBAC/B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;oBAC3B,CAAC;oBACD,MAAK;gBACP,KAAK,OAAO;oBACV,MAAK;gBACP,KAAK,QAAQ;oBACX,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,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,KAAK,CAAC,CAAC,mBAAmB,CAAC;gBACzB,MAAM;gBACN,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,CAAC;aAC5D,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAC9C,GAAG,CAAC,QAAQ,EAAE,OAAO,IAAI,EAAE,CAC5B,EAAE,CAAC;YACF,KAAK,CAAC,CAAC,mBAAmB,CAAC;gBACzB,MAAM;gBACN,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC;aACzD,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ActionModel } from '../component/component.types';
|
|
2
|
+
import { type Formula } from '../formula/formula';
|
|
3
|
+
import type { GlobalFormulas } from '../formula/formulaTypes';
|
|
4
|
+
import type { ApiRequest } from './apiTypes';
|
|
5
|
+
export declare class ToddleApiV2<Handler> implements ApiRequest {
|
|
6
|
+
private api;
|
|
7
|
+
private _apiReferences?;
|
|
8
|
+
private key;
|
|
9
|
+
private globalFormulas;
|
|
10
|
+
constructor(api: ApiRequest, apiKey: string, globalFormulas: GlobalFormulas<Handler>);
|
|
11
|
+
get apiReferences(): Set<string>;
|
|
12
|
+
get version(): 2;
|
|
13
|
+
get name(): string;
|
|
14
|
+
get type(): "http" | "ws";
|
|
15
|
+
get autoFetch(): Formula | null | undefined;
|
|
16
|
+
get url(): Formula | undefined;
|
|
17
|
+
get path(): Record<string, {
|
|
18
|
+
formula: Formula;
|
|
19
|
+
index: number;
|
|
20
|
+
}> | undefined;
|
|
21
|
+
get headers(): Record<string, {
|
|
22
|
+
formula: Formula;
|
|
23
|
+
enabled?: Formula | null;
|
|
24
|
+
}> | undefined;
|
|
25
|
+
set headers(headers: Record<string, {
|
|
26
|
+
formula: Formula;
|
|
27
|
+
enabled?: Formula | null;
|
|
28
|
+
}> | undefined);
|
|
29
|
+
get method(): import("./apiTypes").ApiMethod | undefined;
|
|
30
|
+
get body(): Formula | undefined;
|
|
31
|
+
get inputs(): Record<string, {
|
|
32
|
+
formula: Formula | null;
|
|
33
|
+
}>;
|
|
34
|
+
get queryParams(): Record<string, {
|
|
35
|
+
formula: Formula;
|
|
36
|
+
enabled?: Formula | null;
|
|
37
|
+
}> | undefined;
|
|
38
|
+
get server(): {
|
|
39
|
+
proxy?: {
|
|
40
|
+
enabled: {
|
|
41
|
+
formula: Formula;
|
|
42
|
+
};
|
|
43
|
+
} | null;
|
|
44
|
+
ssr?: {
|
|
45
|
+
enabled?: {
|
|
46
|
+
formula: Formula;
|
|
47
|
+
} | null;
|
|
48
|
+
};
|
|
49
|
+
} | undefined;
|
|
50
|
+
get client(): {
|
|
51
|
+
debounce?: {
|
|
52
|
+
formula: Formula;
|
|
53
|
+
} | null;
|
|
54
|
+
onCompleted?: import("../component/component.types").EventModel | null;
|
|
55
|
+
onFailed?: import("../component/component.types").EventModel | null;
|
|
56
|
+
onMessage?: import("../component/component.types").EventModel | null;
|
|
57
|
+
parserMode: import("./apiTypes").ApiParserMode;
|
|
58
|
+
} | undefined;
|
|
59
|
+
get redirectRules(): Record<string, {
|
|
60
|
+
formula: Formula;
|
|
61
|
+
statusCode?: import("./apiTypes").RedirectStatusCode | null;
|
|
62
|
+
index: number;
|
|
63
|
+
}> | null | undefined;
|
|
64
|
+
get isError(): {
|
|
65
|
+
formula: Formula;
|
|
66
|
+
} | null | undefined;
|
|
67
|
+
get timeout(): {
|
|
68
|
+
formula: Formula;
|
|
69
|
+
} | null | undefined;
|
|
70
|
+
get '@toddle/metadata'(): {
|
|
71
|
+
comments: Record<string, import("../types").Comment & {
|
|
72
|
+
index: number;
|
|
73
|
+
}> | null;
|
|
74
|
+
} | null | undefined;
|
|
75
|
+
formulasInApi(): Generator<[(string | number)[], Formula]>;
|
|
76
|
+
actionModelsInApi(): Generator<[(string | number)[], ActionModel]>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { getActionsInAction } from '../component/actionUtils';
|
|
2
|
+
import { getFormulasInAction, getFormulasInFormula, } from '../formula/formulaUtils';
|
|
3
|
+
import { isDefined } from '../utils/util';
|
|
4
|
+
export class ToddleApiV2 {
|
|
5
|
+
api;
|
|
6
|
+
_apiReferences;
|
|
7
|
+
key;
|
|
8
|
+
globalFormulas;
|
|
9
|
+
constructor(api, apiKey, globalFormulas) {
|
|
10
|
+
this.api = api;
|
|
11
|
+
this.key = apiKey;
|
|
12
|
+
this.globalFormulas = globalFormulas;
|
|
13
|
+
}
|
|
14
|
+
get apiReferences() {
|
|
15
|
+
if (this._apiReferences) {
|
|
16
|
+
// Only compute apiReferences once
|
|
17
|
+
return this._apiReferences;
|
|
18
|
+
}
|
|
19
|
+
const apis = new Set();
|
|
20
|
+
const visitFormulaReference = (formula) => {
|
|
21
|
+
if (!isDefined(formula)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
switch (formula.type) {
|
|
25
|
+
case 'path':
|
|
26
|
+
if (formula.path[0] === 'Apis') {
|
|
27
|
+
apis.add(formula.path[1]);
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
case 'value':
|
|
31
|
+
break;
|
|
32
|
+
case 'record':
|
|
33
|
+
formula.entries.forEach((entry) => visitFormulaReference(entry.formula));
|
|
34
|
+
break;
|
|
35
|
+
case 'function':
|
|
36
|
+
case 'array':
|
|
37
|
+
case 'or':
|
|
38
|
+
case 'and':
|
|
39
|
+
case 'apply':
|
|
40
|
+
case 'object':
|
|
41
|
+
formula.arguments?.forEach((arg) => visitFormulaReference(arg.formula));
|
|
42
|
+
break;
|
|
43
|
+
case 'switch':
|
|
44
|
+
formula.cases.forEach((c) => {
|
|
45
|
+
visitFormulaReference(c.condition);
|
|
46
|
+
visitFormulaReference(c.formula);
|
|
47
|
+
});
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
visitFormulaReference(this.api.autoFetch);
|
|
52
|
+
visitFormulaReference(this.api.url);
|
|
53
|
+
Object.values(this.api.path ?? {}).forEach((p) => visitFormulaReference(p.formula));
|
|
54
|
+
Object.values(this.api.headers ?? {}).forEach((h) => visitFormulaReference(h.formula));
|
|
55
|
+
visitFormulaReference(this.api.body);
|
|
56
|
+
Object.values(this.api.inputs).forEach((arg) => visitFormulaReference(arg.formula));
|
|
57
|
+
Object.values(this.api.queryParams ?? {}).forEach((q) => {
|
|
58
|
+
visitFormulaReference(q.formula);
|
|
59
|
+
});
|
|
60
|
+
visitFormulaReference(this.api.server?.proxy?.enabled?.formula);
|
|
61
|
+
visitFormulaReference(this.api.server?.ssr?.enabled?.formula);
|
|
62
|
+
visitFormulaReference(this.api.client?.debounce?.formula);
|
|
63
|
+
Object.values(this.api.redirectRules ?? {}).forEach((rule) => {
|
|
64
|
+
visitFormulaReference(rule.formula);
|
|
65
|
+
});
|
|
66
|
+
visitFormulaReference(this.api.isError?.formula);
|
|
67
|
+
visitFormulaReference(this.api.timeout?.formula);
|
|
68
|
+
// Ensure self references are not included - for instance if an API references its
|
|
69
|
+
// own response in a redirect rule
|
|
70
|
+
apis.delete(this.key);
|
|
71
|
+
this._apiReferences = apis;
|
|
72
|
+
return apis;
|
|
73
|
+
}
|
|
74
|
+
get version() {
|
|
75
|
+
return this.api.version;
|
|
76
|
+
}
|
|
77
|
+
get name() {
|
|
78
|
+
return this.api.name;
|
|
79
|
+
}
|
|
80
|
+
get type() {
|
|
81
|
+
return this.api.type;
|
|
82
|
+
}
|
|
83
|
+
get autoFetch() {
|
|
84
|
+
return this.api.autoFetch;
|
|
85
|
+
}
|
|
86
|
+
get url() {
|
|
87
|
+
return this.api.url;
|
|
88
|
+
}
|
|
89
|
+
get path() {
|
|
90
|
+
return this.api.path;
|
|
91
|
+
}
|
|
92
|
+
get headers() {
|
|
93
|
+
return this.api.headers;
|
|
94
|
+
}
|
|
95
|
+
set headers(headers) {
|
|
96
|
+
this.api.headers = headers;
|
|
97
|
+
}
|
|
98
|
+
get method() {
|
|
99
|
+
return this.api.method;
|
|
100
|
+
}
|
|
101
|
+
get body() {
|
|
102
|
+
return this.api.body;
|
|
103
|
+
}
|
|
104
|
+
get inputs() {
|
|
105
|
+
return this.api.inputs;
|
|
106
|
+
}
|
|
107
|
+
get queryParams() {
|
|
108
|
+
return this.api.queryParams;
|
|
109
|
+
}
|
|
110
|
+
get server() {
|
|
111
|
+
return this.api.server;
|
|
112
|
+
}
|
|
113
|
+
get client() {
|
|
114
|
+
return this.api.client;
|
|
115
|
+
}
|
|
116
|
+
get redirectRules() {
|
|
117
|
+
return this.api.redirectRules;
|
|
118
|
+
}
|
|
119
|
+
get isError() {
|
|
120
|
+
return this.api.isError;
|
|
121
|
+
}
|
|
122
|
+
get timeout() {
|
|
123
|
+
return this.api.timeout;
|
|
124
|
+
}
|
|
125
|
+
get '@toddle/metadata'() {
|
|
126
|
+
return this.api['@toddle/metadata'];
|
|
127
|
+
}
|
|
128
|
+
*formulasInApi() {
|
|
129
|
+
const api = this.api;
|
|
130
|
+
const apiKey = this.key;
|
|
131
|
+
for (const [input, value] of Object.entries(this.api.inputs)) {
|
|
132
|
+
yield* getFormulasInFormula({
|
|
133
|
+
formula: value.formula,
|
|
134
|
+
globalFormulas: this.globalFormulas,
|
|
135
|
+
path: ['apis', apiKey, 'inputs', input, 'formula'],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
yield* getFormulasInFormula({
|
|
139
|
+
formula: api.autoFetch,
|
|
140
|
+
globalFormulas: this.globalFormulas,
|
|
141
|
+
path: ['apis', apiKey, 'autoFetch'],
|
|
142
|
+
});
|
|
143
|
+
yield* getFormulasInFormula({
|
|
144
|
+
formula: api.url,
|
|
145
|
+
globalFormulas: this.globalFormulas,
|
|
146
|
+
path: ['apis', apiKey, 'url'],
|
|
147
|
+
});
|
|
148
|
+
for (const [pathKey, path] of Object.entries(api.path ?? {})) {
|
|
149
|
+
yield* getFormulasInFormula({
|
|
150
|
+
formula: path.formula,
|
|
151
|
+
globalFormulas: this.globalFormulas,
|
|
152
|
+
path: ['apis', apiKey, 'path', pathKey, 'formula'],
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
for (const [queryParamKey, queryParam] of Object.entries(api.queryParams ?? {})) {
|
|
156
|
+
yield* getFormulasInFormula({
|
|
157
|
+
formula: queryParam.formula,
|
|
158
|
+
globalFormulas: this.globalFormulas,
|
|
159
|
+
path: ['apis', apiKey, 'queryParams', queryParamKey, 'formula'],
|
|
160
|
+
});
|
|
161
|
+
yield* getFormulasInFormula({
|
|
162
|
+
formula: queryParam.enabled,
|
|
163
|
+
globalFormulas: this.globalFormulas,
|
|
164
|
+
path: ['apis', apiKey, 'queryParams', queryParamKey, 'enabled'],
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
for (const [headerKey, header] of Object.entries(api.headers ?? {})) {
|
|
168
|
+
yield* getFormulasInFormula({
|
|
169
|
+
formula: header.formula,
|
|
170
|
+
globalFormulas: this.globalFormulas,
|
|
171
|
+
path: ['apis', apiKey, 'headers', headerKey, 'formula'],
|
|
172
|
+
});
|
|
173
|
+
yield* getFormulasInFormula({
|
|
174
|
+
formula: header.enabled,
|
|
175
|
+
globalFormulas: this.globalFormulas,
|
|
176
|
+
path: ['apis', apiKey, 'headers', headerKey, 'enabled'],
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
yield* getFormulasInFormula({
|
|
180
|
+
formula: api.body,
|
|
181
|
+
globalFormulas: this.globalFormulas,
|
|
182
|
+
path: ['apis', apiKey, 'body'],
|
|
183
|
+
});
|
|
184
|
+
for (const [actionKey, action] of Object.entries(api.client?.onCompleted?.actions ?? {})) {
|
|
185
|
+
yield* getFormulasInAction({
|
|
186
|
+
action,
|
|
187
|
+
globalFormulas: this.globalFormulas,
|
|
188
|
+
path: ['apis', apiKey, 'client', 'onCompleted', 'actions', actionKey],
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
for (const [actionKey, action] of Object.entries(api.client?.onFailed?.actions ?? {})) {
|
|
192
|
+
yield* getFormulasInAction({
|
|
193
|
+
action,
|
|
194
|
+
globalFormulas: this.globalFormulas,
|
|
195
|
+
path: ['apis', apiKey, 'client', 'onFailed', 'actions', actionKey],
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
yield* getFormulasInFormula({
|
|
199
|
+
formula: api.client?.debounce?.formula,
|
|
200
|
+
globalFormulas: this.globalFormulas,
|
|
201
|
+
path: ['apis', apiKey, 'client', 'debounce', 'formula'],
|
|
202
|
+
});
|
|
203
|
+
for (const [actionKey, action] of Object.entries(api.client?.onMessage?.actions ?? {})) {
|
|
204
|
+
yield* getFormulasInAction({
|
|
205
|
+
action,
|
|
206
|
+
globalFormulas: this.globalFormulas,
|
|
207
|
+
path: ['apis', apiKey, 'client', 'onMessage', 'actions', actionKey],
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
for (const [rule, value] of Object.entries(api.redirectRules ?? {})) {
|
|
211
|
+
yield* getFormulasInFormula({
|
|
212
|
+
formula: value.formula,
|
|
213
|
+
globalFormulas: this.globalFormulas,
|
|
214
|
+
path: ['apis', apiKey, 'redirectRules', rule, 'formula'],
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
yield* getFormulasInFormula({
|
|
218
|
+
formula: api.isError?.formula,
|
|
219
|
+
globalFormulas: this.globalFormulas,
|
|
220
|
+
path: ['apis', apiKey, 'isError', 'formula'],
|
|
221
|
+
});
|
|
222
|
+
yield* getFormulasInFormula({
|
|
223
|
+
formula: api.timeout?.formula,
|
|
224
|
+
globalFormulas: this.globalFormulas,
|
|
225
|
+
path: ['apis', apiKey, 'timeout', 'formula'],
|
|
226
|
+
});
|
|
227
|
+
yield* getFormulasInFormula({
|
|
228
|
+
formula: api.server?.proxy?.enabled.formula,
|
|
229
|
+
globalFormulas: this.globalFormulas,
|
|
230
|
+
path: ['apis', apiKey, 'server', 'proxy', 'enabled', 'formula'],
|
|
231
|
+
});
|
|
232
|
+
yield* getFormulasInFormula({
|
|
233
|
+
formula: api.server?.ssr?.enabled?.formula,
|
|
234
|
+
globalFormulas: this.globalFormulas,
|
|
235
|
+
path: ['apis', apiKey, 'server', 'ssr', 'enabled', 'formula'],
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
*actionModelsInApi() {
|
|
239
|
+
for (const [actionKey, action] of Object.entries(this.api.client?.onCompleted?.actions ?? {})) {
|
|
240
|
+
yield* getActionsInAction(action, [
|
|
241
|
+
'apis',
|
|
242
|
+
this.key,
|
|
243
|
+
'client',
|
|
244
|
+
'onCompleted',
|
|
245
|
+
'actions',
|
|
246
|
+
actionKey,
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
for (const [actionKey, action] of Object.entries(this.api.client?.onFailed?.actions ?? {})) {
|
|
250
|
+
yield* getActionsInAction(action, [
|
|
251
|
+
'apis',
|
|
252
|
+
this.key,
|
|
253
|
+
'client',
|
|
254
|
+
'onFailed',
|
|
255
|
+
'actions',
|
|
256
|
+
actionKey,
|
|
257
|
+
]);
|
|
258
|
+
}
|
|
259
|
+
for (const [actionKey, action] of Object.entries(this.api.client?.onMessage?.actions ?? {})) {
|
|
260
|
+
yield* getActionsInAction(action, [
|
|
261
|
+
'apis',
|
|
262
|
+
this.key,
|
|
263
|
+
'client',
|
|
264
|
+
'onData',
|
|
265
|
+
'actions',
|
|
266
|
+
actionKey,
|
|
267
|
+
]);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=ToddleApiV2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToddleApiV2.js","sourceRoot":"","sources":["../../src/api/ToddleApiV2.ts"],"names":[],"mappings":"AA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ula';
|
|
2
|
+
import type { ApiBase, ApiPerformance, ApiRequest, ComponentAPI, LegacyComponentAPI, ToddleRequestInit } from './apiTypes';
|
|
3
|
+
import { LegacyToddleApi } from './LegacyToddleApi';
|
|
4
|
+
import { ToddleApiV2 } from './ToddleApiV2';
|
|
5
|
+
export declare const NON_BODY_RESPONSE_CODES: number[];
|
|
6
|
+
export declare const isLegacyApi: <Handler>(api: ComponentAPI | LegacyToddleApi<Handler> | ToddleApiV2<Handler>) => api is LegacyComponentAPI | LegacyToddleApi<Handler>;
|
|
7
|
+
export declare const createApiRequest: <Handler>({ api, formulaContext, baseUrl, defaultHeaders, }: {
|
|
8
|
+
api: ApiRequest | ToddleApiV2<Handler>;
|
|
9
|
+
formulaContext: FormulaContext;
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
defaultHeaders: Headers | undefined;
|
|
12
|
+
}) => {
|
|
13
|
+
url: URL;
|
|
14
|
+
requestSettings: ToddleRequestInit;
|
|
15
|
+
};
|
|
16
|
+
export declare const getUrl: (api: ApiBase, formulaContext: FormulaContext, baseUrl?: string) => URL;
|
|
17
|
+
export declare const applyAbortSignal: (api: ApiRequest, requestSettings: RequestInit, formulaContext: FormulaContext) => void;
|
|
18
|
+
export declare const getRequestPath: (path: ApiRequest["path"], formulaContext: FormulaContext) => string;
|
|
19
|
+
export declare const getRequestQueryParams: (params: ApiRequest["queryParams"], formulaContext: FormulaContext) => URLSearchParams;
|
|
20
|
+
export declare const getRequestHeaders: ({ apiHeaders, formulaContext, defaultHeaders, }: {
|
|
21
|
+
apiHeaders: ApiRequest["headers"];
|
|
22
|
+
formulaContext: FormulaContext;
|
|
23
|
+
defaultHeaders: Headers | undefined;
|
|
24
|
+
}) => Headers;
|
|
25
|
+
export declare const getBaseUrl: ({ origin, url, }: {
|
|
26
|
+
origin: string;
|
|
27
|
+
url?: string;
|
|
28
|
+
}) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate the hash of a Request object based on its properties
|
|
31
|
+
*/
|
|
32
|
+
export declare const requestHash: (url: URL, request: RequestInit) => number;
|
|
33
|
+
export declare const isApiError: ({ apiName, response, formulaContext, errorFormula, performance, }: {
|
|
34
|
+
apiName: string;
|
|
35
|
+
response: {
|
|
36
|
+
ok: boolean;
|
|
37
|
+
status?: number;
|
|
38
|
+
headers?: Record<string, string> | null;
|
|
39
|
+
body: unknown;
|
|
40
|
+
};
|
|
41
|
+
formulaContext: FormulaContext;
|
|
42
|
+
performance: ApiPerformance;
|
|
43
|
+
errorFormula?: {
|
|
44
|
+
formula: Formula;
|
|
45
|
+
} | null;
|
|
46
|
+
}) => boolean;
|
|
47
|
+
export declare const createApiEvent: (eventName: "message" | "success" | "failed", detail: any) => CustomEvent<any>;
|
|
48
|
+
export declare const sortApiObjects: <Handler>(apis: Array<[string, ComponentAPI]>) => [string, ComponentAPI][];
|
|
49
|
+
export declare const sortApiEntries: <Handler>(apis: Array<[string, LegacyToddleApi<Handler> | ToddleApiV2<Handler>]>) => [string, LegacyToddleApi<Handler> | ToddleApiV2<Handler>][];
|