@fmaplabs/meta-manifest 0.1.0 → 0.3.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 +49 -4
- package/dist/{chunk-PFU5VAO7.js → chunk-AUR2YQCW.js} +2 -2
- package/dist/{chunk-3R6VQ3Z3.js → chunk-VSJUGUH7.js} +15 -3
- package/dist/chunk-VSJUGUH7.js.map +1 -0
- package/dist/{chunk-GH5DXHS5.js → chunk-ZTWFDJHN.js} +318 -54
- package/dist/chunk-ZTWFDJHN.js.map +1 -0
- package/dist/cli/index.cjs +324 -39
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +49 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +332 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -36
- package/dist/index.d.ts +168 -36
- package/dist/index.js +6 -2
- package/dist/node/client.cjs.map +1 -1
- package/dist/node/client.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-3R6VQ3Z3.js.map +0 -1
- package/dist/chunk-GH5DXHS5.js.map +0 -1
- /package/dist/{chunk-PFU5VAO7.js.map → chunk-AUR2YQCW.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,10 @@ interface Config {
|
|
|
11
11
|
apiVersion?: string;
|
|
12
12
|
/** Path to the schema module whose `schemas` export drives diff/push, and pull writes. */
|
|
13
13
|
schema: string;
|
|
14
|
+
/** Scope for all metaobjects, unless overridden per-metaobject. Defaults to "app". */
|
|
15
|
+
scope?: "app" | "merchant";
|
|
16
|
+
/** Default admin access for app-scoped metaobjects: false → merchant_read, true → merchant_read_write. Defaults to false. */
|
|
17
|
+
merchantEditable?: boolean;
|
|
14
18
|
}
|
|
15
19
|
/** Identity helper for type inference in `meta-manifest.config.ts`. */
|
|
16
20
|
declare function defineConfig(config: Config): Config;
|
|
@@ -65,6 +69,14 @@ type DecodeResult<T> = {
|
|
|
65
69
|
value?: undefined;
|
|
66
70
|
issues: Issue[];
|
|
67
71
|
};
|
|
72
|
+
/** Options every field builder accepts, regardless of type. */
|
|
73
|
+
interface CommonFieldOptions {
|
|
74
|
+
name?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
required?: boolean;
|
|
77
|
+
/** Expose this field as a filter in the admin (→ `capabilities.adminFilterable`). */
|
|
78
|
+
filterable?: boolean;
|
|
79
|
+
}
|
|
68
80
|
declare abstract class Field<TOut, TIn = TOut, Req extends boolean = false> {
|
|
69
81
|
abstract readonly shopifyType: string;
|
|
70
82
|
/** True when Shopify stores this type as a JSON string (objects, lists). */
|
|
@@ -72,6 +84,9 @@ declare abstract class Field<TOut, TIn = TOut, Req extends boolean = false> {
|
|
|
72
84
|
required: boolean;
|
|
73
85
|
name?: string;
|
|
74
86
|
description?: string;
|
|
87
|
+
filterable: boolean;
|
|
88
|
+
/** Apply the shared field options; call from each concrete constructor. */
|
|
89
|
+
protected applyCommon(opts: CommonFieldOptions): void;
|
|
75
90
|
readonly _out: TOut;
|
|
76
91
|
readonly _in: TIn;
|
|
77
92
|
readonly _req: Req;
|
|
@@ -96,9 +111,7 @@ declare abstract class Field<TOut, TIn = TOut, Req extends boolean = false> {
|
|
|
96
111
|
get ["~standard"](): StandardSchemaV1.Props<TIn, TOut>;
|
|
97
112
|
}
|
|
98
113
|
|
|
99
|
-
interface BooleanOptions<R extends boolean = false> {
|
|
100
|
-
name?: string;
|
|
101
|
-
description?: string;
|
|
114
|
+
interface BooleanOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
102
115
|
required?: R;
|
|
103
116
|
}
|
|
104
117
|
declare class BooleanField<R extends boolean> extends Field<boolean, boolean, R> {
|
|
@@ -112,9 +125,7 @@ declare function boolean<R extends boolean = false>(opts?: BooleanOptions<R>): B
|
|
|
112
125
|
|
|
113
126
|
type InnerOut<E> = E extends Field<infer O, any, any> ? O : never;
|
|
114
127
|
type InnerIn<E> = E extends Field<any, infer I, any> ? I : never;
|
|
115
|
-
interface ListOptions<R extends boolean = false> {
|
|
116
|
-
name?: string;
|
|
117
|
-
description?: string;
|
|
128
|
+
interface ListOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
118
129
|
required?: R;
|
|
119
130
|
min?: number;
|
|
120
131
|
max?: number;
|
|
@@ -135,9 +146,7 @@ interface Measure {
|
|
|
135
146
|
value: number;
|
|
136
147
|
unit: string;
|
|
137
148
|
}
|
|
138
|
-
interface MeasureOptions<R extends boolean = false> {
|
|
139
|
-
name?: string;
|
|
140
|
-
description?: string;
|
|
149
|
+
interface MeasureOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
141
150
|
required?: R;
|
|
142
151
|
}
|
|
143
152
|
declare class MeasurementField<R extends boolean> extends Field<Measure, Measure, R> {
|
|
@@ -156,9 +165,7 @@ interface Money {
|
|
|
156
165
|
amount: string;
|
|
157
166
|
currencyCode: string;
|
|
158
167
|
}
|
|
159
|
-
interface MoneyOptions<R extends boolean = false> {
|
|
160
|
-
name?: string;
|
|
161
|
-
description?: string;
|
|
168
|
+
interface MoneyOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
162
169
|
required?: R;
|
|
163
170
|
}
|
|
164
171
|
declare class MoneyField<R extends boolean> extends Field<Money, Money, R> {
|
|
@@ -171,9 +178,7 @@ declare class MoneyField<R extends boolean> extends Field<Money, Money, R> {
|
|
|
171
178
|
}
|
|
172
179
|
declare function money<R extends boolean = false>(opts?: MoneyOptions<R>): MoneyField<R>;
|
|
173
180
|
|
|
174
|
-
interface NumberOptions<R extends boolean = false> {
|
|
175
|
-
name?: string;
|
|
176
|
-
description?: string;
|
|
181
|
+
interface NumberOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
177
182
|
required?: R;
|
|
178
183
|
min?: number;
|
|
179
184
|
max?: number;
|
|
@@ -212,9 +217,7 @@ interface Rating {
|
|
|
212
217
|
interface RatingInput {
|
|
213
218
|
value: number;
|
|
214
219
|
}
|
|
215
|
-
interface RatingOptions<R extends boolean = false> {
|
|
216
|
-
name?: string;
|
|
217
|
-
description?: string;
|
|
220
|
+
interface RatingOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
218
221
|
required?: R;
|
|
219
222
|
min: number;
|
|
220
223
|
max: number;
|
|
@@ -232,9 +235,7 @@ declare class RatingField<R extends boolean> extends Field<Rating, RatingInput,
|
|
|
232
235
|
}
|
|
233
236
|
declare function rating<R extends boolean = false>(opts: RatingOptions<R>): RatingField<R>;
|
|
234
237
|
|
|
235
|
-
interface RefOptions<R extends boolean = false> {
|
|
236
|
-
name?: string;
|
|
237
|
-
description?: string;
|
|
238
|
+
interface RefOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
238
239
|
required?: R;
|
|
239
240
|
}
|
|
240
241
|
declare abstract class GidField<R extends boolean> extends Field<string, string, R> {
|
|
@@ -275,9 +276,7 @@ declare function page<R extends boolean = false>(opts?: RefOptions<R>): SimpleRe
|
|
|
275
276
|
declare function file<R extends boolean = false>(opts?: FileOptions<R>): FileField<R>;
|
|
276
277
|
declare function ref<R extends boolean = false>(target: TypeRef, opts?: RefOptions<R>): MetaobjectRefField<R>;
|
|
277
278
|
|
|
278
|
-
interface BaseOptions<R extends boolean = false> {
|
|
279
|
-
name?: string;
|
|
280
|
-
description?: string;
|
|
279
|
+
interface BaseOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
281
280
|
required?: R;
|
|
282
281
|
}
|
|
283
282
|
declare abstract class StringScalarField<R extends boolean> extends Field<string, string, R> {
|
|
@@ -323,9 +322,7 @@ declare function url<R extends boolean = false>(opts?: UrlOptions<R>): UrlField<
|
|
|
323
322
|
declare function color<R extends boolean = false>(opts?: BaseOptions<R>): ColorField<R>;
|
|
324
323
|
declare function json<R extends boolean = false>(opts?: BaseOptions<R>): JsonField<R>;
|
|
325
324
|
|
|
326
|
-
interface TextOptions<R extends boolean = false> {
|
|
327
|
-
name?: string;
|
|
328
|
-
description?: string;
|
|
325
|
+
interface TextOptions<R extends boolean = false> extends CommonFieldOptions {
|
|
329
326
|
required?: R;
|
|
330
327
|
min?: number;
|
|
331
328
|
max?: number;
|
|
@@ -392,6 +389,11 @@ type InferInput<F extends FieldMap> = Simplify<{
|
|
|
392
389
|
[K in OptionalKeys<F>]?: FieldIn<F[K]>;
|
|
393
390
|
}>;
|
|
394
391
|
|
|
392
|
+
interface FieldCapabilitiesInput {
|
|
393
|
+
adminFilterable?: {
|
|
394
|
+
enabled: boolean;
|
|
395
|
+
};
|
|
396
|
+
}
|
|
395
397
|
interface FieldDefinitionInput {
|
|
396
398
|
key: string;
|
|
397
399
|
name: string;
|
|
@@ -399,19 +401,44 @@ interface FieldDefinitionInput {
|
|
|
399
401
|
required: boolean;
|
|
400
402
|
type: string;
|
|
401
403
|
validations: FieldValidation[];
|
|
404
|
+
capabilities?: FieldCapabilitiesInput;
|
|
405
|
+
}
|
|
406
|
+
interface AccessInput {
|
|
407
|
+
admin?: string;
|
|
408
|
+
storefront?: string;
|
|
409
|
+
customerAccount?: string;
|
|
410
|
+
}
|
|
411
|
+
interface RenderableData {
|
|
412
|
+
metaTitleKey?: string;
|
|
413
|
+
metaDescriptionKey?: string;
|
|
414
|
+
}
|
|
415
|
+
interface OnlineStoreData {
|
|
416
|
+
urlHandle: string;
|
|
417
|
+
createRedirects?: boolean;
|
|
418
|
+
}
|
|
419
|
+
interface CapabilitiesInput {
|
|
420
|
+
publishable?: {
|
|
421
|
+
enabled: boolean;
|
|
422
|
+
};
|
|
423
|
+
translatable?: {
|
|
424
|
+
enabled: boolean;
|
|
425
|
+
};
|
|
426
|
+
renderable?: {
|
|
427
|
+
enabled: boolean;
|
|
428
|
+
data?: RenderableData;
|
|
429
|
+
};
|
|
430
|
+
onlineStore?: {
|
|
431
|
+
enabled: boolean;
|
|
432
|
+
data?: OnlineStoreData;
|
|
433
|
+
};
|
|
402
434
|
}
|
|
403
435
|
interface MetaobjectDefinitionInput {
|
|
404
436
|
type: string;
|
|
405
437
|
name: string;
|
|
406
438
|
description?: string;
|
|
407
439
|
displayNameKey?: string;
|
|
408
|
-
access?:
|
|
409
|
-
|
|
410
|
-
storefront?: string;
|
|
411
|
-
};
|
|
412
|
-
capabilities?: Record<string, {
|
|
413
|
-
enabled: boolean;
|
|
414
|
-
}>;
|
|
440
|
+
access?: AccessInput;
|
|
441
|
+
capabilities?: CapabilitiesInput;
|
|
415
442
|
fieldDefinitions: FieldDefinitionInput[];
|
|
416
443
|
}
|
|
417
444
|
declare function toDefinitionInput<F extends FieldMap>(schema: MetaobjectSchema<F>): MetaobjectDefinitionInput;
|
|
@@ -419,16 +446,30 @@ declare function toDefinitionInput<F extends FieldMap>(schema: MetaobjectSchema<
|
|
|
419
446
|
interface AccessConfig {
|
|
420
447
|
admin?: "merchant_read" | "merchant_read_write";
|
|
421
448
|
storefront?: "public_read" | "none";
|
|
449
|
+
customerAccount?: "none" | "read";
|
|
450
|
+
}
|
|
451
|
+
/** SEO metadata: `true` enables with auto keys; an object maps field keys as title/description. */
|
|
452
|
+
type RenderableConfig = boolean | {
|
|
453
|
+
metaTitleKey?: string;
|
|
454
|
+
metaDescriptionKey?: string;
|
|
455
|
+
};
|
|
456
|
+
/** Publish entries as Online Store web pages. `urlHandle` is required by Shopify. */
|
|
457
|
+
interface OnlineStoreConfig {
|
|
458
|
+
urlHandle: string;
|
|
459
|
+
createRedirects?: boolean;
|
|
422
460
|
}
|
|
423
461
|
interface CapabilitiesConfig {
|
|
424
462
|
publishable?: boolean;
|
|
425
463
|
translatable?: boolean;
|
|
426
|
-
renderable?:
|
|
464
|
+
renderable?: RenderableConfig;
|
|
465
|
+
onlineStore?: OnlineStoreConfig;
|
|
427
466
|
}
|
|
428
467
|
interface MetaobjectConfig<F> {
|
|
429
468
|
name: string;
|
|
430
469
|
description?: string;
|
|
431
470
|
displayName?: keyof F & string;
|
|
471
|
+
/** Override the global config scope for this metaobject. */
|
|
472
|
+
scope?: "app" | "merchant";
|
|
432
473
|
access?: AccessConfig;
|
|
433
474
|
capabilities?: CapabilitiesConfig;
|
|
434
475
|
fields: F;
|
|
@@ -459,17 +500,54 @@ interface MetaobjectSchema<F extends FieldMap> {
|
|
|
459
500
|
}
|
|
460
501
|
declare function defineMetaobject<F extends Record<string, unknown>>(handle: string, config: MetaobjectConfig<F>): F extends FieldMap ? MetaobjectSchema<F> : never;
|
|
461
502
|
|
|
503
|
+
interface RemoteAccess {
|
|
504
|
+
admin?: string;
|
|
505
|
+
storefront?: string;
|
|
506
|
+
customerAccount?: string;
|
|
507
|
+
}
|
|
508
|
+
/** Normalized capability comparison shape. `enabled` is compared for every capability
|
|
509
|
+
* present locally; `data` keys are compared only when locally declared. [design §8] */
|
|
510
|
+
interface RemoteRenderable {
|
|
511
|
+
enabled: boolean;
|
|
512
|
+
data?: {
|
|
513
|
+
metaTitleKey?: string;
|
|
514
|
+
metaDescriptionKey?: string;
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
interface RemoteOnlineStore {
|
|
518
|
+
enabled: boolean;
|
|
519
|
+
data?: {
|
|
520
|
+
urlHandle?: string;
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
interface RemoteCapabilities {
|
|
524
|
+
publishable?: {
|
|
525
|
+
enabled: boolean;
|
|
526
|
+
};
|
|
527
|
+
translatable?: {
|
|
528
|
+
enabled: boolean;
|
|
529
|
+
};
|
|
530
|
+
renderable?: RemoteRenderable;
|
|
531
|
+
onlineStore?: RemoteOnlineStore;
|
|
532
|
+
}
|
|
462
533
|
interface RemoteField {
|
|
463
534
|
key: string;
|
|
464
535
|
type: string;
|
|
465
536
|
required: boolean;
|
|
537
|
+
filterable: boolean;
|
|
466
538
|
validations: FieldValidation[];
|
|
467
539
|
}
|
|
468
540
|
interface RemoteDefinition {
|
|
469
541
|
type: string;
|
|
470
542
|
name?: string;
|
|
543
|
+
description?: string;
|
|
544
|
+
displayNameKey?: string;
|
|
545
|
+
access?: RemoteAccess;
|
|
546
|
+
capabilities?: RemoteCapabilities;
|
|
471
547
|
fields: RemoteField[];
|
|
472
548
|
}
|
|
549
|
+
/** Normalize a (already scope-resolved) definition input to the diff shape. */
|
|
550
|
+
declare function normalizeDefinition(def: MetaobjectDefinitionInput): RemoteDefinition;
|
|
473
551
|
declare function normalizeLocal<F extends FieldMap>(schema: MetaobjectSchema<F>): RemoteDefinition;
|
|
474
552
|
interface PulledFieldDefinition {
|
|
475
553
|
key: string;
|
|
@@ -478,10 +556,45 @@ interface PulledFieldDefinition {
|
|
|
478
556
|
} | string;
|
|
479
557
|
required: boolean;
|
|
480
558
|
validations?: FieldValidation[];
|
|
559
|
+
capabilities?: {
|
|
560
|
+
adminFilterable?: {
|
|
561
|
+
enabled: boolean;
|
|
562
|
+
} | null;
|
|
563
|
+
} | null;
|
|
564
|
+
}
|
|
565
|
+
interface PulledAccess {
|
|
566
|
+
admin?: string | null;
|
|
567
|
+
storefront?: string | null;
|
|
568
|
+
customerAccount?: string | null;
|
|
569
|
+
}
|
|
570
|
+
interface PulledCapabilities {
|
|
571
|
+
publishable?: {
|
|
572
|
+
enabled: boolean;
|
|
573
|
+
} | null;
|
|
574
|
+
translatable?: {
|
|
575
|
+
enabled: boolean;
|
|
576
|
+
} | null;
|
|
577
|
+
renderable?: {
|
|
578
|
+
enabled: boolean;
|
|
579
|
+
data?: {
|
|
580
|
+
metaTitleKey?: string | null;
|
|
581
|
+
metaDescriptionKey?: string | null;
|
|
582
|
+
} | null;
|
|
583
|
+
} | null;
|
|
584
|
+
onlineStore?: {
|
|
585
|
+
enabled: boolean;
|
|
586
|
+
data?: {
|
|
587
|
+
urlHandle?: string | null;
|
|
588
|
+
} | null;
|
|
589
|
+
} | null;
|
|
481
590
|
}
|
|
482
591
|
interface PulledDefinition {
|
|
483
592
|
type: string;
|
|
484
593
|
name?: string;
|
|
594
|
+
description?: string | null;
|
|
595
|
+
displayNameKey?: string | null;
|
|
596
|
+
access?: PulledAccess | null;
|
|
597
|
+
capabilities?: PulledCapabilities | null;
|
|
485
598
|
fieldDefinitions: PulledFieldDefinition[];
|
|
486
599
|
}
|
|
487
600
|
declare function normalizeRemote(def: PulledDefinition): RemoteDefinition;
|
|
@@ -493,10 +606,17 @@ declare function normalizeRemote(def: PulledDefinition): RemoteDefinition;
|
|
|
493
606
|
*/
|
|
494
607
|
declare function generateSchemaSource(defs: RemoteDefinition[]): string;
|
|
495
608
|
|
|
609
|
+
/** Definition-level metadata that `updateDefinition` reconciles. */
|
|
610
|
+
type DefinitionChange = "name" | "description" | "displayNameKey" | "access" | "capabilities";
|
|
496
611
|
type DiffOp = {
|
|
497
612
|
kind: "createDefinition";
|
|
498
613
|
type: string;
|
|
499
614
|
definition: RemoteDefinition;
|
|
615
|
+
} | {
|
|
616
|
+
kind: "updateDefinition";
|
|
617
|
+
type: string;
|
|
618
|
+
changes: DefinitionChange[];
|
|
619
|
+
destructive?: true;
|
|
500
620
|
} | {
|
|
501
621
|
kind: "addField";
|
|
502
622
|
type: string;
|
|
@@ -521,6 +641,18 @@ type DiffOp = {
|
|
|
521
641
|
};
|
|
522
642
|
declare function diff(local: RemoteDefinition[], remote: RemoteDefinition[]): DiffOp[];
|
|
523
643
|
|
|
644
|
+
type AnySchema$1 = MetaobjectSchema<any>;
|
|
645
|
+
/** The subset of config that scope resolution reads. */
|
|
646
|
+
type ScopeConfig = Pick<Config, "scope" | "merchantEditable">;
|
|
647
|
+
type Scope = "app" | "merchant";
|
|
648
|
+
/**
|
|
649
|
+
* Resolve each schema's canonical (`$app:`) definition input into the effective
|
|
650
|
+
* input the sync pipeline pushes: definition `type` and reference targets are
|
|
651
|
+
* rewritten to each metaobject's effective scope, and `access.admin` is resolved.
|
|
652
|
+
* `schema.type` / `m.ref` public values are unchanged. [design §6]
|
|
653
|
+
*/
|
|
654
|
+
declare function resolveDefinitions(schemas: AnySchema$1[], config?: ScopeConfig): MetaobjectDefinitionInput[];
|
|
655
|
+
|
|
524
656
|
/**
|
|
525
657
|
* A definition read back from the store. `type` is the canonical "$app:…" key
|
|
526
658
|
* (the REQUESTED type, re-labeled from the resolved `app--…` form Shopify
|
|
@@ -599,4 +731,4 @@ declare function push(client: AdminGraphQLClient, plan: DiffOp[], sources: {
|
|
|
599
731
|
|
|
600
732
|
type AnySchema = MetaobjectSchema<any>;
|
|
601
733
|
|
|
602
|
-
export { type AccessConfig, AdminGraphQLClient, type AnySchema, type CapabilitiesConfig, type Config, DEFAULT_API_VERSION, type DecodeResult, type DiffOp, Field, type FieldDefinitionInput, type FieldValidation, type FileType, type Infer, type InferInput, type Issue, type Measure, type MetaobjectConfig, type MetaobjectDefinitionInput, type MetaobjectSchema, type Money, type ParseInput, type PulledRemote, type PushOpResult, type PushOptions, type PushResult, type Rating, type RatingInput, type RemoteDefinition, type RemoteField, StandardSchemaV1, type TypeRef, defineConfig, defineMetaobject, diff, generateSchemaSource, m, normalizeLocal, normalizeRemote, pull, pullAll, push, toDefinitionInput, validateConfig };
|
|
734
|
+
export { type AccessConfig, AdminGraphQLClient, type AnySchema, type CapabilitiesConfig, type Config, DEFAULT_API_VERSION, type DecodeResult, type DefinitionChange, type DiffOp, Field, type FieldDefinitionInput, type FieldValidation, type FileType, type Infer, type InferInput, type Issue, type Measure, type MetaobjectConfig, type MetaobjectDefinitionInput, type MetaobjectSchema, type Money, type ParseInput, type PulledDefinition, type PulledRemote, type PushOpResult, type PushOptions, type PushResult, type Rating, type RatingInput, type RemoteAccess, type RemoteCapabilities, type RemoteDefinition, type RemoteField, type Scope, type ScopeConfig, StandardSchemaV1, type TypeRef, defineConfig, defineMetaobject, diff, generateSchemaSource, m, normalizeDefinition, normalizeLocal, normalizeRemote, pull, pullAll, push, resolveDefinitions, toDefinitionInput, validateConfig };
|