@thirdweb-dev/service-utils 0.5.0-nightly-f5aed34d-20230829001006 → 0.5.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.
Files changed (137) hide show
  1. package/dist/cjs/cf-worker/index.js +164 -0
  2. package/dist/cjs/cf-worker/index.js.map +1 -0
  3. package/dist/cjs/cf-worker/usage.js +55 -0
  4. package/dist/cjs/cf-worker/usage.js.map +1 -0
  5. package/dist/cjs/core/api.js +42 -0
  6. package/dist/cjs/core/api.js.map +1 -0
  7. package/dist/cjs/core/authorize/client.js +98 -0
  8. package/dist/cjs/core/authorize/client.js.map +1 -0
  9. package/dist/cjs/core/authorize/index.js +109 -0
  10. package/dist/cjs/core/authorize/index.js.map +1 -0
  11. package/dist/cjs/core/authorize/service.js +50 -0
  12. package/dist/cjs/core/authorize/service.js.map +1 -0
  13. package/dist/cjs/core/authorize/types.js +3 -0
  14. package/dist/cjs/core/authorize/types.js.map +1 -0
  15. package/dist/cjs/core/rateLimit/index.js +60 -0
  16. package/dist/cjs/core/rateLimit/index.js.map +1 -0
  17. package/dist/cjs/core/rateLimit/types.js +3 -0
  18. package/dist/cjs/core/rateLimit/types.js.map +1 -0
  19. package/dist/cjs/core/services.js +85 -0
  20. package/dist/cjs/core/services.js.map +1 -0
  21. package/dist/cjs/core/types.js +3 -0
  22. package/dist/cjs/core/types.js.map +1 -0
  23. package/dist/cjs/core/usage.js +85 -0
  24. package/dist/cjs/core/usage.js.map +1 -0
  25. package/dist/cjs/index.js +13 -0
  26. package/dist/cjs/index.js.map +1 -0
  27. package/dist/cjs/mocks.js +60 -0
  28. package/dist/cjs/mocks.js.map +1 -0
  29. package/dist/cjs/node/index.js +182 -0
  30. package/dist/cjs/node/index.js.map +1 -0
  31. package/dist/cjs/package.json +1 -0
  32. package/dist/esm/cf-worker/index.js +156 -0
  33. package/dist/esm/cf-worker/index.js.map +1 -0
  34. package/dist/esm/cf-worker/usage.js +53 -0
  35. package/dist/esm/cf-worker/usage.js.map +1 -0
  36. package/dist/esm/core/api.js +38 -0
  37. package/dist/esm/core/api.js.map +1 -0
  38. package/dist/esm/core/authorize/client.js +93 -0
  39. package/dist/esm/core/authorize/client.js.map +1 -0
  40. package/dist/esm/core/authorize/index.js +106 -0
  41. package/dist/esm/core/authorize/index.js.map +1 -0
  42. package/dist/esm/core/authorize/service.js +47 -0
  43. package/dist/esm/core/authorize/service.js.map +1 -0
  44. package/dist/esm/core/authorize/types.js +2 -0
  45. package/dist/esm/core/authorize/types.js.map +1 -0
  46. package/dist/esm/core/rateLimit/index.js +57 -0
  47. package/dist/esm/core/rateLimit/index.js.map +1 -0
  48. package/dist/esm/core/rateLimit/types.js +2 -0
  49. package/dist/esm/core/rateLimit/types.js.map +1 -0
  50. package/dist/esm/core/services.js +81 -0
  51. package/dist/esm/core/services.js.map +1 -0
  52. package/dist/esm/core/types.js +2 -0
  53. package/dist/esm/core/types.js.map +1 -0
  54. package/dist/esm/core/usage.js +82 -0
  55. package/dist/esm/core/usage.js.map +1 -0
  56. package/dist/esm/index.js +5 -0
  57. package/dist/esm/index.js.map +1 -0
  58. package/dist/esm/mocks.js +57 -0
  59. package/dist/esm/mocks.js.map +1 -0
  60. package/dist/esm/node/index.js +174 -0
  61. package/dist/esm/node/index.js.map +1 -0
  62. package/dist/esm/package.json +1 -0
  63. package/dist/{declarations/src → types}/cf-worker/index.d.ts +10 -8
  64. package/dist/types/cf-worker/index.d.ts.map +1 -0
  65. package/dist/types/cf-worker/usage.d.ts +24 -0
  66. package/dist/types/cf-worker/usage.d.ts.map +1 -0
  67. package/dist/types/core/api.d.ts +121 -0
  68. package/dist/types/core/api.d.ts.map +1 -0
  69. package/dist/types/core/authorize/client.d.ts +17 -0
  70. package/dist/types/core/authorize/client.d.ts.map +1 -0
  71. package/dist/{declarations/src → types}/core/authorize/index.d.ts +6 -5
  72. package/dist/types/core/authorize/index.d.ts.map +1 -0
  73. package/dist/types/core/authorize/service.d.ts +4 -0
  74. package/dist/types/core/authorize/service.d.ts.map +1 -0
  75. package/dist/types/core/authorize/types.d.ts +10 -0
  76. package/dist/types/core/authorize/types.d.ts.map +1 -0
  77. package/dist/types/core/rateLimit/index.d.ts +20 -0
  78. package/dist/types/core/rateLimit/index.d.ts.map +1 -0
  79. package/dist/types/core/rateLimit/types.d.ts +13 -0
  80. package/dist/types/core/rateLimit/types.d.ts.map +1 -0
  81. package/dist/{declarations/src → types}/core/services.d.ts +84 -4
  82. package/dist/types/core/services.d.ts.map +1 -0
  83. package/dist/types/core/types.d.ts.map +1 -0
  84. package/dist/types/core/usage.d.ts +196 -0
  85. package/dist/types/core/usage.d.ts.map +1 -0
  86. package/dist/types/index.d.ts +5 -0
  87. package/dist/types/index.d.ts.map +1 -0
  88. package/dist/types/mocks.d.ts +7 -0
  89. package/dist/types/mocks.d.ts.map +1 -0
  90. package/dist/types/node/index.d.ts +41 -0
  91. package/dist/types/node/index.d.ts.map +1 -0
  92. package/package.json +42 -44
  93. package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.d.ts +0 -2
  94. package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.d.ts.map +0 -1
  95. package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.dev.js +0 -240
  96. package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.js +0 -7
  97. package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.prod.js +0 -240
  98. package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.esm.js +0 -227
  99. package/cf-worker/package.json +0 -4
  100. package/dist/declarations/src/cf-worker/index.d.ts.map +0 -1
  101. package/dist/declarations/src/cf-worker/usage.d.ts +0 -79
  102. package/dist/declarations/src/cf-worker/usage.d.ts.map +0 -1
  103. package/dist/declarations/src/core/api.d.ts +0 -48
  104. package/dist/declarations/src/core/api.d.ts.map +0 -1
  105. package/dist/declarations/src/core/authorize/client.d.ts +0 -9
  106. package/dist/declarations/src/core/authorize/client.d.ts.map +0 -1
  107. package/dist/declarations/src/core/authorize/index.d.ts.map +0 -1
  108. package/dist/declarations/src/core/authorize/service.d.ts +0 -7
  109. package/dist/declarations/src/core/authorize/service.d.ts.map +0 -1
  110. package/dist/declarations/src/core/authorize/types.d.ts +0 -12
  111. package/dist/declarations/src/core/authorize/types.d.ts.map +0 -1
  112. package/dist/declarations/src/core/services.d.ts.map +0 -1
  113. package/dist/declarations/src/core/types.d.ts.map +0 -1
  114. package/dist/declarations/src/index.d.ts +0 -2
  115. package/dist/declarations/src/index.d.ts.map +0 -1
  116. package/dist/declarations/src/node/index.d.ts +0 -23
  117. package/dist/declarations/src/node/index.d.ts.map +0 -1
  118. package/dist/index-6e0ecc5f.cjs.prod.js +0 -424
  119. package/dist/index-cd4f96ef.cjs.dev.js +0 -424
  120. package/dist/index-ffddf746.esm.js +0 -422
  121. package/dist/services-86283509.esm.js +0 -44
  122. package/dist/services-9e185105.cjs.prod.js +0 -49
  123. package/dist/services-a3f36057.cjs.dev.js +0 -49
  124. package/dist/thirdweb-dev-service-utils.cjs.d.ts +0 -2
  125. package/dist/thirdweb-dev-service-utils.cjs.d.ts.map +0 -1
  126. package/dist/thirdweb-dev-service-utils.cjs.dev.js +0 -12
  127. package/dist/thirdweb-dev-service-utils.cjs.js +0 -7
  128. package/dist/thirdweb-dev-service-utils.cjs.prod.js +0 -12
  129. package/dist/thirdweb-dev-service-utils.esm.js +0 -1
  130. package/node/dist/thirdweb-dev-service-utils-node.cjs.d.ts +0 -2
  131. package/node/dist/thirdweb-dev-service-utils-node.cjs.d.ts.map +0 -1
  132. package/node/dist/thirdweb-dev-service-utils-node.cjs.dev.js +0 -167
  133. package/node/dist/thirdweb-dev-service-utils-node.cjs.js +0 -7
  134. package/node/dist/thirdweb-dev-service-utils-node.cjs.prod.js +0 -167
  135. package/node/dist/thirdweb-dev-service-utils-node.esm.js +0 -155
  136. package/node/package.json +0 -4
  137. /package/dist/{declarations/src → types}/core/types.d.ts +0 -0
