@stripe/extensibility-tool-utils 1.0.3-preview.0 → 1.1.0-preview.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/dist/index.cjs CHANGED
@@ -75,6 +75,7 @@ __export(index_exports, {
75
75
  _escapeToken: () => _escapeToken,
76
76
  _fingerprint: () => _fingerprint,
77
77
  _getAdapter: () => _getAdapter,
78
+ _getCustomObjectMethodNameReservation: () => _getCustomObjectMethodNameReservation,
78
79
  _hasPointer: () => _hasPointer,
79
80
  _inferStripeApiName: () => _inferStripeApiName,
80
81
  _isRecord: () => _isRecord,
@@ -317,6 +318,74 @@ var _stripeMetadataPolicy = {
317
318
  }
318
319
  };
319
320
 
321
+ // src/naming/custom-object-method-names.ts
322
+ var baseClassMethods = /* @__PURE__ */ new Set(["save", "revert"]);
323
+ var objectPrototypeMethods = /* @__PURE__ */ new Set([
324
+ "hasOwnProperty",
325
+ "isPrototypeOf",
326
+ "propertyIsEnumerable",
327
+ "toLocaleString",
328
+ "toString",
329
+ "valueOf",
330
+ "__proto__",
331
+ "prototype"
332
+ ]);
333
+ var platformMethods = /* @__PURE__ */ new Set([
334
+ "changes",
335
+ "delete",
336
+ "destroy",
337
+ "sync",
338
+ "export",
339
+ "update",
340
+ "insert",
341
+ "upsert",
342
+ "load",
343
+ "clone",
344
+ "list",
345
+ "search",
346
+ "transactionBegin",
347
+ "transactionComplete",
348
+ "event",
349
+ "error",
350
+ "hydrate",
351
+ "serialize",
352
+ "json"
353
+ ]);
354
+ var lifecycleBaseNames = [
355
+ "create",
356
+ "update",
357
+ "delete",
358
+ "destroy",
359
+ "upsert",
360
+ "sync",
361
+ "export",
362
+ "action",
363
+ "insert",
364
+ "load",
365
+ "clone",
366
+ "transactionBegin",
367
+ "transactionComplete",
368
+ "event",
369
+ "error",
370
+ "hydrate",
371
+ "serialize",
372
+ "json"
373
+ ];
374
+ var lifecycleHooks = new Set(
375
+ lifecycleBaseNames.flatMap((name) => {
376
+ const suffix = name.charAt(0).toUpperCase() + name.slice(1);
377
+ return [`before${suffix}`, `after${suffix}`, `on${suffix}`];
378
+ })
379
+ );
380
+ function _getCustomObjectMethodNameReservation(name) {
381
+ if (baseClassMethods.has(name)) return "baseClass";
382
+ if (name === "then") return "runtime";
383
+ if (objectPrototypeMethods.has(name)) return "objectPrototype";
384
+ if (platformMethods.has(name)) return "platform";
385
+ if (lifecycleHooks.has(name)) return "lifecycle";
386
+ return void 0;
387
+ }
388
+
320
389
  // src/naming/validate.ts
321
390
  function _validateApiName(value) {
322
391
  const reasons = [];
@@ -2889,6 +2958,7 @@ function _isSemverVersion(input) {
2889
2958
  _escapeToken,
2890
2959
  _fingerprint,
2891
2960
  _getAdapter,
2961
+ _getCustomObjectMethodNameReservation,
2892
2962
  _hasPointer,
2893
2963
  _inferStripeApiName,
2894
2964
  _isRecord,
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export { _tokenizeIdentifier, _toSentenceDisplayName, _toStripeApiCase, _truncateName, } from './naming/stripe-api-case.js';
10
10
  export { _stripeMetadataPolicy, _inferStripeApiName } from './naming/metadata-policy.js';
11
+ export { _getCustomObjectMethodNameReservation } from './naming/custom-object-method-names.js';
11
12
  export { _looksPlural, _looksSingular, _toCapitalized, _toPascalCase, _toPlural, _toSingular, _toSnakeCase, } from './naming/inflection.js';
12
13
  export { _validateApiName, _validateDisplayName } from './naming/validate.js';
13
14
  export type { _ApiNameValidationResult } from './naming/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,EACX,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,gBAAgB;AAChB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,gBAAgB;AAChB,YAAY,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAG9B,gBAAgB;AAChB,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACd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B;AAChB,cAAc,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -191,6 +191,74 @@ var _stripeMetadataPolicy = {
191
191
  }
192
192
  };
193
193
 
194
+ // src/naming/custom-object-method-names.ts
195
+ var baseClassMethods = /* @__PURE__ */ new Set(["save", "revert"]);
196
+ var objectPrototypeMethods = /* @__PURE__ */ new Set([
197
+ "hasOwnProperty",
198
+ "isPrototypeOf",
199
+ "propertyIsEnumerable",
200
+ "toLocaleString",
201
+ "toString",
202
+ "valueOf",
203
+ "__proto__",
204
+ "prototype"
205
+ ]);
206
+ var platformMethods = /* @__PURE__ */ new Set([
207
+ "changes",
208
+ "delete",
209
+ "destroy",
210
+ "sync",
211
+ "export",
212
+ "update",
213
+ "insert",
214
+ "upsert",
215
+ "load",
216
+ "clone",
217
+ "list",
218
+ "search",
219
+ "transactionBegin",
220
+ "transactionComplete",
221
+ "event",
222
+ "error",
223
+ "hydrate",
224
+ "serialize",
225
+ "json"
226
+ ]);
227
+ var lifecycleBaseNames = [
228
+ "create",
229
+ "update",
230
+ "delete",
231
+ "destroy",
232
+ "upsert",
233
+ "sync",
234
+ "export",
235
+ "action",
236
+ "insert",
237
+ "load",
238
+ "clone",
239
+ "transactionBegin",
240
+ "transactionComplete",
241
+ "event",
242
+ "error",
243
+ "hydrate",
244
+ "serialize",
245
+ "json"
246
+ ];
247
+ var lifecycleHooks = new Set(
248
+ lifecycleBaseNames.flatMap((name) => {
249
+ const suffix = name.charAt(0).toUpperCase() + name.slice(1);
250
+ return [`before${suffix}`, `after${suffix}`, `on${suffix}`];
251
+ })
252
+ );
253
+ function _getCustomObjectMethodNameReservation(name) {
254
+ if (baseClassMethods.has(name)) return "baseClass";
255
+ if (name === "then") return "runtime";
256
+ if (objectPrototypeMethods.has(name)) return "objectPrototype";
257
+ if (platformMethods.has(name)) return "platform";
258
+ if (lifecycleHooks.has(name)) return "lifecycle";
259
+ return void 0;
260
+ }
261
+
194
262
  // src/naming/validate.ts
195
263
  function _validateApiName(value) {
196
264
  const reasons = [];
@@ -2770,6 +2838,7 @@ export {
2770
2838
  _escapeToken,
2771
2839
  _fingerprint,
2772
2840
  _getAdapter,
2841
+ _getCustomObjectMethodNameReservation,
2773
2842
  _hasPointer,
2774
2843
  _inferStripeApiName,
2775
2844
  _isRecord,
@@ -0,0 +1,3 @@
1
+ /** Finds the reservation for a statically named Custom Object method. @internal */
2
+ export declare function _getCustomObjectMethodNameReservation(name: string): 'baseClass' | 'runtime' | 'objectPrototype' | 'platform' | 'lifecycle' | undefined;
3
+ //# sourceMappingURL=custom-object-method-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-object-method-names.d.ts","sourceRoot":"","sources":["../../src/naming/custom-object-method-names.ts"],"names":[],"mappings":"AA2DA,mFAAmF;AACnF,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,MAAM,GACX,WAAW,GAAG,SAAS,GAAG,iBAAiB,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAOpF"}