@@ -1,422 +0,0 @@
1
- async function fetchKeyMetadataFromApi(clientId, config) {
2
- const {
3
- apiUrl,
4
- serviceScope,
5
- serviceApiKey
6
- } = config;
7
- const url = `${apiUrl}/v1/keys/use?clientId=${clientId}&scope=${serviceScope}`;
8
- const response = await fetch(url, {
9
- method: "GET",
10
- headers: {
11
- "x-service-api-key": serviceApiKey,
12
- "content-type": "application/json"
13
- }
14
- });
15
- let json;
16
- try {
17
- json = await response.json();
18
- } catch (e) {
19
- throw new Error(`Error fetching key metadata from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
20
- }
21
- return json;
22
- }
23
- async function fetchAccountFromApi(jwt, config, useWalletAuth) {
24
- const {
25
- apiUrl,
26
- serviceApiKey
27
- } = config;
28
- const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`;
29
- const response = await fetch(url, {
30
- method: "GET",
31
- headers: {
32
- "x-service-api-key": serviceApiKey,
33
- "content-type": "application/json",
34
- authorization: `Bearer ${jwt}`
35
- }
36
- });
37
- let json;
38
- try {
39
- json = await response.json();
40
- } catch (e) {
41
- throw new Error(`Error fetching account from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
42
- }
43
- return json;
44
- }
45
-
46
- function authorizeClient(authOptions, apiKeyMeta) {
47
- const {
48
- origin,
49
- bundleId,
50
- secretKeyHash: providedSecretHash
51
- } = authOptions;
52
- const {
53
- domains,
54
- bundleIds,
55
- secretHash
56
- } = apiKeyMeta;
57
- const authResult = {
58
- authorized: true,
59
- apiKeyMeta,
60
- accountMeta: {
61
- id: apiKeyMeta.accountId,
62
- // TODO update this later
63
- name: "",
64
- creatorWalletAddress: apiKeyMeta.creatorWalletAddress
65
- }
66
- };
67
-
68
- // check for public restrictions
69
- if (domains.includes("*")) {
70
- return authResult;
71
- }
72
-
73
- // check for secretHash
74
- if (providedSecretHash) {
75
- if (secretHash !== providedSecretHash) {
76
- return {
77
- authorized: false,
78
- errorMessage: "Incorrect key provided. You can view your active API keys at https://thirdweb.com/dashboard/settings",
79
- errorCode: "SECRET_INVALID",
80
- status: 401
81
- };
82
- }
83
- return authResult;
84
- }
85
-
86
- // validate domains
87
- if (origin) {
88
- if (
89
- // find matching domain, or if all domains allowed
90
- domains.find(d => {
91
- // if any domain is allowed, we'll return true
92
- if (d === "*") {
93
- return true;
94
- }
95
-
96
- // special rule for `localhost`
97
- // if the domain is localhost, we'll allow any origin that starts with localhost
98
- if (d === "localhost" && origin.startsWith("localhost")) {
99
- return true;
100
- }
101
-
102
- // If the allowedDomain has a wildcard,
103
- // we'll check that the ending of our domain matches the wildcard
104
- if (d.startsWith("*.")) {
105
- // get rid of the * and check if it ends with the `.<domain>.<tld>`
106
- const domainRoot = d.slice(1);
107
- return origin.endsWith(domainRoot);
108
- }
109
-
110
- // If there's no wildcard, we'll check for an exact match
111
- return d === origin;
112
- })) {
113
- return authResult;
114
- }
115
- return {
116
- authorized: false,
117
- errorMessage: `Invalid request: Unauthorized domain: ${origin}. You can view the restrictions on this API key at https://thirdweb.com/create-api-key`,
118
- errorCode: "ORIGIN_UNAUTHORIZED",
119
- status: 401
120
- };
121
- }
122
-
123
- // validate bundleId
124
- if (bundleId) {
125
- if (
126
- // find matching bundle id, or if all bundles allowed
127
- bundleIds.find(b => {
128
- if (b === "*") {
129
- return true;
130
- }
131
- return b === bundleId;
132
- })) {
133
- return authResult;
134
- }
135
- return {
136
- authorized: false,
137
- errorMessage: `Invalid request: Unauthorized Bundle ID: ${bundleId}. You can view the restrictions on this API key at https://thirdweb.com/create-api-key`,
138
- errorCode: "BUNDLE_UNAUTHORIZED",
139
- status: 401
140
- };
141
- }
142
- return {
143
- authorized: false,
144
- errorMessage: "The keys are invalid. Please check the secret-key/clientId and try again.",
145
- errorCode: "UNAUTHORIZED",
146
- status: 401
147
- };
148
- }
149
-
150
- function authorizeService(apiKeyMetadata, serviceConfig, authorizationPayload) {
151
- const {
152
- services
153
- } = apiKeyMetadata;
154
- // validate services
155
- const service = services.find(srv => srv.name === serviceConfig.serviceScope);
156
- if (!service) {
157
- return {
158
- authorized: false,
159
- errorMessage: `Invalid request: Unauthorized service: ${serviceConfig.serviceScope}. You can view the restrictions on this API key in your dashboard: https://thirdweb.com/create-api-key`,
160
- errorCode: "SERVICE_UNAUTHORIZED",
161
- status: 403
162
- };
163
- }
164
-
165
- // validate service actions
166
- if (serviceConfig.serviceAction) {
167
- const isActionAllowed = service.actions.includes(serviceConfig.serviceAction);
168
- if (!isActionAllowed) {
169
- return {
170
- authorized: false,
171
- errorMessage: `Invalid request: Unauthorized action: ${serviceConfig.serviceScope} ${serviceConfig.serviceAction}. You can view the restrictions on this API key in your dashboard: https://thirdweb.com/create-api-key`,
172
- errorCode: "SERVICE_ACTION_UNAUTHORIZED",
173
- status: 403
174
- };
175
- }
176
- }
177
-
178
- // validate service target addresses
179
- // the service has to pass in the target address for this to be validated
180
- if (authorizationPayload?.targetAddress) {
181
- const checkedAddresses = Array.isArray(authorizationPayload.targetAddress) ? authorizationPayload.targetAddress : [authorizationPayload.targetAddress];
182
- const allAllowed = service.targetAddresses.includes("*");
183
- if (!allAllowed && checkedAddresses.some(ta => !service.targetAddresses.includes(ta))) {
184
- return {
185
- authorized: false,
186
- errorMessage: `Invalid request: Unauthorized address: ${serviceConfig.serviceScope} ${checkedAddresses}. You can view the restrictions on this API key in your dashboard: https://thirdweb.com/create-api-key`,
187
- errorCode: "SERVICE_TARGET_ADDRESS_UNAUTHORIZED",
188
- status: 403
189
- };
190
- }
191
- }
192
- return {
193
- authorized: true,
194
- accountMeta: {
195
- id: apiKeyMetadata.accountId,
196
- name: "",
197
- creatorWalletAddress: apiKeyMetadata.creatorWalletAddress
198
- },
199
- apiKeyMeta: apiKeyMetadata
200
- };
201
- }
202
-
203
- async function authorize(authData, serviceConfig, cacheOptions) {
204
- const {
205
- clientId,
206
- targetAddress,
207
- secretKeyHash,
208
- jwt,
209
- hashedJWT,
210
- useWalletAuth
211
- } = authData;
212
- const {
213
- enforceAuth
214
- } = serviceConfig;
215
-
216
- // BACKWARDS COMPAT: if auth not enforced and we don't have auth credentials bypass
217
- if (!enforceAuth && !clientId && !secretKeyHash) {
218
- return {
219
- authorized: true,
220
- apiKeyMeta: null,
221
- accountMeta: null
222
- };
223
- }
224
- // if we come in with a JWT then we only check the account is valid
225
- if (jwt && hashedJWT) {
226
- let accountMeta = null;
227
- if (cacheOptions) {
228
- try {
229
- const cachedAccountInfo = await cacheOptions.get(hashedJWT);
230
- if (cachedAccountInfo) {
231
- const parsed = JSON.parse(cachedAccountInfo);
232
- if ("updatedAt" in parsed) {
233
- // we want to compare the updatedAt time to the current time
234
- // if the difference is greater than the cacheTtl we want to ignore the cached data
235
- const now = Date.now();
236
- const diff = now - parsed.updatedAt;
237
- const cacheTtl = cacheOptions.cacheTtlSeconds * 1000;
238
- // only if the diff is less than the cacheTtl do we want to use the cached key
239
- if (diff < cacheTtl * 1000) {
240
- accountMeta = parsed.apiKeyMeta;
241
- }
242
- } else {
243
- accountMeta = parsed;
244
- }
245
- }
246
- } catch (err) {
247
- // ignore errors, proceed as if not in cache
248
- }
249
- }
250
- if (!accountMeta) {
251
- try {
252
- const {
253
- data,
254
- error
255
- } = await fetchAccountFromApi(jwt, serviceConfig, useWalletAuth?.toLowerCase() === "true");
256
- if (error) {
257
- return {
258
- authorized: false,
259
- errorCode: error.code,
260
- errorMessage: error.message,
261
- status: error.statusCode
262
- };
263
- } else if (!data) {
264
- return {
265
- authorized: false,
266
- errorCode: "NO_ACCOUNT",
267
- errorMessage: "No error but also no account returned.",
268
- status: 500
269
- };
270
- }
271
- accountMeta = data;
272
- if (cacheOptions) {
273
- await cacheOptions.put(hashedJWT, accountMeta);
274
- }
275
- } catch (err) {
276
- console.warn("failed to fetch account from api", err);
277
- return {
278
- authorized: false,
279
- status: 500,
280
- errorMessage: "Failed to get account information.",
281
- errorCode: "FAILED_TO_LOAD_ACCOUNT"
282
- };
283
- }
284
- }
285
- // if we still don't have an accountMeta at this point we can't authorize
286
- if (!accountMeta) {
287
- return {
288
- authorized: false,
289
- status: 401,
290
- errorMessage: "Missing account information.",
291
- errorCode: "MISSING_ACCOUNT"
292
- };
293
- }
294
- // otherwise we want to return early with the accountMeta
295
- return {
296
- authorized: true,
297
- apiKeyMeta: null,
298
- accountMeta
299
- };
300
- }
301
-
302
- // if we don't have a client id at this point we can't authorize
303
- if (!clientId) {
304
- return {
305
- authorized: false,
306
- status: 401,
307
- errorMessage: "Missing clientId or secretKey.",
308
- errorCode: "MISSING_KEY"
309
- };
310
- }
311
- let apiKeyMeta = null;
312
- // if we have cache options we want to check the cache first
313
- if (cacheOptions) {
314
- try {
315
- const cachedKey = await cacheOptions.get(clientId);
316
- if (cachedKey) {
317
- const parsed = JSON.parse(cachedKey);
318
- if ("updatedAt" in parsed) {
319
- // we want to compare the updatedAt time to the current time
320
- // if the difference is greater than the cacheTtl we want to ignore the cached data
321
- const now = Date.now();
322
- const diff = now - parsed.updatedAt;
323
- const cacheTtl = cacheOptions.cacheTtlSeconds * 1000;
324
- // only if the diff is less than the cacheTtl do we want to use the cached key
325
- if (diff < cacheTtl * 1000) {
326
- apiKeyMeta = parsed.apiKeyMeta;
327
- }
328
- } else {
329
- apiKeyMeta = parsed;
330
- }
331
- }
332
- } catch (err) {
333
- // ignore errors, proceed as if not in cache
334
- }
335
- }
336
-
337
- // if we don't have a cached key, fetch from the API
338
- if (!apiKeyMeta) {
339
- try {
340
- const {
341
- data,
342
- error
343
- } = await fetchKeyMetadataFromApi(clientId, serviceConfig);
344
- if (error) {
345
- return {
346
- authorized: false,
347
- errorCode: error.code,
348
- errorMessage: error.message,
349
- status: error.statusCode
350
- };
351
- } else if (!data) {
352
- return {
353
- authorized: false,
354
- errorCode: "NO_KEY",
355
- errorMessage: "No error but also no key returned.",
356
- status: 500
357
- };
358
- }
359
- // if we have a key for sure then assign it
360
- apiKeyMeta = data;
361
-
362
- // cache the retrieved key if we have cache options
363
- if (cacheOptions) {
364
- // we await this always because it can be a promise or not
365
- await cacheOptions.put(clientId, data);
366
- }
367
- } catch (err) {
368
- console.warn("failed to fetch key metadata from api", err);
369
- return {
370
- authorized: false,
371
- status: 500,
372
- errorMessage: "Failed to fetch key metadata. Please check your secret-key/clientId.",
373
- errorCode: "FAILED_TO_FETCH_KEY"
374
- };
375
- }
376
- }
377
- if (!apiKeyMeta) {
378
- return {
379
- authorized: false,
380
- status: 401,
381
- errorMessage: "Key is invalid. Please check your secret-key/clientId.",
382
- errorCode: "INVALID_KEY"
383
- };
384
- }
385
- // now we can validate the key itself
386
- const clientAuth = authorizeClient(authData, apiKeyMeta);
387
- if (!clientAuth.authorized) {
388
- return {
389
- errorCode: clientAuth.errorCode,
390
- authorized: false,
391
- status: 401,
392
- errorMessage: clientAuth.errorMessage
393
- };
394
- }
395
-
396
- // if we've made it this far we need to check service specific authorization
397
- const serviceAuth = authorizeService(apiKeyMeta, serviceConfig, {
398
- targetAddress
399
- });
400
- if (!serviceAuth.authorized) {
401
- return {
402
- errorCode: serviceAuth.errorCode,
403
- authorized: false,
404
- status: 403,
405
- errorMessage: serviceAuth.errorMessage
406
- };
407
- }
408
-
409
- // if we reach this point we are authorized!
410
- return {
411
- authorized: true,
412
- apiKeyMeta,
413
- accountMeta: {
414
- id: apiKeyMeta.accountId,
415
- // TODO update this later
416
- name: "",
417
- creatorWalletAddress: apiKeyMeta.creatorWalletAddress
418
- }
419
- };
420
- }
421
-
422
- export { authorize as a };
@@ -1,44 +0,0 @@
1
- const SERVICE_DEFINITIONS = {
2
- storage: {
3
- name: "storage",
4
- title: "Storage",
5
- description: "IPFS Upload and Download",
6
- actions: [{
7
- name: "read",
8
- title: "Download",
9
- description: "Download a file from Storage"
10
- }, {
11
- name: "write",
12
- title: "Upload",
13
- description: "Upload a file to Storage"
14
- }]
15
- },
16
- rpc: {
17
- name: "rpc",
18
- title: "RPC",
19
- description: "Accelerated RPC Edge",
20
- // all actions allowed
21
- actions: []
22
- },
23
- bundler: {
24
- name: "bundler",
25
- title: "Smart Wallets",
26
- description: "Bundler & Paymaster services",
27
- // all actions allowed
28
- actions: []
29
- },
30
- relayer: {
31
- name: "relayer",
32
- title: "Gasless Relayer",
33
- description: "Enable gasless transactions",
34
- // all actions allowed
35
- actions: []
36
- }
37
- };
38
- const SERVICE_NAMES = Object.keys(SERVICE_DEFINITIONS);
39
- const SERVICES = Object.values(SERVICE_DEFINITIONS);
40
- function getServiceByName(name) {
41
- return SERVICE_DEFINITIONS[name];
42
- }
43
-
44
- export { SERVICE_DEFINITIONS as S, SERVICE_NAMES as a, SERVICES as b, getServiceByName as g };
@@ -1,49 +0,0 @@
1
- 'use strict';
2
-
3
- const SERVICE_DEFINITIONS = {
4
- storage: {
5
- name: "storage",
6
- title: "Storage",
7
- description: "IPFS Upload and Download",
8
- actions: [{
9
- name: "read",
10
- title: "Download",
11
- description: "Download a file from Storage"
12
- }, {
13
- name: "write",
14
- title: "Upload",
15
- description: "Upload a file to Storage"
16
- }]
17
- },
18
- rpc: {
19
- name: "rpc",
20
- title: "RPC",
21
- description: "Accelerated RPC Edge",
22
- // all actions allowed
23
- actions: []
24
- },
25
- bundler: {
26
- name: "bundler",
27
- title: "Smart Wallets",
28
- description: "Bundler & Paymaster services",
29
- // all actions allowed
30
- actions: []
31
- },
32
- relayer: {
33
- name: "relayer",
34
- title: "Gasless Relayer",
35
- description: "Enable gasless transactions",
36
- // all actions allowed
37
- actions: []
38
- }
39
- };
40
- const SERVICE_NAMES = Object.keys(SERVICE_DEFINITIONS);
41
- const SERVICES = Object.values(SERVICE_DEFINITIONS);
42
- function getServiceByName(name) {
43
- return SERVICE_DEFINITIONS[name];
44
- }
45
-
46
- exports.SERVICES = SERVICES;
47
- exports.SERVICE_DEFINITIONS = SERVICE_DEFINITIONS;
48
- exports.SERVICE_NAMES = SERVICE_NAMES;
49
- exports.getServiceByName = getServiceByName;
@@ -1,49 +0,0 @@
1
- 'use strict';
2
-
3
- const SERVICE_DEFINITIONS = {
4
- storage: {
5
- name: "storage",
6
- title: "Storage",
7
- description: "IPFS Upload and Download",
8
- actions: [{
9
- name: "read",
10
- title: "Download",
11
- description: "Download a file from Storage"
12
- }, {
13
- name: "write",
14
- title: "Upload",
15
- description: "Upload a file to Storage"
16
- }]
17
- },
18
- rpc: {
19
- name: "rpc",
20
- title: "RPC",
21
- description: "Accelerated RPC Edge",
22
- // all actions allowed
23
- actions: []
24
- },
25
- bundler: {
26
- name: "bundler",
27
- title: "Smart Wallets",
28
- description: "Bundler & Paymaster services",
29
- // all actions allowed
30
- actions: []
31
- },
32
- relayer: {
33
- name: "relayer",
34
- title: "Gasless Relayer",
35
- description: "Enable gasless transactions",
36
- // all actions allowed
37
- actions: []
38
- }
39
- };
40
- const SERVICE_NAMES = Object.keys(SERVICE_DEFINITIONS);
41
- const SERVICES = Object.values(SERVICE_DEFINITIONS);
42
- function getServiceByName(name) {
43
- return SERVICE_DEFINITIONS[name];
44
- }
45
-
46
- exports.SERVICES = SERVICES;
47
- exports.SERVICE_DEFINITIONS = SERVICE_DEFINITIONS;
48
- exports.SERVICE_NAMES = SERVICE_NAMES;
49
- exports.getServiceByName = getServiceByName;
@@ -1,2 +0,0 @@
1
- export * from "./declarations/src/index";
2
- //# sourceMappingURL=thirdweb-dev-service-utils.cjs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thirdweb-dev-service-utils.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var services = require('./services-a3f36057.cjs.dev.js');
6
-
7
-
8
-
9
- exports.SERVICES = services.SERVICES;
10
- exports.SERVICE_DEFINITIONS = services.SERVICE_DEFINITIONS;
11
- exports.SERVICE_NAMES = services.SERVICE_NAMES;
12
- exports.getServiceByName = services.getServiceByName;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./thirdweb-dev-service-utils.cjs.prod.js");
5
- } else {
6
- module.exports = require("./thirdweb-dev-service-utils.cjs.dev.js");
7
- }
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var services = require('./services-9e185105.cjs.prod.js');
6
-
7
-
8
-
9
- exports.SERVICES = services.SERVICES;
10
- exports.SERVICE_DEFINITIONS = services.SERVICE_DEFINITIONS;
11
- exports.SERVICE_NAMES = services.SERVICE_NAMES;
12
- exports.getServiceByName = services.getServiceByName;
@@ -1 +0,0 @@
1
- export { b as SERVICES, S as SERVICE_DEFINITIONS, a as SERVICE_NAMES, g as getServiceByName } from './services-86283509.esm.js';
@@ -1,2 +0,0 @@
1
- export * from "../../dist/declarations/src/node/index";
2
- //# sourceMappingURL=thirdweb-dev-service-utils-node.cjs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thirdweb-dev-service-utils-node.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/node/index.d.ts"],"names":[],"mappings":"AAAA"}